using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Text;
using System.Windows.Input;
using Xamarin.Forms;

namespace FormApp2
{
    public class ConnectionListViewModel: INotifyPropertyChanged
    {
        public ICommand AddConnectionNameCommand => new Command(AddConnectionName);
        public ObservableCollection<string> Connections { get; set; }
        public string ConnectionName { get; set; }

        public string ConnectionUrl { get; set; }
        public ConnectionListViewModel()
        {
            Connections = new ObservableCollection<string>();
            Connections.Add("text");
            Connections.Add("text2");
            Connections.Add("text3");

            ConnectionName = "test123";
        }
        public void AddConnectionName()
        {
            Connections.Add(ConnectionName);
        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
