Пример #1
0
        // copy the task list into an observable collection of list names
        private void UpdateView(int newSelection = 0)
        {
            Log.Instance.LogDebug(string.Format("MainViewModel.UpdateView {0}", newSelection));

            TaskLists.Clear();
            ContextMenuItems.Clear();

            if (TaskListGroup != null)
            {
                for (int i = 0; i < TaskListGroup.NumLists; i++)
                {
                    Log.Instance.LogDebug(string.Format("MainViewModel.Adding Task List {0}", TaskListGroup.ListName(i)));

                    TaskLists.Add(new TaskListView(TaskListGroup.ListName(i)));
                    ContextMenuItems.Add(new ContextMenuItem(TaskListGroup.ListName(i), new CustomCommandHandler(i, OnMoveItem)));
                }
            }
            else
            {
                Log.Instance.LogDebug(string.Format("MainViewModel.UpdateView - TaskListGroup is null, skipping"));
            }

            RaisePropertyChanged("TaskLists");
            RaisePropertyChanged("ContextMenuItems");

            SelectedTaskList = newSelection;

            PropertyDataGridViewModel = new DataGridViewModel(TaskListGroup, SelectedTaskList);
        }
Пример #2
0
        public void LoadContextMenu()
        {
            var results = PluginManager.GetContextMenusForPlugin(Result);

            ContextMenuItems.Clear();
            foreach (var r in results)
            {
                ContextMenuItems.Add(new ContextMenuItemViewModel()
                {
                    PluginName           = r.PluginName,
                    Title                = r.Title,
                    Glyph                = r.Glyph,
                    FontFamily           = r.FontFamily,
                    AcceleratorKey       = r.AcceleratorKey,
                    AcceleratorModifiers = r.AcceleratorModifiers,
                    Command              = new RelayCommand(_ =>
                    {
                        bool hideWindow =
                            r.Action != null &&
                            r.Action(
                                new ActionContext
                        {
                            SpecialKeyState = KeyboardHelper.CheckModifiers(),
                        });

                        if (hideWindow)
                        {
                            // TODO - Do we hide the window
                            // MainWindowVisibility = Visibility.Collapsed;
                        }
                    }),
                });
            }
        }
Пример #3
0
 protected virtual void PopulateContextMenu()
 {
     ContextMenuItems.Add(new ExpandMenuItem(this));
     ContextMenuItems.Add(new CollapseMenuItem(this));
     ContextMenuItems.Add(new ExpandAllMenuItem(this));
     ContextMenuItems.Add(new CollapseAllMenuItem(this));
 }
Пример #4
0
 public override void AddMenuItems()
 {
     base.AddMenuItems();
     if (_AppManager.AppMode == AppMode.VHF)
     {
         ContextMenuItems.Add(new ExplorerMenuItem(_S2DF, null, SetToDefault_Clicked));
     }
 }
 public override void AddMenuItems()
 {
     ContextMenuItems.Add(new ExplorerMenuItem(_LA, null, LoadVariables_Clicked));
     ContextMenuItems.Add(new ExplorerMenuItem(_LAD, null, LoaddAllData_Clicked));
     ContextMenuItems.Add(new ExplorerMenuItem(_AT, Resources.AttributesWindow16, AttributeTable_Clicked));
     ContextMenuItems.Add(new ExplorerMenuItem(_OP, Resources.GenericWindowLightBlue16, Optional_Clicked));
     ContextMenuItems.Add(new ExplorerMenuItem(PEContextMenu.MenuSeparator, null, null));
 }
 public override void AddMenuItems()
 {
     if (MyAppManager.Instance.AppMode == AppMode.VHF)
     {
         ContextMenuItems.Add(new ExplorerMenuItem("Add Package...", Resources.MapPackageTiledTPKFile16, ProjectItem_NewPackageClicked));
         ContextMenuItems.Add(new ExplorerMenuItem(PEContextMenu.MenuSeparator, null, null));
     }
     ContextMenuItems.Add(new ExplorerMenuItem("Expand All", null, ExpandAll_Clicked));
     ContextMenuItems.Add(new ExplorerMenuItem("Collapse All", null, CollapseAll_Clicked));
     ContextMenuItems.Add(new ExplorerMenuItem(PEContextMenu.MenuSeparator, null, null));
 }
Пример #7
0
        public FolderViewModel(IProjectFolder folder, IProjectExplorerItemViewModelFactory factory,
                               IAddContextMenuItemFactory addContextMenuItemFactory) : base(folder.FolderName)
        {
            _folder  = folder;
            _factory = factory;

            UpdateItems(_factory.Create(_folder.Folders, _folder.Files));

            ContextMenuItems.Add(addContextMenuItemFactory.Create(folder));

            folder.FolderAdded += OnFolderItemsChanged;
            folder.FileAdded   += OnFolderItemsChanged;
        }
Пример #8
0
        public ProjectRootViewModel(IProject project, IProjectExplorerItemViewModelFactory factory,
                                    IAddContextMenuItemFactory addContextMenuItemFactory) : base(project.ProjectName)
        {
            _project = project;
            _factory = factory;

            UpdateItems(_factory.Create(project.Folders, project.Files));

            ContextMenuItems.Add(addContextMenuItemFactory.Create(_project));

            project.FolderAdded += OnProjectItemsChanged;
            project.FileAdded   += OnProjectItemsChanged;
        }
Пример #9
0
        public virtual void Initialize()
        {
            _AppManager = MyAppManager.Instance;
            if (_AppManager.AppMode == AppMode.HE)
            {
                _ShellService = MyAppManager.Instance.CompositionContainer.GetExportedValue <IShellService>();
            }
            else
            {
                _ShellService = MyAppManager.Instance.CompositionContainer.GetExportedValue <IShellService>();
            }
            _ProjectService    = MyAppManager.Instance.CompositionContainer.GetExportedValue <IProjectService>();
            _ActiveDataService = MyAppManager.Instance.CompositionContainer.GetExportedValue <IActiveDataService>();

            ContextMenuItems.Add(new ExplorerMenuItem("Property", Resources.property16, ProjectItem_PropertyClicked));
            AddMenuItems();
        }
Пример #10
0
        public SceneRootViewModel(SceneModel sceneModel, IEventBus eventBus, IEntityPropertiesEditorViewModelFactory entityPropertiesEditorViewModelFactory)
        {
            _sceneModel = sceneModel;
            _eventBus   = eventBus;
            _entityPropertiesEditorViewModelFactory = entityPropertiesEditorViewModelFactory;

            Name = "Scene";

            foreach (var entityModel in _sceneModel.RootEntities)
            {
                Items.Add(new EntityViewModel(entityModel, _eventBus, _entityPropertiesEditorViewModelFactory));
            }

            ContextMenuItems.Add(new ContextMenuItem("Add entity", RelayCommand.Create(AddEntity)));

            _sceneModel.EntityAdded += SceneModelOnEntityAdded;
        }
Пример #11
0
        public FlowMasterViewModel(IFlowMasterService CurrentService,
                                   BackendDBContext context, IMapper Mapper,
                                   UserHelper currentUserHelper,
                                   TranscationResultHelper transcationResultHelper,
                                   CurrentUser currentUser)
        {
            this.CurrentService = CurrentService;
            this.context        = context;
            mapper                  = Mapper;
            CurrentUserHelper       = currentUserHelper;
            TranscationResultHelper = transcationResultHelper;
            CurrentUser             = currentUser;
            FlowMasterSort.Initialization(SortConditions);

            #region 工具列按鈕初始化
            Toolbaritems.Add(new ItemModel()
            {
                Id          = ButtonIdHelper.ButtonIdAdd,
                Text        = "新增",
                TooltipText = "新增",
                Type        = ItemType.Button,
                PrefixIcon  = "mdi mdi-plus-thick",
                Align       = ItemAlign.Left,
            });
            Toolbaritems.Add(new ItemModel()
            {
                Id          = ButtonIdHelper.ButtonIdRefresh,
                Text        = "重新整理",
                TooltipText = "重新整理",
                PrefixIcon  = "mdi mdi-refresh",
                Align       = ItemAlign.Left,
            });
            Toolbaritems.Add("Search");
            #endregion


            #region 互動式彈出功能表 ContextMenu 初始化
            ContextMenuItems.Add(new ContextMenuItemModel
            {
                Text    = "查看來源記錄",
                Target  = ".e-content",
                Id      = "查看來源記錄",
                IconCss = "mdi mdi-file-find",
            });
            #endregion
        }
Пример #12
0
        public EntityViewModel(EntityModel entityModel, IEventBus eventBus, IEntityPropertiesEditorViewModelFactory entityPropertiesEditorViewModelFactory)
        {
            _entityModel = entityModel;
            _eventBus    = eventBus;
            _entityPropertiesEditorViewModelFactory = entityPropertiesEditorViewModelFactory;

            Name = _entityModel.Name;

            foreach (var model in _entityModel.Children)
            {
                Items.Add(new EntityViewModel(model, _eventBus, _entityPropertiesEditorViewModelFactory));
            }

            ContextMenuItems.Add(new ContextMenuItem("Add child entity", RelayCommand.Create(AddChildEntity)));

            _entityModel.EntityAdded += EntityModelOnEntityAdded;
            _entityModel.NameChanged += EntityModelOnNameChanged;
        }
Пример #13
0
        public override void AddMenuItems()
        {
            ContextMenuItems.Add(new ExplorerMenuItem(_Save, null, Save_Clicked));
            ContextMenuItems.Add(new ExplorerMenuItem(_SaveAs, Resources.GenericSave_B_16, SaveAs_Clicked));

            ContextMenuItems.Add(new ExplorerMenuItem(_EX, null, Export_Clicked));
            if (MyAppManager.Instance.AppMode == AppMode.VHF)
            {
                ContextMenuItems.Add(new ExplorerMenuItem(PEContextMenu.MenuSeparator, null, null));
                ContextMenuItems.Add(new ExplorerMenuItem(_CS, Resources.MapPackageTiledTPKFile16, CoverageSetup_Clicked));
                //ContextMenuItems.Add(new ExplorerMenuItem(_FS, null, FeatureSet_Clicked));
            }
            ContextMenuItems.Add(new ExplorerMenuItem(_AD, Resources.GenericWindowLightBlue16, Optional_Clicked));
            if (MyAppManager.Instance.AppMode == AppMode.VHF)
            {
                ContextMenuItems.Add(new ExplorerMenuItem(PEContextMenu.MenuSeparator, null, null));
                ContextMenuItems.Add(new ExplorerMenuItem(_RM, Resources.LayerRemove16, Remove_PackageClicked));
            }
        }
Пример #14
0
 public GHMElementItem(IPackage pck, Heiflow.Models.GHM.Item item)
 {
     Package      = pck as GHMPackage;
     GHMItem      = item;
     GHMItem.Grid = _ProjectService.Project.Model.Grid as MFGrid;
     if (_AppManager.AppMode == AppMode.VHF)
     {
         ContextMenuItems.Add(new ExplorerMenuItem("Load", Resources.AddContent16, LoadData_Clicked));
         ContextMenuItems.Add(new ExplorerMenuItem("View Values...", Resources.AttributesWindow16, ViewValues_Clicked)
         {
             Enabled = false
         });
         ContextMenuItems.Add(new ExplorerMenuItem("Gridded Values", null, ViewGridData_Clicked)
         {
             Enabled = false
         });
         ContextMenuItems.Add(new ExplorerMenuItem("Show on Map", Resources.LayerRasterOptimized16, ViewInMap_Clicked)
         {
             Enabled = false
         });
     }
     else if (_AppManager.AppMode == AppMode.HE)
     {
         ContextMenuItems.Add(new ExplorerMenuItem("Load", Resources.AddContent16, LoadData_Clicked));
         ContextMenuItems.Add(new ExplorerMenuItem("Symbology", null, Symbol_Clicked));
         ContextMenuItems.Add(new ExplorerMenuItem("View Values...", Resources.AttributesWindow16, ViewGridData_Clicked)
         {
             Enabled = false
         });
         ContextMenuItems.Add(new ExplorerMenuItem("View in 3D", Resources._3dplot16, ViewInGraphy_Clicked)
         {
             Enabled = false
         });
         ContextMenuItems.Add(new ExplorerMenuItem("Animate", Resources.AnimationVideo16, Animation3D_Clicked)
         {
             Enabled = false
         });
         ContextMenuItems.Add(new ExplorerMenuItem("Export...", null, Export_Clicked)
         {
             Enabled = false
         });
     }
 }
        public FolderExplorerViewModel(IMessageBus messageBus, IMessageBoxManager messageBoxManager)
        {
            _messageBus        = messageBus;
            _messageBoxManager = messageBoxManager;

            Title = Resources.FolderExplorerTitle;

            Root       = new ComputerViewModel();
            RootSource = new ReadOnlyCollection <TreeNodeBase>(new[] { Root });

            ReloadCommand      = new Command(() => ReloadFolders());
            CollapseAllCommand = new Command(() => Root.CollapseAll());

            NewDirectoryCommand = new Command(() => NewNode(isDirectory: true),
                                              () => SelectedDirectory != null && CurrentInsertNode == null && CurrentRenameNode == null);
            NewFileCommand = new Command(() => NewNode(isDirectory: false),
                                         () => SelectedDirectory != null && CurrentInsertNode == null && CurrentRenameNode == null);

            ConfirmNewNodeCommand = new Command(() => ConfirmNewNode(), () => CurrentInsertNode != null);
            CancelNewNodeCommand  = new Command(() => CancelNewNode(), () => CurrentInsertNode != null);

            RenameNodeCommand = new Command(() => RenameNode(),
                                            () => SelectedDirectory != null && CurrentInsertNode == null && CurrentRenameNode == null);

            ConfirmRenameNodeCommand = new Command(() => ConfirmRenameNode(), () => CurrentRenameNode != null);
            CancelRenameNodeCommand  = new Command(() => CancelRenameNode(), () => CurrentRenameNode != null);

            DeleteNodeCommand = new Command(() => DeleteNode(), () => SelectedNode != null);

            ContextMenuItems.Add(new MenuItemViewModel()
            {
                Name    = Resources.FolderExplorerRename,
                Command = RenameNodeCommand,
            });

            ContextMenuItems.Add(new MenuItemViewModel()
            {
                Name    = Resources.FolderExplorerDelete,
                Command = DeleteNodeCommand,
            });

            ReloadFolders();
        }
Пример #16
0
        private void CreateContextMenuActions()
        {
            if (AssetTool.IsSupportedTextureFileFormat(_file.Extension))
            {
                var command = _createTextureAssetCommandFactory.Create(_file);
                ContextMenuItems.Add(new ContextMenuItem("Create texture asset", command));
            }

            if (AssetTool.CanCreateSpriteAssetFromFile(_file.Path))
            {
                var command = _createSpriteAssetCommandFactory.Create(_file);
                ContextMenuItems.Add(new ContextMenuItem("Create sprite asset", command));
            }

            if (AssetTool.IsSupportedSoundFileFormat(_file.Extension))
            {
                var command = _createSoundAssetCommandFactory.Create(_file);
                ContextMenuItems.Add(new ContextMenuItem("Create sound asset", command));
            }
        }
Пример #17
0
        public MenuButtonControl()
        {
            InitializeComponent();

            //ContextMenuItems.Add(new ContextMenuItemContent { Index = (int)InstallType.eSkip,
            //                                                  Label = "Skip",
            //                                                  IconPath = "Resources/Skip.png",
            //                                                  IconPathDisabled = "Resources/Disabled/Skip.png" });
            //ContextMenuItems.Add(new ContextMenuItemContent { Index = (int)InstallType.eInstall,
            //                                                  Label = "Install",
            //                                                  IconPath = "Resources/Install.png",
            //                                                  IconPathDisabled = "Resources/Disabled/Install.png" });
            //ContextMenuItems.Add(new ContextMenuItemContent { Index = (int)InstallType.eUpdate,
            //                                                  Label = "Update",
            //                                                  IconPath = "Resources/Update.png",
            //                                                  IconPathDisabled = "Resources/Disabled/Update.png" });
            ////ContextMenuItems.Add(new ContextMenuItemContent { Index = (int)InstallType.eInstallLayout,
            ////                                                  Label = "Install Layout",
            ////                                                  IconPath = "Resources/InstallLayout.png",
            ////                                                  IconPathDisabled = "Resources/Disabled/InstallLayout.png" });
            //ContextMenuItems.Add(new ContextMenuItemContent { Index = (int)InstallType.eUninstall,
            //                                                  Label = "Uninstall",
            //                                                  IconPath = "Resources/Uninstall.png",
            //                                                  IconPathDisabled = "Resources/Disabled/Uninstall.png" });
            //ContextMenuItems.Add(new ContextMenuItemContent { Index = (int)InstallType.eMigrate,
            //                                                  Label = "Migrate",
            //                                                  IconPath = "Resources/Migrate.png",
            //                                                  IconPathDisabled = "Resources/Disabled/Migrate.png" });
            //ContextMenuItems.Add(new ContextMenuItemContent { Index = (int)InstallType.eIndeterminate,
            //                                                  Label = "Indeterminate",
            //                                                  IconPath = "Resources/Indefinite.png",
            //                                                  IconPathDisabled = "Resources/Disabled/Indefinite.png" });
            ContextMenuItems.Add(new ContextMenuItemContent((int)InstallType.eSkip, "Skip", "Resources/Skip.png", "Resources/Disabled/Skip.png"));
            ContextMenuItems.Add(new ContextMenuItemContent((int)InstallType.eInstall, "Install", "Resources/Install.png", "Resources/Disabled/Install.png"));
            ContextMenuItems.Add(new ContextMenuItemContent((int)InstallType.eUpdate, "Update", "Resources/Update.png", "Resources/Disabled/Update.png"));
            //ContextMenuItems.Add(new ContextMenuItemContent((int)InstallType.eInstallLayout, "Install Layout", "Resources/InstallLayout.png", "Resources/Disabled/InstallLayout.png"));
            ContextMenuItems.Add(new ContextMenuItemContent((int)InstallType.eUninstall, "Uninstall", "Resources/Uninstall.png", "Resources/Disabled/Uninstall.png"));
            ContextMenuItems.Add(new ContextMenuItemContent((int)InstallType.eMigrate, "Migrate", "Resources/Migrate.png", "Resources/Disabled/Migrate.png"));
            ContextMenuItems.Add(new ContextMenuItemContent((int)InstallType.eIndeterminate, "Indeterminate", "Resources/Indefinite.png", "Resources/Disabled/Indefinite.png"));
        }
Пример #18
0
        private void BindingContextMenuItems()
        {
            _menuItems = new ContextMenuItems
            {
                new ContextMenuItem
                {
                    Command=OpenCommand,
                    Title="Open",
                    StatusColor=Brushes.Orange,
                    ImagePath = Geometry.Parse("M5.388822,5.0339882L22.943006,5.0339882 18.721215,15.256989 1.6100047,15.256989z M0,0L6.6660105,0 8.0000125,2.9348083 18.70703,2.9348083 18.70403,3.8337495 4.5530072,3.8337495 0.33200061,15.257004 0,15.257004z"),
                },

                 new ContextMenuItem
                 {
                    Command = SaveCommand,
                    Parameter = "Device",
                    Title="Save",
                    StatusColor=Brushes.DodgerBlue,
                    ImagePath = Geometry.Parse("M8.1099597,36.94997L8.1099597,41.793968 39.213959,41.793968 39.213959,36.94997z M12.42,0.049999889L18.4,0.049999889 18.4,12.252 12.42,12.252z M0,0L7.9001866,0 7.9001866,14.64218 39.210766,14.64218 39.210766,0 47.401001,0 47.401001,47.917 0,47.917z"),
                },

                new ContextMenuItem
                {
                    Command=SettingsCommand(),
                    Title="Settings",
                    StatusColor=Brushes.Silver,
                    ImagePath = Geometry.Parse("M383.518,230.427C299.063,230.427 230.355,299.099 230.355,383.554 230.355,468.009 299.063,536.644 383.518,536.644 467.937,536.644 536.645,468.009 536.645,383.554 536.645,299.099 467.937,230.427 383.518,230.427z M340.229,0L426.771,0C436.838,0,445.035,8.19732,445.035,18.2643L445.035,115.303C475.165,122.17,503.532,133.928,529.634,150.43L598.306,81.6869C601.721,78.3074 606.359,76.3653 611.213,76.3653 616.031,76.3653 620.704,78.3074 624.12,81.6869L685.278,142.916C692.397,150.035,692.397,161.648,685.278,168.767L616.677,237.402C633.108,263.54,644.866,291.907,651.733,322.001L748.736,322.001C758.803,322.001,767,330.198,767,340.265L767,426.806C767,436.873,758.803,445.07,748.736,445.07L651.769,445.07C644.901,475.235,633.108,503.531,616.677,529.669L685.278,598.305C688.694,601.72 690.635,606.358 690.635,611.212 690.635,616.102 688.694,620.705 685.278,624.12L624.085,685.313C620.525,688.872 615.851,690.67 611.177,690.67 606.503,690.67 601.865,688.872 598.269,685.313L529.67,616.678C503.567,633.109,475.2,644.937,445.035,651.804L445.035,748.771C445.035,758.838,436.838,767,426.771,767L340.229,767C330.162,767,321.965,758.838,321.965,748.771L321.965,651.804C291.8,644.937,263.433,633.109,237.366,616.678L168.731,685.313C165.315,688.693 160.677,690.67 155.823,690.67 151.005,690.67 146.296,688.693 142.916,685.313L81.7221,624.12C74.6033,617.036,74.6033,605.424,81.7221,598.305L150.323,529.669C133.892,503.603,122.099,475.235,115.267,445.07L18.2643,445.07C8.19734,445.07,0,436.873,0,426.806L0,340.265C0,330.198,8.19734,322.001,18.2643,322.001L115.267,322.001C122.135,291.907,133.892,263.54,150.323,237.402L81.7221,168.767C78.3064,165.351 76.3655,160.713 76.3655,155.859 76.3655,150.97 78.3064,146.332 81.7221,142.916L142.916,81.7582C146.476,78.1988 151.149,76.4016 155.823,76.4016 160.497,76.4016 165.171,78.1988 168.731,81.7582L237.366,150.43C263.469,133.928,291.837,122.17,321.965,115.303L321.965,18.2643C321.965,8.19732,330.162,0,340.229,0z"),
                },

            };

            powerItem = new ContextMenuItem
            {
                Command = ConnectCommand(),
                Title = "Connect",
                StatusColor = Brushes.Silver,
                ImagePath =
                    Geometry.Parse(
                        "M14.800615,5.6499605L14.800615,14.800346C10.630442,17.910477 7.8903284,22.840685 7.8903284,28.44092 7.9003286,37.871319 15.530646,45.511639 24.961039,45.521641 34.391431,45.511639 42.011749,37.871319 42.04175,28.44092 42.03175,22.840685 39.291636,17.910477 35.121462,14.800346L35.121462,5.6599612C43.841825,9.5601254,49.912077,18.280493,49.912077,28.44092L49.922077,28.44092C49.912077,42.231503 38.741611,53.391972 24.961039,53.391972 11.170465,53.391972 0,42.231503 0,28.44092 0,18.270493 6.0902529,9.5501251 14.800615,5.6499605z M19.570043,0L30.237043,0 30.237043,33.917 19.570043,33.917z"),
            };

            _menuItems.Add(powerItem);
        }
 public override void AddMenuItems()
 {
     ContextMenuItems.Add(new ExplorerMenuItem("New Coverage...", Resources.MapPackageTiledTPKFile16, NewCoverage_Clicked));
     ContextMenuItems.Add(new ExplorerMenuItem("Expand All", null, ExpandAll_Clicked));
     ContextMenuItems.Add(new ExplorerMenuItem("Collapse All", null, CollapseAll_Clicked));
 }
        public WorkOrderViewModel(IWorkOrderService CurrentService,
                                  BackendDBContext context, IMapper Mapper,
                                  TranscationResultHelper transcationResultHelper,
                                  IFlowMasterService flowMasterService,
                                  UserHelper currentUserHelper, CurrentUser currentUser,
                                  ICategoryMainService categoryMainService, ICategorySubService categorySubService)
        {
            this.CurrentService = CurrentService;
            this.context        = context;
            mapper = Mapper;
            TranscationResultHelper = transcationResultHelper;
            FlowMasterService       = flowMasterService;
            CurrentUserHelper       = currentUserHelper;
            CurrentUser             = currentUser;
            CategoryMainService     = categoryMainService;
            CategorySubService      = categorySubService;
            WorkOrderSort.Initialization(SortConditions);
            WorkOrderStatusCondition.Initialization(WorkOrderStatusConditions);
            CurrentWorkOrderStatusCondition.Id    = WorkOrderStatusConditions[0].Id;
            CurrentWorkOrderStatusCondition.Title = WorkOrderStatusConditions[0].Title;
            FilterWorkOrderStatusCondition        = CurrentWorkOrderStatusCondition.Id;
            WorkOrderStatusCondition.Initialization(WorkOrderStatusRecordConditions);
            WorkOrderStatusRecordConditions.RemoveAt(0);

            #region 工具列按鈕初始化
            Toolbaritems.Add(new ItemModel()
            {
                Id          = ButtonIdHelper.ButtonIdAdd,
                Text        = "新增",
                TooltipText = "新增",
                Type        = ItemType.Button,
                PrefixIcon  = "mdi mdi-plus-thick",
                Align       = ItemAlign.Left,
            });
            Toolbaritems.Add(new ItemModel()
            {
                Id          = ButtonIdHelper.ButtonIdRefresh,
                Text        = "重新整理",
                TooltipText = "重新整理",
                PrefixIcon  = "mdi mdi-refresh",
                Align       = ItemAlign.Left,
            });
            Toolbaritems.Add("Search");
            #endregion

            #region 互動式彈出功能表 ContextMenu 初始化
            ContextMenuItems.Add(new ContextMenuItemModel
            {
                Text    = "送審",
                Target  = ".e-content",
                Id      = "送審",
                IconCss = "mdi mdi-send-circle",
            });
            ContextMenuItems.Add(new ContextMenuItemModel
            {
                Text    = "查看送審記錄",
                Target  = ".e-content",
                Id      = "查看送審記錄",
                IconCss = "mdi mdi-file-find",
            });
            #endregion
        }
Пример #21
0
        void OnContextMenuStripOpening(object sender, CancelEventArgs e)
        {
            if (ContextMenuItems.Count > 0)
            {
                return;
            }

            if (!string.IsNullOrEmpty(ValueForDisplay) || clipboardCopyOverride != null)
            {
                ContextMenuItems.Add(
                    new ToolStripMenuItem(
                        "&Copy",
                        null,
                        new[]
                {
                    new ToolStripMenuItem("Copy &Name", null, CopyNameToClipboard),
                    new ToolStripMenuItem("Copy &Value", null, CopyValueToClipboard),
                    new ToolStripMenuItem("Copy Name &and Value", null, CopyNameAndValueToClipboard)
                }));
            }
            else
            {
                ContextMenuItems.Add(
                    new ToolStripMenuItem(
                        "&Copy",
                        null,
                        new[]
                {
                    new ToolStripMenuItem("Copy &Name", null, CopyNameToClipboard),
                }));
            }

            if (value != null)
            {
                var objectType = value.GetType();

                if ((objectType.IsValueType || objectType == typeof(SteamID)) && !objectType.IsEnum && objectType != typeof(bool))
                {
                    ContextMenuItems.Add(new ToolStripSeparator());

                    ContextMenuItems.Add(new ToolStripMenuItem("Display &Raw Value", null, (s, _) =>
                    {
                        Initialize();
                    })
                    {
                        Checked = true
                    }
                                         .AsRadioCheck());

                    if (objectType != typeof(SteamID))
                    {
                        // only allow displaying as an enum value if we're not a steamid

                        var enumTypesByNamespace = typeof(CMClient).Assembly.ExportedTypes
                                                   .Where(x => x.IsEnum)
                                                   .GroupBy(x => x.Namespace)
                                                   .OrderBy(x => x.Key)
                                                   .ToArray();

                        if (enumTypesByNamespace.Length > 0)
                        {
                            var enumMenuItem = new ToolStripMenuItem("Display as &Enum Value");

                            foreach (var enumTypes in enumTypesByNamespace)
                            {
                                var enumNamespaceMenuItem = new ToolStripMenuItem(enumTypes.Key);
                                enumMenuItem.DropDownItems.Add(enumNamespaceMenuItem);

                                var menuItems = new List <ToolStripMenuItem>();

                                foreach (var enumType in enumTypes)
                                {
                                    var enumName = enumType.FullName.Substring(enumType.Namespace.Length + 1);
                                    var item     = new ToolStripMenuItem(enumName, null, (s, _) =>
                                    {
                                        DisplayAsEnumMember(enumType);
                                    }).AsRadioCheck();
                                    menuItems.Add(item);
                                }

                                menuItems.Sort(ToolStripMenuItemComparisonByText);
                                enumNamespaceMenuItem.DropDownItems.AddRange(menuItems.ToArray());
                            }
                            ContextMenuItems.Add(enumMenuItem);
                        }
                    }

                    if (objectType == typeof(long) || objectType == typeof(ulong) || objectType == typeof(SteamID))
                    {
                        ContextMenuItems.Add(
                            new ToolStripMenuItem(
                                "SteamID",
                                null,
                                new[]
                        {
                            new ToolStripMenuItem("Steam2", null, DisplayAsSteam2ID).AsRadioCheck(),
                            new ToolStripMenuItem("Steam3", null, DisplayAsSteam3ID).AsRadioCheck(),
                        }));
                    }

                    if (objectType == typeof(long) || objectType == typeof(ulong) || objectType == typeof(int) || objectType == typeof(uint))
                    {
                        ContextMenuItems.Add(new ToolStripMenuItem("GlobalID (GID)", null, DisplayAsGlobalID).AsRadioCheck());
                        ContextMenuItems.Add(new ToolStripMenuItem("Date/Time", null, DisplayAsPosixTimestamp).AsRadioCheck());
                    }

                    if (objectType == typeof(int) || objectType == typeof(uint))
                    {
                        ContextMenuItems.Add(new ToolStripMenuItem("IPv4 Address", null, DisplayAsIPAddress).AsRadioCheck());
                    }
                }

                if (objectType == typeof(byte[]))
                {
                    ContextMenuItems.Add(new ToolStripMenuItem("&Save to file...", null, SaveDataToFile));

                    var data = (byte[])value;
                    if (data.Length > 0 && data.Length <= MaxDataLengthForDisplay)
                    {
                        ContextMenuItems.Add(new ToolStripMenuItem("&ASCII", null, DisplayDataAsAscii).AsRadioCheck());
                        ContextMenuItems.Add(new ToolStripMenuItem("&UTF-8", null, DisplayDataAsUTF8).AsRadioCheck());
                        ContextMenuItems.Add(new ToolStripMenuItem("&Hexadecimal", null, DisplayDataAsHexadecimal)
                        {
                            Checked = true
                        }.AsRadioCheck());
                        ContextMenuItems.Add(new ToolStripMenuItem("&Binary KeyValues (VDF)", null, DisplayDataAsBinaryKeyValues).AsRadioCheck());
                        ContextMenuItems.Add(new ToolStripMenuItem("&Protobuf", null, DisplayDataAsProtobuf).AsRadioCheck());
                    }
                }
            }

            e.Cancel = false;
        }
Пример #22
0
 public override void AddMenuItems()
 {
     ContextMenuItems.Add(new ExplorerMenuItem("Coverage Setup...", Resources.MapPackageTiledTPKFile16, CoverageSetup_Clicked));
     //  ContextMenuItems.Add(new ExplorerMenuItem("Attribute Table...", Resources.AttributesWindow16, AttributeTable_Clicked));
     ContextMenuItems.Add(new ExplorerMenuItem("Remove", null, Remove_Clicked));
 }
Пример #23
0
        private void MapRightClick(PointF point)
        {
            map.SelectedObject = map.FindObject(point);
            map.Invalidate();

            ContextMenuItems.Clear();

            ContextMenuItems.Add(new MenuItemVM()
            {
                Header           = "Info",
                Command          = MapDoubleClickCommand,
                CommandParameter = point,
                IsEnabled        = map.SelectedObject != null
            });

            ContextMenuItems.Add(null);

            ContextMenuItems.Add(new MenuItemVM()
            {
                Header           = "Center",
                Command          = CenterOnPointCommand,
                CommandParameter = point
            });
            ContextMenuItems.Add(new MenuItemVM()
            {
                Header  = "Search object...",
                Command = SearchObjectCommand
            });
            ContextMenuItems.Add(new MenuItemVM()
            {
                Header = "Go to point..."
            });

            ContextMenuItems.Add(null);

            ContextMenuItems.Add(new MenuItemVM()
            {
                Header           = "Ephemerides",
                IsEnabled        = map.SelectedObject != null && sky.GetEphemerisCategories(map.SelectedObject).Any(),
                Command          = GetObjectEphemerisCommand,
                CommandParameter = map.SelectedObject
            });

            // dynamic menu items from plugins
            foreach (var configItem in contextMenuItemsConfig)
            {
                ContextMenuItems.Add(new MenuItemVM()
                {
                    Header      = configItem.Text,
                    IsEnabled   = configItem.EnabledCondition(),
                    IsCheckable = configItem.CheckedCondition != null,
                    IsChecked   = configItem.CheckedCondition != null ? configItem.CheckedCondition() : false,
                    Command     = new Command(configItem.Action)
                });
            }

            ContextMenuItems.Add(null);

            ContextMenuItems.Add(new MenuItemVM()
            {
                Header           = map.LockedObject != null ? (map.SelectedObject != null && map.SelectedObject != map.LockedObject ? "Lock" : "Unlock") : "Lock",
                IsEnabled        = map.LockedObject != null || map.SelectedObject != null,
                Command          = LockOnObjectCommand,
                CommandParameter = map.SelectedObject
            });

            NotifyPropertyChanged(nameof(ContextMenuItems));
        }
Пример #24
0
 public void AddItem(Texture2D icon, string iconText, ClickDelegate clickEvent)
 {
     ContextMenuItems.Add(new ContextMenuItem(icon, iconText, clickEvent));
 }