Esempio n. 1
0
        public void ConfigureCommand_UseCommandWithoutArgument_CommandExecuted()
        {
            var hasBeenExecuted = false;
            ICommand cmd = new RelayCommand(() => hasBeenExecuted = true, () => false);

            cmd.Execute(null);

            Assert.IsFalse(cmd.CanExecute(null));
            Assert.IsTrue(hasBeenExecuted);
        }
Esempio n. 2
0
        /// <summary>
        /// Builds the buttons for the main menu.
        /// </summary>
        private void BuildButtons()
        {
            var navigateCommand = new RelayCommand(() => this.Navigate(), () => this.CanNavigate());

            var navigateButton = new RibbonButtonData(Messages.Title_DbConvertManager
                    , imgUri.FormatWith("Source")
                    , navigateCommand) { Order = 4 };

            PluginContext.Host.AddToApplicationMenu(navigateButton);
        }
Esempio n. 3
0
        /// <summary>
        /// Builds the context menu of this plugin.
        /// </summary>
        private void BuildContextMenu()
        {
            var counter = 0;
            var cgroup = new RibbonGroupData(Messages.Menu_Actions, 1);
            var tab = new RibbonTabData() { Header = Messages.Menu_File, ContextualTabGroupHeader = Messages.Title_PathologyManager };

            tab.GroupDataCollection.Add(cgroup);
            this.ContextualMenu = new RibbonContextualTabGroupData(Messages.Title_PathologyManager, tab) { Background = Brushes.OrangeRed, IsVisible = false, };
            PluginContext.Host.AddContextualMenu(this.ContextualMenu);
            PluginContext.Host.AddTab(tab);

            ICommand addPeriodCommand = new RelayCommand(() => ViewService.Manager.ShowDialog<AddPeriodViewModel>()
                , () => PluginContext.DoorKeeper.IsUserGranted(To.Write));
            cgroup.ButtonDataCollection.Add(new RibbonButtonData(Messages.Title_AddPeriods, imgUri.FormatWith("Add"), addPeriodCommand) { Order = counter++ });

            ICommand addPathologyCategory = new RelayCommand(() => ViewService.Manager.ShowDialog<AddPathologyCategoryViewModel>()
                , () => PluginContext.DoorKeeper.IsUserGranted(To.Write));
            cgroup.ButtonDataCollection.Add(new RibbonButtonData(Messages.Title_AddPathologyCategory, imgUri.FormatWith("PathologyType"), addPathologyCategory) { Order = counter++ });

            ICommand addPathologyCommand = new RelayCommand(() => ViewService.Manager.ShowDialog<AddPathologyViewModel>()
                , () => PluginContext.DoorKeeper.IsUserGranted(To.Write));
            cgroup.ButtonDataCollection.Add(new RibbonButtonData(Messages.Title_AddPathology, imgUri.FormatWith("Pathology"), addPathologyCommand) { Order = counter++ });
        }
Esempio n. 4
0
        /// <summary>
        /// Builds the context menu of this plugin.
        /// </summary>
        private void BuildContextMenu()
        {
            var cgroup = new RibbonGroupData(Messages.Menu_Actions, 1);
            var tab = new RibbonTabData() { Header = Messages.Menu_File, ContextualTabGroupHeader = Messages.Title_MeetingsManager };

            tab.GroupDataCollection.Add(cgroup);
            this.ContextualMenu = new RibbonContextualTabGroupData(Messages.Title_MeetingsManager, tab) { Background = Brushes.OrangeRed, IsVisible = false, };
            PluginContext.Host.AddContextualMenu(this.ContextualMenu);
            PluginContext.Host.AddTab(tab);

            ICommand addCommand = new RelayCommand(() => ViewService.Manager.ShowDialog<AddMeetingViewModel>(), () => IsCalendatEditor);
            cgroup.ButtonDataCollection.Add(new RibbonButtonData(Messages.Title_AddMeeting, imgUri.FormatWith("Add"), addCommand) { Order = 1, });

            ICommand removeCommand = new RelayCommand(() => ViewService.Manager.ShowDialog<RemoveMeetingViewModel>(), () => IsCalendatEditor);
            cgroup.ButtonDataCollection.Add(new RibbonButtonData(Messages.Title_RemoveMeeting, imgUri.FormatWith("Delete"), removeCommand) { Order = 2, });

            ICommand addCategoryCommand = new RelayCommand(() => ViewService.Manager.ShowDialog<AddCategoryViewModel>(), () => IsCalendatEditor);
            cgroup.ButtonDataCollection.Add(new RibbonButtonData(Messages.Msg_AddCategory, imgUri.FormatWith("AddCategory"), addCategoryCommand) { Order = 3, });
        }
Esempio n. 5
0
        /// <summary>
        /// Builds the context menu the ribbon for this plugin.
        /// </summary>
        private void BuildContextMenu()
        {
            var ngroup = new RibbonGroupData(Messages.Menu_Navigation, 1);
            var cgroup = new RibbonGroupData(Messages.Menu_Actions, 2);

            var tab = new RibbonTabData() { Header = Messages.Menu_File, ContextualTabGroupHeader = Messages.Title_AuthorisationManager };
            tab.GroupDataCollection.Add(cgroup);
            tab.GroupDataCollection.Add(ngroup);

            this.ContextualMenu = new RibbonContextualTabGroupData(Messages.Title_AuthorisationManager, tab) { Background = Brushes.OrangeRed, IsVisible = false, };
            PluginContext.Host.AddContextualMenu(this.ContextualMenu);
            PluginContext.Host.AddTab(tab);

            ICommand roleCommand = new RelayCommand(() => this.NavigateRole(), () => this.CanNavigateRole());
            ngroup.ButtonDataCollection.Add(new RibbonButtonData(Messages.Title_RoleManager, imgUri.FormatWith("Admin"), roleCommand) { Order = 1, });

            ICommand userCommand = new RelayCommand(() => this.NavigateUser(), () => this.CanNavigateUser());
            ngroup.ButtonDataCollection.Add(new RibbonButtonData(Messages.Title_UserManager, imgUri.FormatWith("UserSetup"), userCommand) { Order = 2, });

            ICommand addRoleCommand = new RelayCommand(() => ViewService.Manager.ShowDialog<AddRoleViewModel>());
            cgroup.ButtonDataCollection.Add(new RibbonButtonData(Messages.Title_AddRole, imgUri.FormatWith("New"), addRoleCommand) { Order = 2, });
        }