예제 #1
0
 public void RemoveChoice(string choice)
 {
     Choices.Remove(choice);
     if (descriptions.ContainsKey(choice))
     {
         descriptions.Remove(choice);
     }
 }
예제 #2
0
 /// <summary>
 /// Remove choice from list
 /// </summary>
 /// <param name="chcToDelete"></param>
 public void DeleteChoice(Choice chcToDelete)
 {
     if (Choices != null)
     {
         // Remove by instance
         Choices.Remove(chcToDelete);
     }
 }
예제 #3
0
 private void AddChoice(object obj)
 {
     if (!string.IsNullOrEmpty(ChoiceItem) && !Selected.Contains(ChoiceItem))
     {
         Selected.Add(ChoiceItem);
         Selected = new ObservableCollection <string>(Selected.OrderBy(s => s));
         Choices.Remove(ChoiceItem);
     }
     ToggleActivatation();
 }
        public async void ExecuteDeleteChoiceCommand()
        {
            var vs = (StringViewModel)Choices?.CurrentItem;

            if ((await DialogService.Ask("Delete Choice?", $"Delete choice \"{vs?.Value}?\"", AskButton.OKCancel)) ==
                AskResult.OK)
            {
                Choices?.Remove(Choices.CurrentItem);
                _choicesChanged = true;
                OkCommand.RaiseCanExecuteChanged();
            }
        }
 public UIRadioButtonContainer()
 {
     OnChildAdded += (source, e) =>
     {
         if (e.Target is UIRadioButton radio)
         {
             Choices.Add(radio);
             radio.OnValueChanged += SelectChange;
         }
     };
     OnChildRemoved += (source, e) =>
     {
         if (e.Target is UIRadioButton radio)
         {
             Choices.Remove(radio);
         }
     };
 }
예제 #6
0
 private void Configuration_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(Configuration.BrowserList))
     {
         var added = Configuration.BrowserList.Where(b => Choices.All(c => c.Model.Name != b.Name)).ToList();
         if (added.Count > 0)
         {
             foreach (var vm in added.Select(m => new BrowserViewModel(m, this)))
             {
                 Choices.Add(vm);
             }
         }
         var removed = Choices.Where(c => Configuration.BrowserList.All(b => b.Name != c.Model.Name)).ToList();
         if (removed.Count > 0)
         {
             foreach (var m in removed)
             {
                 Choices.Remove(m);
             }
         }
     }
 }
예제 #7
0
 public void OnPostRemoveChoice(String Value)
 {
     Choices.Remove(Value);
 }
예제 #8
0
 public void RemoveChoice(Choice choice)
 {
     Choices.Remove(choice);
 }
        public RadioEditorViewModel(IEditorViewModelFactory editorFactory)
        {
            _editorFactory = editorFactory;

            Title = "RadioButton Control";

            AddChoiceCommand    = new DelegateCommand(AddChoice, () => true);
            RemoveChoiceCommand = new DelegateCommand <ChoiceEditorViewModel>(choice => Choices.Remove(choice), choice => Choices.IndexOf(choice) > 0);

            Choices.CollectionChanged += (sender, args) => OnUpdateSnippet();

            AddChoice();
        }
예제 #10
0
 public void RemoveChoice(Choice choice)
 {
     Choices.Remove(choice);
     OnChoicesUpdated();
 }