コード例 #1
0
        public ToolStripItem[] CreateMenuItems()
        {
            menuItem?.Dispose();
            menuItem = new ToolStripMenuItem("&Configure", Properties.Resources.Settings, OnConfigure);

            return(new ToolStripItem[] { menuItem });
        }
コード例 #2
0
        public ToolStripItem[] CreateMenuItems()
        {
            menuItem?.Dispose();
            menuItem = new ToolStripMenuItem("Keep host &awake", null, OnKeepAwake)
            {
                Checked = keepAwakeTask.IsRunning,
                Visible = appState.Configuration.ShowKeepAwakeMenu,
            };

            return(new ToolStripItem[] { menuItem });
        }
コード例 #3
0
        private void CreateResourceDropDownMenu()
        {
            List <ToolStripMenuItem> items = new List <ToolStripMenuItem>();

            foreach (string resourceType in Context.ResourceTypes.Select(n => n.Name))
            {
                ToolStripMenuItem menuItem = null;
                try
                {
                    menuItem = new ToolStripMenuItem(resourceType)
                    {
                        Name  = resourceType + "_menuItem",
                        Image = IconManager.Instance.VirtualResourceIcons.Images[resourceType],
                        Tag   = ConfigurationObjectTag.Create(EnumUtil.Parse <VirtualResourceType>(resourceType))
                    };
                    menuItem.Click += newResource_MenuItem_Click;
                    items.Add(menuItem);
                }
                catch
                {
                    menuItem?.Dispose();
                    throw;
                }
            }

            foreach (ToolStripMenuItem item in items.OrderBy(n => n.Name))
            {
                addResource_ToolStripDropDownButton.DropDownItems.Add(item);
            }
        }
コード例 #4
0
        /// <summary>
        /// Releases all resources used by the <see cref="ServiceMenuGroup"/> class
        /// </summary>
        /// <param name="disposing">If true this is called by Dispose(), otherwise it is called by the finalizer</param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                try
                {
                    // Free managed resources
                    _editorMenu?.Dispose();
                    _restartMenu?.Dispose();
                    _separator?.Dispose();
                    _startMenu?.Dispose();
                    _statusMenu?.Dispose();
                    _stopMenu?.Dispose();
                    _configureMenu?.Dispose();
                }
                catch
                {
                    // Sometimes when the dispose is done from a thread different than the main one a cross-thread exception is thrown which is not critical
                    // since these menu items will be disposed later by the garbage collector. No Exception is being actually handled or logged since we do
                    // not wat to overwhelm the log with these error messages since they do not affect the Notifier's execution.
                }
            }

            // Add class finalizer if unmanaged resources are added to the class
            // Free unmanaged resources if there are any
        }
コード例 #5
0
 /// <summary>
 /// Disposes the plugin
 /// </summary>
 public void Dispose()
 {
     controlClickManager?.Dispose();
     classHierarchyItem?.Dispose();
     editorClassHierarchyItem?.Dispose();
     SaveSettings();
 }
コード例 #6
0
        public SerialInterface()
        {
            InitializeComponent();

            #region CA1303
            btnOpenPort.Text  = Resources.SerialInterface_btnOpenPort_Text;
            btnClosePort.Text = Resources.SerialInterface_btnClosePort_Text;
            btnSend.Text      = Resources.SerialInterface_btnSend_Text;
            lblInterval.Text  = Resources.SerialInterface_lblInterval_Text;
            #endregion

            ToolStripMenuItem viewSerialInterfaceMenuItemTemp = null;
            ToolStripMenuItem serialOpenAtStartupMenuItemTemp = null;
            ToolStripMenuItem serialDisableWarningsTemp       = null;

            //if (DesignMode) return;

            try
            {
                // Add View >> "Serial Interface" Menu Item
                viewSerialInterfaceMenuItemTemp          = new ToolStripMenuItem(Resources.SerialInterface_viewSerialInterfaceMenuItem_Text);
                viewSerialInterfaceMenuItem              = viewSerialInterfaceMenuItemTemp;
                viewSerialInterfaceMenuItem.CheckOnClick = true;
                viewSerialInterfaceMenuItem.Click       += ViewSerialInterfaceMenuItem_Click;
                viewSerialInterfaceMenuItemTemp          = null;

                // Add Serial >> Open Port, Close Port, and Open at Startup Menu and Menu Items
                serialOpenPortMenuItem                   = new ToolStripMenuItem(Resources.SerialInterface_serialOpenPortMenuItem_Text);
                serialClosePortMenuItem                  = new ToolStripMenuItem(Resources.SerialInterface_serialClosePortMenuItem_Text);
                serialOpenAtStartupMenuItemTemp          = new ToolStripMenuItem(Resources.SerialInterface_serialOpenAtStartupMenuItem_Text);
                serialOpenAtStartupMenuItem              = serialOpenAtStartupMenuItemTemp;
                serialOpenAtStartupMenuItem.CheckOnClick = true;
                serialOpenAtStartupMenuItemTemp          = null;
                serialToolStripMenuItem                  = new ToolStripMenuItem(Resources.SerialInterface_serialToolStripMenuItem_Text);
                serialToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[]
                {
                    serialOpenPortMenuItem,
                    serialClosePortMenuItem,
                    new ToolStripSeparator(),
                    serialOpenAtStartupMenuItem
                });

                // Add Disable Warnings
                serialDisableWarningsTemp          = new ToolStripMenuItem(Resources.SerialInterface_serialDisableWarnings_Text);
                serialDisableWarnings              = serialDisableWarningsTemp;
                serialDisableWarnings.CheckOnClick = true;
                serialDisableWarnings.Click       += SerialDisableWarnings_Click;
                serialDisableWarningsTemp          = null;

                serialToolStripMenuItem.DropDownItems.Add(serialDisableWarnings);
            }
            catch
            {
                viewSerialInterfaceMenuItemTemp?.Dispose();
                serialOpenAtStartupMenuItemTemp?.Dispose();
                serialDisableWarningsTemp?.Dispose();
                throw;
            }
        }
コード例 #7
0
 public void AddIfEnabled(ToolStripMenuItem item)
 {
     if (item.Enabled)
     {
         Add(item);
     }
     else
     {
         item.Dispose();
     }
 }
コード例 #8
0
 public void Dispose()
 {
     _selectionMenu.Dispose();
     _settingsMenu.Dispose();
     if (NotifyIcon.Icon != null)
     {
         NotifyIcon.Icon.Dispose();
     }
     NotifyIcon.Dispose();
     _updateMenuItem.Dispose();
 }
コード例 #9
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_itemPlugInConfig != null)
         {
             _itemPlugInConfig.Dispose();
             _itemPlugInConfig = null;
         }
     }
 }
コード例 #10
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (ocrMenuItem != null)
         {
             ocrMenuItem.Dispose();
             ocrMenuItem = null;
         }
     }
 }
コード例 #11
0
        public virtual void RemoveCustomAction(object action)
        {
            ToolStripMenuItem item = (ToolStripMenuItem)action;

            if (_customActions != null)
            {
                _customActions.Remove(item);
            }
            FFormMenu.DropDownItems.Remove(item);
            item.Dispose();
        }
コード例 #12
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         _commitToolStripMenuItem.Dispose();
         _committerToolStripMenuItem.Dispose();
         _authorToolStripMenuItem.Dispose();
         _diffContainsToolStripMenuItem.Dispose();
         _hashToolStripMenuItem.Dispose();
     }
 }
コード例 #13
0
        private void Close()
        {
            if (startServiceMenuItem != null)
            {
                startServiceMenuItem.Dispose();
                startServiceMenuItem = null;
            }

            if (stopServiceMenuItem != null)
            {
                stopServiceMenuItem.Dispose();
                stopServiceMenuItem = null;
            }

            if (exitMenuItem != null)
            {
                exitMenuItem.Dispose();
                exitMenuItem = null;
            }

            if (notifyIcon != null)
            {
                notifyIcon.ContextMenuStrip.Opening -= ContextMenuStrip_Opening;
                notifyIcon.DoubleClick -= NotifyIcon_DoubleClick;
                notifyIcon.MouseUp     -= NotifyIcon_MouseUp;

                notifyIcon.Dispose();
                notifyIcon = null;
            }

            if (aboutViewModel != null)
            {
                aboutViewModel.Dispose();
                aboutViewModel = null;
            }

            if (statusViewModel != null)
            {
                statusViewModel.Dispose();
                statusViewModel = null;
            }

            if (hiddenWindow != null)
            {
                hiddenWindow.Close();
                hiddenWindow = null;
            }

            if (components != null)
            {
                components.Dispose();
                components = null;
            }
        }
コード例 #14
0
ファイル: OCRPlugin.cs プロジェクト: Vistritium/greenshot
 private void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_ocrMenuItem != null)
         {
             _ocrMenuItem.Dispose();
             _ocrMenuItem = null;
         }
     }
 }
コード例 #15
0
 public void Dispose()
 {
     if (_isManaged)
     {
         RestoreFromSystemTray();
         Menu?.Destroy();
         _menuItemRestore?.Dispose();
         _menuItemClose?.Dispose();
         _systemTrayMenu?.Dispose();
     }
     _isManaged = false;
 }
コード例 #16
0
 internal void FreeEverything()
 {
     menuStrip1.Dispose();
     fileToolStripMenuItem.Dispose();
     closeToolStripMenuItem.Dispose();
     TopPanel.Dispose();
     ThreeDPanel.Dispose();
     MainElementHost.Dispose();
     textBox1.Dispose();
     // ViewPort.Dispose();
     // Scene;
 }
コード例 #17
0
ファイル: FlickrPlugin.cs プロジェクト: zhk/greenshot
 protected virtual void Dispose(bool disposing)
 {
     if (!disposing)
     {
         return;
     }
     if (_itemPlugInConfig == null)
     {
         return;
     }
     _itemPlugInConfig.Dispose();
     _itemPlugInConfig = null;
 }
コード例 #18
0
        public void StopPlugin(RadegastInstance Instance)
        {
            // Remove the menu buttons
            EnabledButton.Dispose();
            MenuButton.Dispose();

            if (talkToAvatar != null)
            {
                Instance.ContextActionManager.DeregisterContextAction(talkToAvatar);
            }
            // Unregister events
            UnregisterClientEvents(Client);
        }
コード例 #19
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (disposing)
            {
                openSettings.Dispose();
                startServer.Dispose();
                stopServer.Dispose();
                server.Close();
                icon.Dispose();
            }
        }
コード例 #20
0
 private void RemoveContextMenu()
 {
     m_host.MainWindow.EntryContextMenu.Opening -= OnEntryMenuOpening;
     m_host.MainWindow.EntryContextMenu.Items.Remove(m_ContextMenuPCA);
     m_ContextMenuPCA.Dispose();
     try
     {
         ToolStripMenuItem entryMenu = m_host.MainWindow.MainMenu.Items["m_menuEntry"] as ToolStripMenuItem;
         entryMenu.DropDownOpening -= OnEntryMenuOpening;
         entryMenu.DropDown.Items.Remove(m_MainMenuPCA);
     }
     catch (Exception) { }
     m_MainMenuPCA.Dispose();
 }
コード例 #21
0
        public void PopulateColorResolutionMenu(string deviceName)
        {
            bool foundDefaultResolution = false;
            var  sm = new ToolStripMenuItem("Color");

            foreach (var resolution in ColorResolutions[deviceName])
            {
                var resText = PixelFormat2String(resolution.Item1.format) + " " + resolution.Item1.width + "x"
                              + resolution.Item1.height + " " + resolution.Item2.max + " fps";
                var sm1 = new ToolStripMenuItem(resText, null);
                var selectedResolution = resolution;
                sm1.Click += (sender, eventArgs) =>
                {
                    m_selectedColorResolution = selectedResolution;
                    ColorResolution_Item_Click(sender);
                };

                sm.DropDownItems.Add(sm1);

                int width  = selectedResolution.Item1.width;
                int height = selectedResolution.Item1.height;
                PXCMImage.PixelFormat format = selectedResolution.Item1.format;
                float fps = selectedResolution.Item2.min;

                if (DefaultCameraConfig.IsDefaultDeviceConfig(deviceName, width, height, format, fps))
                {
                    foundDefaultResolution = true;
                    sm1.Checked            = true;
                    sm1.PerformClick();
                }
            }

            if (!foundDefaultResolution && sm.DropDownItems.Count > 0)
            {
                ((ToolStripMenuItem)sm.DropDownItems[0]).Checked = true;
                ((ToolStripMenuItem)sm.DropDownItems[0]).PerformClick();
            }

            try
            {
                MainMenu.Items.RemoveAt(1);
            }
            catch (NotSupportedException)
            {
                sm.Dispose();
                throw;
            }
            MainMenu.Items.Insert(1, sm);
        }
コード例 #22
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         _menuItemAutoStart?.Dispose();
         _menuItemSettings?.Dispose();
         _menuItemAbout?.Dispose();
         _menuItemExit?.Dispose();
         _menuItemSeparator1?.Dispose();
         _menuItemSeparator2?.Dispose();
         _systemTrayMenu?.Dispose();
         _icon.Visible = false;
         _icon.Dispose();
     }
 }
コード例 #23
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_historyMenuItem != null)
         {
             _historyMenuItem.Dispose();
             _historyMenuItem = null;
         }
         if (_itemPlugInConfig != null)
         {
             _itemPlugInConfig.Dispose();
             _itemPlugInConfig = null;
         }
     }
 }
コード例 #24
0
        public override void DisposeScreen()
        {
            CancelAsync();

            if (AnimatedThreadWorker.IsBusy)
            {
                AnimatedThreadWorker.CancelAsync();
            }
            AnimatedThreadWorker.Dispose();

            if (buttonPrintMenuStrip != null)
            {
                buttonPrintMenuStrip.Dispose();
            }
            if (itemPrintReportStatusSchedule != null)
            {
                itemPrintReportStatusSchedule.Dispose();
            }
            if (itemPrintReportStatusUnschedule != null)
            {
                itemPrintReportStatusUnschedule.Dispose();
            }
            if (itemPrintReportProgramSchedule != null)
            {
                itemPrintReportProgramSchedule.Dispose();
            }
            if (itemPrintReportProgramUnschedule != null)
            {
                itemPrintReportProgramUnschedule.Dispose();
            }
            if (itemPrintReportRecords != null)
            {
                itemPrintReportRecords.Dispose();
            }
            if (itemPrintReportHistory != null)
            {
                itemPrintReportHistory.Dispose();
            }

            if (maintenancePerformanceControl1 != null)
            {
                maintenancePerformanceControl1.CancelAsync();
            }

            Dispose(true);
        }
コード例 #25
0
        public override void Terminate()
        {
            if (m_host == null)
            {
                return;
            }

            Tools.OptionsFormShown  -= OptionsShown;
            Tools.OptionsFormClosed -= OptionsClosed;
            m_host.MainWindow.ToolsMenu.DropDownItems.Remove(m_menu);
            m_menu.Dispose();
            GlobalWindowManager.WindowAdded -= OnWindowAdded;

            ColorPasswords(false);
            PluginDebug.SaveOrShow();
            m_host = null;
        }
コード例 #26
0
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        protected override void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    if (_createItem != null)
                    {
                        _createItem.Dispose();
                    }
                }
            }

            _disposed = true;

            base.Dispose(disposing);
        }
コード例 #27
0
        private void CreateActivityDropDownMenu()
        {
            List <ToolStripMenuItem> items = new List <ToolStripMenuItem>();

            foreach (MetadataType type in GetMetadataTypes(VirtualResourceType.AdminWorker))
            {
                string            typeName = type.Name;
                ToolStripMenuItem menuItem = null;
                try
                {
                    menuItem        = new ToolStripMenuItem(type.Title);
                    menuItem.Name   = typeName + "_menuItem";
                    menuItem.Image  = IconManager.Instance.PluginIcons.Images[typeName];
                    menuItem.Tag    = ConfigurationObjectTag.Create(VirtualResourceType.AdminWorker, typeName);
                    menuItem.Click += new EventHandler(newActivity_MenuItem_Click);

                    // Determine whether this item should be added to a sub-menu
                    if (string.IsNullOrEmpty(type.Group))
                    {
                        items.Add(menuItem);
                    }
                    else
                    {
                        // See if the sub-menu alrady exists
                        ToolStripMenuItem subMenu = items.FirstOrDefault(n => n.Text == type.Group);
                        if (subMenu == null)
                        {
                            subMenu = new ToolStripMenuItem(type.Group);
                            items.Add(subMenu);
                        }
                        subMenu.DropDownItems.Add(menuItem);
                    }
                }
                catch
                {
                    if (menuItem != null)
                    {
                        menuItem.Dispose();
                    }
                    throw;
                }
            }

            newActivity_ToolStripDropDownButton.DropDownItems.AddRange(items.OrderBy(n => n.Text).ToArray());
        }
コード例 #28
0
        public void PopulateColorResolutionMenu(string deviceName)
        {
            bool foundDefaultResolution = false;
            var  sm = new ToolStripMenuItem("Color Resolution");

            foreach (var resolution in ColorResolutions[deviceName])
            {
                string resText = PixelFormat2String(resolution.Item1.format) + " " + resolution.Item1.width + "x"
                                 + resolution.Item1.height + " " + resolution.Item2.max + " fps";
                var sm1 = new ToolStripMenuItem(resText, null);
                Tuple <PXCMImage.ImageInfo, PXCMRangeF32> selectedResolution = resolution;
                sm1.Click += (sender, eventArgs) =>
                {
                    m_selectedColorResolution = selectedResolution;
                    ColorResolution_Item_Click(sender);
                };

                sm.DropDownItems.Add(sm1);

                if (selectedResolution.Item1.format == PXCMImage.PixelFormat.PIXEL_FORMAT_YUY2 &&
                    selectedResolution.Item1.width == 640 && selectedResolution.Item1.height == 360 && selectedResolution.Item2.min == 30)
                {
                    foundDefaultResolution = true;
                    sm1.Checked            = true;
                    sm1.PerformClick();
                }
            }

            if (!foundDefaultResolution && sm.DropDownItems.Count > 0)
            {
                ((ToolStripMenuItem)sm.DropDownItems[0]).Checked = true;
                ((ToolStripMenuItem)sm.DropDownItems[0]).PerformClick();
            }

            try
            {
                MainMenu.Items.RemoveAt(1);
            }
            catch (NotSupportedException)
            {
                sm.Dispose();
                throw;
            }
            MainMenu.Items.Insert(1, sm);
        }
コード例 #29
0
ファイル: KeeSAPLogonExt.cs プロジェクト: sb-sap/keesaplogon
        //---------------------------------------------------------------------------------------------------
        // Private Methods
        //---------------------------------------------------------------------------------------------------
        private void Dispose(bool disposing)
        {
            if (!m_disposed)
            {
                if (disposing)
                {
                    // Free other state (managed objects).
                    m_tsmiSetDlg.Dispose();
                    m_prov.Dispose();
                    m_provOpt.Dispose();
                }

                // Free your own state (unmanaged objects).
                // Set large fields to null.

                m_disposed = true;
            }
        }
コード例 #30
0
ファイル: SetupForm.cs プロジェクト: xx70235/ASCOMRemote
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }

            if (disposing && (!alreadyDisposed))
            {
                alreadyDisposed = true;
                bindingSource.Dispose();
                insertRow.Dispose();
                insertTenRows.Dispose();
                deleteSelectedRows.Dispose();
            }

            base.Dispose(disposing);
        }
コード例 #31
0
ファイル: MQOViewer.cs プロジェクト: cignoir/KinecTh
    private void AddMqo(MeshModel mqo)
    {
        this.models.Add(mqo);

        //追加したMQOを削除するためのメニューを作成・追加する。
        ToolStripMenuItem menu = new ToolStripMenuItem();
        menu.Text = mqo.Name;
        menu.Tag = mqo;

        //メニューがクリックされると、
        //MQOとこのメニュー自身が削除されるように仕込んでおく。
        menu.Click += delegate(object sender, EventArgs e)
        {
            ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;
            MeshModel m = (MeshModel)menuItem.Tag;

            this.models.Remove(m);
            m.Dispose();

            //this.menuRemove.DropDownItems.Remove(menu);
            menu.Dispose();

            if (this.pickedModel == m)
                this.pickedModel = null;
        };

        //this.menuRemove.DropDownItems.Add(menu);
    }