Beispiel #1
0
        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));
        }
Beispiel #2
0
        public void DeleteButton_RemovedFromSelection()
        {
            DashboardButtonVM button = dashboard.ViewModels [0];

            dashboard.Selection.Replace(button.ToEnumerable());

            dashboard.ViewModels.Remove(button);

            Assert.IsEmpty(dashboard.Selection);
        }
Beispiel #3
0
 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);
         }
     }
 }
Beispiel #4
0
        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);
            }
        }
Beispiel #5
0
        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;
        }
Beispiel #6
0
 void RemoveButton(DashboardButtonVM vm)
 {
     RemoveObject(buttonsDict [vm]);
     buttonsDict.Remove(vm);
     vm.ActionLinks.ViewModels.CollectionChanged -= HandleActionLinksCollectionChanged;
 }