public void SelectionChanged_EmptySelection_SelectionSynced() { DashboardButtonVM button = dashboard.ViewModels [0]; dashboard.Selection.Replace(button.ToEnumerable()); Assert.AreEqual(1, dashboardCanvas.Objects.OfType <DashboardButtonView> (). Count(b => b.Selected == true)); }
public void DeleteButton_RemovedFromSelection() { DashboardButtonVM button = dashboard.ViewModels [0]; dashboard.Selection.Replace(button.ToEnumerable()); dashboard.ViewModels.Remove(button); Assert.IsEmpty(dashboard.Selection); }
void RemoveActionLinks(DashboardButtonVM button) { //Remove source ActionLinks button.ActionLinks.ViewModels.RemoveRange(button.ActionLinks.ViewModels); //Remove Dest ActionLinks foreach (var b in ViewModel.ViewModels) { var linksToRemove = b.ActionLinks.Where(al => al.DestinationButton == button); if (linksToRemove.Any()) { b.ActionLinks.ViewModels.RemoveRange(linksToRemove); } } }
protected async Task HandleDeleteButton(DeleteEvent <DashboardButtonVM> evt) { DashboardButtonVM buttonVM = evt.Object; if (buttonVM == null) { return; } string msg = Catalog.GetString("Do you want to delete: ") + buttonVM.Name + "?"; if (await App.Current.Dialogs.QuestionMessage(msg, null, this)) { RemoveActionLinks(evt.Object); ViewModel.ViewModels.Remove(evt.Object); } }
void AddButton(DashboardButtonVM vm) { IView view = App.Current.ViewLocator.Retrieve(vm.View); view.SetViewModel(vm); var viewButton = view as DashboardButtonView; if (viewButton is AnalysisEventButtonView) { ((AnalysisEventButtonView)viewButton).EditButtonTagsEvent += (t) => { if (EditButtonTagsEvent != null) { EditButtonTagsEvent(t); } }; } viewButton.ShowLinks = ViewModel.ShowLinks; AddObject(viewButton); buttonsDict.Add(vm, viewButton); vm.ActionLinks.ViewModels.CollectionChanged += HandleActionLinksCollectionChanged; }
void RemoveButton(DashboardButtonVM vm) { RemoveObject(buttonsDict [vm]); buttonsDict.Remove(vm); vm.ActionLinks.ViewModels.CollectionChanged -= HandleActionLinksCollectionChanged; }