Esempio n. 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="type"></param>
 private void UncheckMenus(string type)
 {
     foreach (ToolStripItem item in menu.Items)
     {
         if (item.Tag != null)
         {
             MenuKey menukey = (MenuKey)item.Tag;
             if (menukey.type == type)
             {
                 ((ToolStripMenuItem)item).Checked = false;
             }
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnClickMenuItem(object sender, ToolStripItemClickedEventArgs e)
        {
            //  ContextMenuStrip menu = (ContextMenuStrip)sender;   // == this.menu
            if (e.ClickedItem.GetType() != typeof(ToolStripMenuItem))
            {
                return;
            }

            ToolStripMenuItem menuItem = (ToolStripMenuItem)e.ClickedItem;

            switch (menuItem.Name)
            {
            // 기본메뉴
            case "M00":         // Use Proxy Server
                DoToggleProxyEnable();
                break;

            case "M01":         // Clear Internet Settings
                DoClearProxySetting();
                break;

            case "M02":         // Settings
                new Settings().Show();
                break;

            case "M03":         // About
                new About().Show();
                break;

            case "M04":         // About
                Exit();
                break;

            //
            default:
                MenuKey menukey = (MenuKey)menuItem.Tag;
                if (MenuKey.IPSETTING == menukey.type)
                {
                    DoConnectionIPSetting(menuItem);
                }
                else if (MenuKey.PROXY == menukey.type)
                {
                    DoExchangeProxy(menuItem);
                }
                break;
            }
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="menuItem"></param>
        private void DoConnectionIPSetting(ToolStripMenuItem menuItem)
        {
            UncheckMenus(MenuKey.IPSETTING);

            MenuKey menukey = (MenuKey)menuItem.Tag;

            if (menukey != null)
            {
                // 클릭한연결주소설정체크
                menuItem.Checked = true;

                int       ipsetIndex = menukey.index;
                IPSetting ipset      = ipsetList[ipsetIndex];

                ConnectionSetting.SetIPSetting(ipset.Conn, ipset);
            }
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        private void InitMenuStatus()
        {
            // 현재사용중인항목
            foreach (ToolStripItem item in menu.Items)
            {
                MenuKey menukey = (MenuKey)item.Tag;
                if (menukey != null)
                {
                    bool menucheck = false;

                    // 연결주소
                    if (menukey.type == MenuKey.IPSETTING)
                    {
                        IPSetting ipset = ipsetList[menukey.index];
                        string    curip = ConnectionSetting.getCurrentIP(ipset.Conn.Name);

                        if ((curip == ConnectionSetting.DHCP && ipset.AddrDHCP) ||
                            (curip != null && curip.Length > 0 && curip == ipset.Ipaddr))
                        {
                            menucheck = true;
                        }
                    }
                    // 프록시서버
                    else if (menukey.type == MenuKey.PROXY)
                    {
                        Proxy  proxy   = proxyList[menukey.index];
                        string pss     = InternetSetting.GenProxyServerString(proxy);
                        string currpss = InternetSetting.GetProxyServer();

                        if (currpss != null && currpss.Length > 0 && currpss == pss)
                        {
                            menucheck = true;
                        }
                    }

                    if (menucheck)
                    {
                        ((ToolStripMenuItem)item).Checked = true;
                    }
                }
            }

            // 프록시서버사용여부
            GetMenuByName("M00").Checked = InternetSetting.GetProxyEnable();
        }
Esempio n. 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="menuItem"></param>
        private void DoExchangeProxy(ToolStripMenuItem menuItem)
        {
            UncheckMenus(MenuKey.PROXY);

            MenuKey menukey = (MenuKey)menuItem.Tag;

            if (menukey != null)
            {
                // 프록시서버사용여부체크
                GetMenuByName("M00").Checked = true;

                // 클릭한프록시서버체크
                menuItem.Checked = true;

                int   proxyIndex = menukey.index;
                Proxy proxy      = proxyList[proxyIndex];

                InternetSetting.SetProxySetting(proxy);
            }
        }
Esempio n. 6
0
        public override void OnHostingFormLoaded(ReferenceGridForm referenceGridForm)
        {
            if (_settings == null)
            {
                Settings.TryGetValue(SettingsKey, out string json);
                _settings = json.Load();
            }


            if (!_menus.ContainsKey(referenceGridForm))
            {
                var viewMenu = referenceGridForm
                               .GetCommandbar(ReferenceGridFormCommandbarId.Menu)
                               .GetCommandbarMenu(ReferenceGridFormCommandbarMenuId.View);

                var menu = viewMenu.InsertCommandbarMenu(viewMenu.Tool.Tools.Count - 1, MenuKey.FormatString(referenceGridForm.Id.ToString()), Properties.Resources.Menu_Caption);
                menu.HasSeparator = true;
                _menus.Add(referenceGridForm, menu);
                referenceGridForm.FormClosed += ReferenceGridForm_FormClosed;
            }


            RefreshMenuItems();
        }