Example #1
0
        public ComunePage(ComuneSettings settings = null)
        {
            vm = new ComuneViewModel(settings);

            BindingContext = vm;
            InitializeComponent();
        }
Example #2
0
        public void OnDelete(object sender, EventArgs e)
        {
            var            mi     = ((MenuItem)sender);
            ComuneSettings comune = mi.CommandParameter as ComuneSettings;

            vm.RemoveComune(comune);

            updateButtonEnabled();

            // DisplayAlert("Delete Context Action", mi.CommandParameter + " delete context action", "OK");
        }
Example #3
0
        void Handle_ItemTapped(object sender, Xamarin.Forms.ItemTappedEventArgs e)
        {
            ComuneSettings settings = e.Item as ComuneSettings;

            //DisplayAlert("Tapped", setting.Title, "Ok");

            if (settings != null)
            {
                Navigation.PushAsync(new ComunePage(settings));
            }
        }
Example #4
0
        public void RemoveComune(ComuneSettings comune)
        {
            var removingItem = Comuni.FirstOrDefault(c => c.Name == comune.Name);

            if (removingItem != null)
            {
                Comuni.Remove(removingItem);

                OnPropertyChanged("Comuni");
            }


            // DisplayAlert("Delete Context Action", mi.CommandParameter + " delete context action", "OK");
        }
Example #5
0
        public ComuneSettings AddComune(string name)
        {
            // crea un comune con le impostazioni di default
            ComuneSettings comune = new ComuneSettings {
                Name = name
            };

            ComuneSettings currentSettings = Comuni.FirstOrDefault <ComuneSettings>(c => c.Name == comune.Name); //cerco se il comune รจ gi


            if ((currentSettings == null) && (Comuni.Count < _maxComuni))
            {
                Comuni.Add(comune);

                OnPropertyChanged("Comuni");

                return(comune);
            }
            return(null);
        }