Esempio n. 1
0
 public static void Callback(PlayModeStateChange state)
 {
     if (state == PlayModeStateChange.EnteredEditMode)
     {
         MyMenuItem.CodeGen();
     }
 }
Esempio n. 2
0
        public IEnumerable <CreatedMenuItem> Create(IMenuItemContext context)
        {
            const int MAX_TABS = 10;
            int       index    = 0;

            foreach (var tab in documentTabService.SortedTabs)
            {
                var header = GetHeader(index + 1, tab);
                var attr   = new ExportMenuItemAttribute {
                    Header = header
                };
                var tabTmp = tab;
                var item   = new MyMenuItem(ctx => documentTabService.ActiveTab = tabTmp, index == 0);

                yield return(new CreatedMenuItem(attr, item));

                if (++index >= MAX_TABS)
                {
                    break;
                }
            }

            var attr2 = new ExportMenuItemAttribute {
                Header = dnSpy_Resources.WindowsCommand
            };
            var item2 = new MyMenuItem(ctx => ShowTabsDlg(), false);

            yield return(new CreatedMenuItem(attr2, item2));
        }
Esempio n. 3
0
        public void MenuItemOnKey()
        {
            tlog.Debug(tag, $"MenuItemOnKey START");

            var testingTarget = new MyMenuItem();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <MenuItem>(testingTarget, "Should return MenuItem instance.");

            testingTarget.IsEnabled  = true;
            testingTarget.IsSelected = true;

            Key key    = null;
            var result = testingTarget.OnKey(key);

            Assert.AreEqual(false, result, "should be equal here!");

            key = new Key()
            {
                State          = Key.StateType.Up,
                KeyPressedName = "Return"
            };
            result = testingTarget.OnKey(key);
            tlog.Debug(tag, "OnKey : " + result);

            tlog.Debug(tag, $"MenuItemOnKey END (OK)");
        }
Esempio n. 4
0
        private void ms_function_click(object sender, EventArgs e)
        {
            MyMenuItem item = sender as MyMenuItem;

            ModulInterface modul = this.modules[item.moduleId];

            FunctionInterface function = modul.getFunctions()[item.functionId];

            UIBuilderInterface builder = new UIBuilder();

            function.buildUI(builder);

            EingabeManager em = new EingabeManager();

            UserDataInterface data = em.getUserData(builder);

            if (data == null)
            {
                return;
            }

            try
            {
                lb_Ergebnis.Items.Add(function.calculate(data));
            } catch (Exception err)
            {
                lb_Ergebnis.Items.Add(err.Message + err.StackTrace);
                Console.Write(err.StackTrace);
            }
        }
Esempio n. 5
0
        private void rechnermodul_Load(object sender, EventArgs e)
        {
            Console.Write(APP_PATH + "\n");

            this.modules = this.loadModules(this.getModulPaths());

            for (int mId = 0; mId < this.modules.Length; mId++)
            {
                RechnermodulBibliothek.ModulInterface modul = this.modules[mId];
                ToolStripMenuItem item = new ToolStripMenuItem();
                item.Text = modul.getFriendlyName();

                ms_module.Items.Add(item);

                FunctionDescriptionInterface[] functions = modul.getFunctionDescriptions();
                for (int fId = 0; fId < functions.Length; fId++)
                {
                    FunctionDescriptionInterface fd = functions[fId];
                    MyMenuItem sub_item             = new MyMenuItem();
                    sub_item.Text       = fd.getName();
                    sub_item.functionId = fId;
                    sub_item.moduleId   = mId;
                    sub_item.Click     += new EventHandler(ms_function_click);
                    item.DropDownItems.Add(sub_item);
                }
            }
        }
Esempio n. 6
0
        //public void SetReadonly(UIControlPackageForSimpleColumn controlPackage, ColumnDTO column, bool readonlity)
        //{
        //    //////controlPackage.BaseControlHelper.SetReadonly(controlPackage, readonlity);
        //}

        //public void SetMultipleDataPackageReadonly(UIControlPackageMultipleData controlPackage, bool isReadOnly)
        //{
        //    DataGridHelper.SetReadonly(controlPackage, isReadOnly);
        //}


        //public void DisableEnableMultiple(I_View_MultipleDataContainer container, DP_DataRepository dataItem, bool enable)
        //{
        //    DataGridHelper.DisableEnableRow((container as View_MultipleDataContainer).dataGridHelper, dataItem, enable);
        //}

        //public void DisableEnableMultipleColumn(DP_DataRepository dataItem, SimpleColumnControlMultipleData column, bool enable)
        //{
        //    DataGridHelper.DisableEnableCell(dataItem, column.ControlPackage, column.Column, enable);
        //}

        //public void SetReadonlyMultiple(I_View_MultipleDataContainer container, DP_DataRepository dataItem, bool readonlity)
        //{

        //    DataGridHelper.SetReadonlyRow((container as View_MultipleDataContainer).dataGridHelper, dataItem, readonlity);
        //}

        //public void SetReadonlyMultipleColumn(DP_DataRepository dataItem, SimpleColumnControlMultipleData column, bool readonlity)
        //{
        //    DataGridHelper.SetReadonlyCell(dataItem, column.ControlPackage, column.Column, readonlity);
        //}

        //public void ShowTestReport(string reportEngine, object reportSource)
        //{
        //    frmReportViewer aa = new frmReportViewer(reportEngine, reportSource as ReportSource);
        //    aa.ShowDialog();
        //}

        public MyMenuItem GetMenuItem(object parentMenu, string header, string name, string tooltip)
        {
            MyMenuItem myMenuItem = new MyMenuItem();

            myMenuItem.Name = name;
            RadMenuItem menuITem = new RadMenuItem();

            menuITem.DataContext = myMenuItem;
            menuITem.Header      = header;
            if (!string.IsNullOrEmpty(tooltip))
            {
                ToolTipService.SetToolTip(menuITem, tooltip);
            }
            ItemCollection itemCollection = null;

            if (parentMenu is RadContextMenu)
            {
                itemCollection = (parentMenu as RadContextMenu).Items;
            }
            else if (parentMenu is RadMenuItem)
            {
                itemCollection = (parentMenu as RadMenuItem).Items;
            }
            itemCollection.Add(menuITem);
            menuITem.Click     += (sender, e) => MenuITem_Click(sender, e, myMenuItem);
            myMenuItem.MenuItem = menuITem;

            return(myMenuItem);
        }
Esempio n. 7
0
        public ToolStripItem[] BuildSubmenu(Codon codon, object owner)
        {
            int contentCount = WorkbenchSingleton.Workbench.ViewContentCollection.Count;

            if (contentCount == 0)
            {
                return(new ToolStripItem[] {});
            }
            ToolStripItem[] items = new ToolStripItem[contentCount + 1];
            items[0] = new MenuSeparator(null, null);
            for (int i = 0; i < contentCount; ++i)
            {
                IViewContent content = (IViewContent)WorkbenchSingleton.Workbench.ViewContentCollection[i];
                if (content.WorkbenchWindow == null)
                {
                    continue;
                }
                MenuCheckBox item = new MyMenuItem(content);
                item.Tag         = content.WorkbenchWindow;
                item.Checked     = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == content.WorkbenchWindow;
                item.Description = "Activate this window ";
                items[i + 1]     = item;
            }
            return(items);
        }
Esempio n. 8
0
		public IEnumerable<CreatedMenuItem> Create(IMenuItemContext context) {
			foreach (var theme in themeService.VisibleThemes) {
				var attr = new ExportMenuItemAttribute { Header = theme.GetMenuName() };
				var tmp = theme;
				var item = new MyMenuItem(ctx => themeService.Theme = tmp, theme == themeService.Theme);
				yield return new CreatedMenuItem(attr, item);
			}
		}
Esempio n. 9
0
 public IEnumerable<CreatedMenuItem> Create(IMenuItemContext context)
 {
     foreach (var theme in themeManager.AllThemesSorted) {
         if (!themeManager.Settings.ShowAllThemes && !themeManager.IsHighContrast && theme.IsHighContrast)
             continue;
         var attr = new ExportMenuItemAttribute { Header = GetThemeHeaderName(theme) };
         var tmp = theme;
         var item = new MyMenuItem(ctx => themeManager.Theme = tmp, theme == themeManager.Theme);
         yield return new CreatedMenuItem(attr, item);
     }
 }
Esempio n. 10
0
 public IEnumerable <CreatedMenuItem> Create(IMenuItemContext context)
 {
     foreach (var theme in themeService.VisibleThemes)
     {
         var attr = new ExportMenuItemAttribute {
             Header = theme.GetMenuName()
         };
         var tmp  = theme;
         var item = new MyMenuItem(ctx => themeService.Theme = tmp, theme == themeService.Theme);
         yield return(new CreatedMenuItem(attr, item));
     }
 }
Esempio n. 11
0
 private void GetSelected(object sender, out MyMenuItem SelectedItem, out AccountingMoeinStructureDefine ChangableItem, out AccountingMoeinStructureDefine Child)
 {
     if (trvMenu.SelectedItem == null)
     {
         SelectedItem  = null;
         ChangableItem = null;
         Child         = null;
         return;
     }
     SelectedItem  = trvMenu.SelectedItem as MyMenuItem;
     ChangableItem = Business.GetMoeinStructureDefineBusiness().GetByID(SelectedItem.ID).FirstOrDefault();
     Child         = Business.GetMoeinStructureDefineBusiness().GetByParentID(ChangableItem.ID).FirstOrDefault();
 }
Esempio n. 12
0
        private async void Menu_SelectedMenu(object sender, MyMenuItem e)
        {
            var list = sender as Syncfusion.ListView.XForms.SfListView;


            if (IsPresented)
            {
                IsPresented = !IsPresented;
            }
            if (e.TypePage != TypePage.Action)
            {
                var page = new NavigationPage(Activator.CreateInstance(e.Type) as Page);
                Detail = page;
            }
        }
Esempio n. 13
0
 public IEnumerable <CreatedMenuItem> Create(IMenuItemContext context)
 {
     foreach (var theme in themeManager.AllThemesSorted)
     {
         if (!themeManager.Settings.ShowAllThemes && !themeManager.IsHighContrast && theme.IsHighContrast)
         {
             continue;
         }
         var attr = new ExportMenuItemAttribute {
             Header = GetThemeHeaderName(theme)
         };
         var tmp  = theme;
         var item = new MyMenuItem(ctx => themeManager.Theme = tmp, theme == themeManager.Theme);
         yield return(new CreatedMenuItem(attr, item));
     }
 }
Esempio n. 14
0
        public ToolStripItem[] BuildSubmenu(Codon codon, object owner)
        {
            int windowCount = WorkbenchSingleton.Workbench.WorkbenchWindowCollection.Count;

            if (windowCount == 0)
            {
                return(new ToolStripItem[] { });
            }
            ToolStripItem[] items = new ToolStripItem[windowCount + 1];
            items[0] = new MenuSeparator(null, null);
            for (int i = 0; i < windowCount; ++i)
            {
                IWorkbenchWindow window = WorkbenchSingleton.Workbench.WorkbenchWindowCollection[i];
                MenuCheckBox     item   = new MyMenuItem(window);
                item.Tag         = window;
                item.Checked     = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == window;
                item.Description = "Activate this window";
                items[i + 1]     = item;
            }
            return(items);
        }
Esempio n. 15
0
        public void MenuItemOnUpdate()
        {
            tlog.Debug(tag, $"MenuItemOnUpdate START");

            var testingTarget = new MyMenuItem();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <MenuItem>(testingTarget, "Should return MenuItem instance.");

            try
            {
                testingTarget.MyOnUpdate();
            }
            catch (Exception e)
            {
                tlog.Debug(tag, e.Message.ToString());
                Assert.Fail("Caught Exception : Failed!");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"MenuItemOnUpdate END (OK)");
        }
Esempio n. 16
0
        private IEnumerable <MyMenuItem> BuildMenu(MembershipUser u)
        {
            if (u != null && u is Person)
            {
                Person            p     = (Person)u;
                List <MyMenuItem> list  = new List <MyMenuItem>();
                MyMenuItem        menu1 = new MyMenuItem("Liste des personnes", "Index", "Person");
                MyMenuItem        menu2 = new MyMenuItem("Liste des machines", "Index", "Machine");
                MyMenuItem        menu3 = new MyMenuItem("Liste des cours", "Index", "Course");
                MyMenuItem        menu4 = new MyMenuItem("Liste des salles", "Index", "Room");
                MyMenuItem        menu5 = new MyMenuItem("Liste de mes cours", "ListMyCourse", "Course");
                switch (p.pType)
                {
                case PersonType.ResourceManager:
                    list.Add(menu1);
                    list.Add(menu2);
                    list.Add(menu3);
                    list.Add(menu4);
                    break;

                case PersonType.Responsible:
                    list.Add(menu2);
                    list.Add(menu3);
                    break;

                case PersonType.User:
                    list.Add(menu3);
                    list.Add(menu5);
                    break;
                }

                return(list);
            }
            else
            {
                //build default menu, i.e an empty menu
                return(new List <MyMenuItem>());
            }
        }
Esempio n. 17
0
        // Added by mav
        public virtual void ShowContextMenu(Point ptScreen)
        {
            System.Windows.Forms.ContextMenu cm = new System.Windows.Forms.ContextMenu();
            ArrayList al = new ArrayList();

            al.AddRange(_holders);
            al.Sort(new HolderSorter());

            MyMenuItem [] items = new MyMenuItem[al.Count];
            for (int i = 0; i < al.Count; i++)
            {
                ToolBarDockHolder holder = al[i] as ToolBarDockHolder;
                Control           c      = holder.Control;
                items[i]         = new MyMenuItem();
                items[i].Checked = c.Visible;
                items[i].Text    = holder.ToolbarTitle;
                items[i].Click  += new EventHandler(MenuClickEventHandler);
                items[i].Control = c;
                cm.MenuItems.Add(items[i]);
            }
            cm.Show(DockStation, DockStation.PointToClient(ptScreen));
        }
Esempio n. 18
0
        public void MenuItemHandleControlStateOnTouch()
        {
            tlog.Debug(tag, $"MenuItemHandleControlStateOnTouch START");

            var testingTarget = new MyMenuItem()
            {
                Text            = "MenuItem",
                Size            = new Size(100, 200),
                BackgroundColor = Color.Green,
                IsEnabled       = true,
            };

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <MenuItem>(testingTarget, "Should return MenuItem instance.");

            using (Touch touch = new Touch())
            {
                tlog.Debug(tag, "HandleControlStateOnTouch : " + testingTarget.MyHandleControlStateOnTouch(touch));
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"MenuItemHandleControlStateOnTouch END (OK)");
        }
 public ToolStripItem[] BuildSubmenu(Codon codon, object owner)
 {
     int count = WorkbenchSingleton.Workbench.ViewContentCollection.Count;
     if (count == 0)
     {
         return new ToolStripItem[0];
     }
     ToolStripItem[] itemArray = new ToolStripItem[count + 1];
     itemArray[0] = new MenuSeparator(null, null);
     for (int i = 0; i < count; i++)
     {
         IViewContent content = WorkbenchSingleton.Workbench.ViewContentCollection[i];
         if (content.WorkbenchWindow != null)
         {
             MenuCheckBox box = new MyMenuItem(content);
             box.Tag = content.WorkbenchWindow;
             box.Checked = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == content.WorkbenchWindow;
             box.Description = "Activate this window ";
             itemArray[i + 1] = box;
         }
     }
     return itemArray;
 }
Esempio n. 20
0
        private IEnumerable<MyMenuItem> BuildMenu(MembershipUser u)
        {
            if (u != null && u is Person)
            {
                Person p = (Person)u;
                List<MyMenuItem> list = new List<MyMenuItem>();
                MyMenuItem menu1 = new MyMenuItem("Liste des personnes", "Index", "Person");
                MyMenuItem menu2 = new MyMenuItem("Liste des machines", "Index", "Machine");
                MyMenuItem menu3 = new MyMenuItem("Liste des cours", "Index", "Course");
                MyMenuItem menu4 = new MyMenuItem("Liste des salles", "Index", "Room");
                MyMenuItem menu5 = new MyMenuItem("Liste de mes cours", "ListMyCourse", "Course");
                switch (p.pType)
                {
                    case PersonType.ResourceManager:
                        list.Add(menu1);
                        list.Add(menu2);
                        list.Add(menu3);
                        list.Add(menu4);
                        break;
                    case PersonType.Responsible:
                        list.Add(menu2);
                        list.Add(menu3);
                        break;
                    case PersonType.User:
                        list.Add(menu3);
                        list.Add(menu5);
                        break;
                }

                return list;
            }
            else
            {
                //build default menu, i.e an empty menu
                return new List<MyMenuItem>();
            }
        }
Esempio n. 21
0
        private void ms_function_click(object sender, EventArgs e)
        {
            MyMenuItem item = sender as MyMenuItem;

            ModulInterface modul = this.modules[item.moduleId];

            FunctionInterface function = modul.getFunctions()[item.functionId];

            UIBuilderInterface builder = new UIBuilder();

            function.buildUI(builder);

            var uem = new universelleseingabemodul();

            uem.buildUi(builder);
            uem.ShowDialog();

            try
            {
                lb_Ergebnis.Items.Add(function.calculate(uem.getData()));
            } catch (DatenNichtValideFehler)
            {
            }
        }
		public ToolStripItem[] BuildSubmenu(Codon codon, object owner)
		{
			int windowCount = WorkbenchSingleton.Workbench.WorkbenchWindowCollection.Count;
			if (windowCount == 0) {
				return new ToolStripItem[] {};
			}
			ToolStripItem[] items = new ToolStripItem[windowCount + 1];
			items[0] = new MenuSeparator(null, null);
			for (int i = 0; i < windowCount; ++i) {
				IWorkbenchWindow window = WorkbenchSingleton.Workbench.WorkbenchWindowCollection[i];
				MenuCheckBox item = new MyMenuItem(window);
				item.Tag = window;
				item.Checked = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == window;
				item.Description = "Activate this window";
				items[i + 1] = item;
			}
			return items;
		}
Esempio n. 23
0
        private void new_Click(object sender, RoutedEventArgs e)
        {
            MyMenuItem SelectedItem;
            AccountingTafsilStructureDefine ChangableItem;
            AccountingTafsilStructureDefine Child;
            Tarife_hesabe_tafsili           structure = new Tarife_hesabe_tafsili();

            GetSelected(sender, out SelectedItem, out ChangableItem, out Child);

            if (SelectedItem == null)
            {
                Tarife_hesabe_tafsili tafsil = new Tarife_hesabe_tafsili();
                tafsil.ShowDialog();
                if (tafsil.EntityPrimery != null)
                {
                    menuItems.Add(new MyMenuItem()
                    {
                        ID = tafsil.EntityPrimery.ID, Code = tafsil.EntityPrimery.Code, Name = tafsil.EntityPrimery.Name, Type = Constants.CodeTitle.TafsilGroup
                    });
                }
                if (tafsil.EntitySecondery != null)
                {
                    menuItems.Find(r => r.ID == tafsil.EntityPrimery.ID).
                    Items.Add(new MyMenuItem()
                    {
                        ID = tafsil.EntitySecondery.ID, Code = tafsil.EntitySecondery.Code, Name = tafsil.EntitySecondery.Name, Type = Constants.CodeTitle.AccountGroup
                    });
                }
                trvMenu.Items.Refresh();
                return;
            }

            if (ChangableItem.Type == SecondLevel)
            {
                var ChangableItemParent = Business.GetTafsilStructureDefineBusiness().GetParent(ChangableItem);
                setDisablePrimeryItem(structure);

                structure.txtPrimeryGroupCode.Text = ChangableItemParent.Code;
                structure.txtPrimeryGroupName.Text = ChangableItemParent.Name;
                structure.CallPrimeryLostFocus();
            }

            structure.ShowDialog();

            if (SelectedItem.Type == Constants.CodeTitle.TafsilGroup && structure.EntityPrimery != null)
            {
                SelectedItem = new MyMenuItem()
                {
                    Code = structure.EntityPrimery.Code, ID = structure.EntityPrimery.ID, Name = structure.EntityPrimery.Name, Type = Constants.CodeTitle.TafsilGroup
                };
                menuItems.Add(SelectedItem);
            }
            if (SelectedItem.Type == Constants.CodeTitle.TafsilGroup && structure.EntitySecondery != null)
            {
                AccountingTafsilStructureDefine ChangableItemParent = Business.GetTafsilStructureDefineBusiness().GetParent(structure.EntitySecondery);
                MyMenuItem item = menuItems.Find(r => r.ID == ChangableItemParent.ID);
                item.Items.Add(new MyMenuItem()
                {
                    Code = structure.EntitySecondery.Code, ID = structure.EntitySecondery.ID, Name = structure.EntitySecondery.Name, Type = Constants.CodeTitle.AccountGroup
                });
            }

            if (SelectedItem.Type == Common.Constants.CodeTitle.AccountGroup && structure.EntitySecondery != null)
            {
                AccountingTafsilStructureDefine ChangableItemParent = Business.GetTafsilStructureDefineBusiness().GetParent(ChangableItem);
                MyMenuItem item = menuItems.Find(r => r.ID == ChangableItemParent.ID);
                item.Items.Add(new MyMenuItem()
                {
                    Code = structure.EntitySecondery.Code, ID = structure.EntitySecondery.ID, Name = structure.EntitySecondery.Name, Type = Constants.CodeTitle.AccountGroup
                });
            }

            trvMenu.Items.Refresh();
        }
Esempio n. 24
0
		public ToolStripItem[] BuildSubmenu(Codon codon, object owner)
		{
			int contentCount = WorkbenchSingleton.Workbench.ViewContentCollection.Count;
			if (contentCount == 0) {
				return new ToolStripItem[] {};
			}
			ToolStripItem[] items = new ToolStripItem[contentCount + 1];
			items[0] = new MenuSeparator(null, null);
			for (int i = 0; i < contentCount; ++i) {
				IViewContent content = (IViewContent)WorkbenchSingleton.Workbench.ViewContentCollection[i];
				if (content.WorkbenchWindow == null) {
					continue;
				}
				MenuCheckBox item = new MyMenuItem(content);
				item.Tag = content.WorkbenchWindow;
				item.Checked = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == content.WorkbenchWindow;
				item.Description = "Activate this window ";
				items[i + 1] = item;
			}
			return items;
		}
Esempio n. 25
0
        private void new_Click(object sender, RoutedEventArgs e)
        {
            MyMenuItem SelectedItem;
            AccountingMoeinStructureDefine ChangableItem;
            AccountingMoeinStructureDefine Child;
            MoeinStructureDefineChild      structure = new MoeinStructureDefineChild();

            GetSelected(sender, out SelectedItem, out ChangableItem, out Child);

            if (SelectedItem == null)
            {
                MoeinStructureDefineChild moein = new MoeinStructureDefineChild();
                moein.ShowDialog();
                if (moein.EntityPrimery != null)
                {
                    menuItems.Add(new MyMenuItem()
                    {
                        ID = moein.EntityPrimery.ID, Code = moein.EntityPrimery.Code, Name = moein.EntityPrimery.Name, Type = moein.EntityPrimery.Type
                    });
                }
                if (moein.EntitySecondery != null)
                {
                    menuItems.Find(r => r.ID == moein.EntityPrimery.ID).
                    Items.Add(new MyMenuItem()
                    {
                        ID = moein.EntitySecondery.ID, Code = moein.EntitySecondery.Code, Name = moein.EntitySecondery.Name, Type = moein.EntitySecondery.Type
                    });
                }
                trvMenu.Items.Refresh();
                return;
            }

            if (ChangableItem.Type == SecondLevel)
            {
                var ChangableItemParent = Business.GetMoeinStructureDefineBusiness().GetParent(ChangableItem);
                setDisablePrimeryItem(structure);

                structure.txtPrimeryGroupCode.Text      = ChangableItemParent.Code;
                structure.txtPrimeryGroupName.Text      = ChangableItemParent.Name;
                structure.txtPrimeryGroupLatinName.Text = ChangableItemParent.Latin_Name;
                structure.CallPrimeryLostFocus();
            }

            structure.ShowDialog();

            if (SelectedItem.Type == Constants.CodeTitle.Goruh && structure.EntityPrimery != null)
            {
                SelectedItem = new MyMenuItem()
                {
                    Code = structure.EntityPrimery.Code, ID = structure.EntityPrimery.ID, Name = structure.EntityPrimery.Name, Type = Constants.CodeTitle.Goruh
                };
                menuItems.Add(SelectedItem);
            }
            if (SelectedItem.Type == Constants.CodeTitle.Goruh && structure.EntitySecondery != null)
            {
                AccountingMoeinStructureDefine ChangableItemParent = Business.GetMoeinStructureDefineBusiness().GetParent(structure.EntitySecondery);
                MyMenuItem item = menuItems.Find(r => r.ID == ChangableItemParent.ID);
                item.Items.Add(new MyMenuItem()
                {
                    Code = structure.EntitySecondery.Code, ID = structure.EntitySecondery.ID, Name = structure.EntitySecondery.Name, Type = Constants.CodeTitle.Kol
                });
            }

            if (SelectedItem.Type == Common.Constants.CodeTitle.Kol && structure.EntitySecondery != null)
            {
                AccountingMoeinStructureDefine ChangableItemParent = Business.GetMoeinStructureDefineBusiness().GetParent(ChangableItem);
                MyMenuItem item = menuItems.Find(r => r.ID == ChangableItemParent.ID);
                item.Items.Add(new MyMenuItem()
                {
                    Code = structure.EntitySecondery.Code, ID = structure.EntitySecondery.ID, Name = structure.EntitySecondery.Name, Type = Constants.CodeTitle.Kol
                });
            }

            trvMenu.Items.Refresh();
        }
        private void _mainForm_FormLoad(object sender, EventArgs e)
        {
            foreach (string file in Directory.GetFiles(_mainForm.ScriptsFolder, "*.cs"))
            {
                AddScript(file, true);
            }
            foreach (string directory in Directory.GetDirectories(_mainForm.ScriptsFolder))
            {
                AddScript(directory, true);
            }
            //load script status from json
            if (_mainForm.LeSettings.ScriptStatus != null)
            {
                foreach (string key in _mainForm.LeSettings.ScriptStatus.Keys)
                {
                    var tempScript = _sm.Scripts.FirstOrDefault(z => z.ScriptName == key);
                    tempScript.Enabled = _mainForm.LeSettings.ScriptStatus[key];
                }
            }
            else
            {
                _mainForm.LeSettings.ScriptStatus = new System.Collections.Generic.Dictionary <string, bool>();
                foreach (ExecutableScript scriptName in _sm.Scripts)
                {
                    _mainForm.LeSettings.ScriptStatus.Add(scriptName.ScriptName, true);
                }
            }
            foreach (var item in _sm.Scripts)
            {
                var a = new MenuItem[] { };

                var box    = new MyCheckBox();
                var button = new MyButton();
                button.Script = item;

                box.Tag     = item.ScriptName;
                box.Text    = item.ScriptName;
                box.Script  = item;
                box.Checked = item.Enabled;

                _mainForm.AddScriptControlsToPanel(box, button);

                var menuItem = new MenuItem(item.ScriptName);

                var myMenuEnable = new MyMenuItem();
                myMenuEnable.Text   = item.Enabled ? "Disable" : "Enable";
                myMenuEnable.Click += _mainForm_TrayScriptEnableClick;
                myMenuEnable.Script = item;

                var myMenuAction = new MyMenuItem();
                myMenuAction.Text   = "Action";
                myMenuAction.Click += _mainForm_TrayScriptActionClick;
                myMenuAction.Script = item;

                menuItem.MenuItems.Add(myMenuEnable);
                menuItem.MenuItems.Add(myMenuAction);
                _mainForm.TrayIcon.ContextMenu.MenuItems.Add(menuItem);
            }

            RepopulatePanel();

            StartLoop();
        }
Esempio n. 27
0
 private void MenuITem_Click(object sender, Telerik.Windows.RadRoutedEventArgs e, MyMenuItem myMenuItem)
 {
     myMenuItem.OnClick();
 }
Esempio n. 28
0
        protected void MenuClickEventHandler(object sender, EventArgs e)
        {
            MyMenuItem item = (MyMenuItem)sender;

            ShowControl(item.Control, !item.Control.Visible);
        }
Esempio n. 29
0
        // Added by mav
        public virtual void ShowContextMenu(Point ptScreen)
        {
            System.Windows.Forms.ContextMenu cm = new System.Windows.Forms.ContextMenu();
            ArrayList al = new ArrayList();
            al.AddRange(_holders);
            al.Sort(new HolderSorter());

            MyMenuItem [] items = new MyMenuItem[al.Count];
            for(int i=0; i<al.Count; i++)
            {
                ToolBarDockHolder holder = al[i] as ToolBarDockHolder;
                Control c = holder.Control;
                items[i] = new MyMenuItem();
                items[i].Checked = c.Visible;
                items[i].Text = holder.ToolbarTitle;
                items[i].Click += new EventHandler(MenuClickEventHandler);
                items[i].Control = c;
                cm.MenuItems.Add(items[i]);
            }
            cm.Show(DockStation, DockStation.PointToClient(ptScreen));
        }