Beispiel #1
0
 public static new CXDConfig GetInstance()
 {
     if (instance == null)
     {
         instance = new CXDConfig();
     }
     return(instance);
 }
Beispiel #2
0
        private void frmDict_Shown(object sender, EventArgs e)
        {
            textBoxDropDown1.TextBox.Focus();
            firstenter = false;

            CXDConfig cxdconfig = Global.cxdconfig;

            if (string.Equals(cxdconfig.GetSetting("MinimizeOnLoad"), "true", StringComparison.OrdinalIgnoreCase))
            {
                this.WindowState = FormWindowState.Minimized;
            }
        }
Beispiel #3
0
        private void SaveConfig()
        {
            CXDConfig config = CXDConfig.GetInstance();

            config.SetSetting("AutoRun", checkBox1.Checked.ToString());
            config.SetSetting("MinimizeOnLoad", checkBox2.Checked.ToString());
            config.SetSetting("HideToTrayOnClose", checkBox3.Checked.ToString());
            config.SetSetting("HideToTrayOnMinimized", checkBox4.Checked.ToString());
            config.SetSetting("ChooseByClick", checkBox5.Checked.ToString());

            config.SetSetting("GetWordMode", comboBoxEx1.SelectedIndex.ToString());
            config.SetSetting("Interval", comboBoxEx2.Text);
            config.SetSetting("Opacity", slider1.Value.ToString());
        }
Beispiel #4
0
        private void frmConfig_Load(object sender, EventArgs e)
        {
            CXDConfig config = CXDConfig.GetInstance();

            //常规
            checkBox1.Checked = string.Equals(config.GetSetting("AutoRun"), "True", StringComparison.OrdinalIgnoreCase);
            checkBox2.Checked = string.Equals(config.GetSetting("MinimizeOnLoad"), "True", StringComparison.OrdinalIgnoreCase);
            checkBox3.Checked = string.Equals(config.GetSetting("HideToTrayOnClose"), "True", StringComparison.OrdinalIgnoreCase);
            checkBox4.Checked = string.Equals(config.GetSetting("HideToTrayOnMinimized"), "True", StringComparison.OrdinalIgnoreCase);
            checkBox5.Checked = string.Equals(config.GetSetting("ChooseByClick"), "True", StringComparison.OrdinalIgnoreCase);

            //取词
            comboBoxEx1.SelectedIndex = MyTools.Config.GetIntValue(config.GetSetting("GetWordMode"), 0);
            comboBoxEx2.Text          = MyTools.Config.GetIntValue(config.GetSetting("Interval"), 30).ToString();
            slider1.Value             = MyTools.Config.GetIntValue(config.GetSetting("Opacity"), 90);

            ConfigChanged = false;
        }
Beispiel #5
0
        private void frmTest_Load(object sender, EventArgs e)
        {
            //System.IO.FileStream fs = new System.IO.FileStream("ciba.ico", System.IO.FileMode.Create);
            //notifyIcon1.Icon.Save(fs);
            //fs.Close();

            CardLibrary.GetInstance().AllowDIY = true;
            this.Text = "卡片词霸 v" + Global.Version;

            //listView2.Dock = DockStyle.None;
            //listView2.Location = new Point(1, 0);
            //listView2.Size = new Size(listView1.Size.Width - 2, listView1.Height - listView1.ClientRectangle.Height+14);
            listView2.Columns[0].TextAlign = HorizontalAlignment.Left;
            listView2.Columns[1].TextAlign = HorizontalAlignment.Left;

            //if (System.Environment.OSVersion.Version.Major > 5)
            //{
            //    splitContainer1.SplitterDistance = 16;
            //}
            //else
            splitContainer1.SplitterDistance = 16;


            this.Office2007ColorTable = DevComponents.DotNetBar.Rendering.eOffice2007ColorScheme.Blue;
            this.textBoxDropDown1.TextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxDropDown1_KeyPress);
            this.textBoxDropDown1.TextBox.Enter    += new System.EventHandler(this.textBoxDropDown1_Enter);
            this.textBoxDropDown1.TextBox.MouseUp  += new System.Windows.Forms.MouseEventHandler(this.textBoxDropDown1_MouseUp);
            Rectangle rect = new Rectangle();

            rect = Screen.GetWorkingArea(this);
            this.MaximizedBounds = new Rectangle(rect.X - 4, rect.Y, rect.Width + 8, rect.Height);

            Global.cxdconfig     = CXDConfig.GetInstance();
            Global.frmDictHolder = this;

            RegisterHotKey(Handle, hkGrabEnable, 0, VK_F11);
            RegisterHotKey(Handle, hkMainFormVisble, 0, VK_F10);

            FloatForm = new frmFloat();
            try
            {
                FloatForm.Opacity = double.Parse(Global.cxdconfig.GetSetting("Opacity")) / 100;
            }
            catch
            {
                FloatForm.Opacity = 0.9;
            }

            searcher        = new DictSearcher();
            Global.searcher = searcher;
            gp             = new GrabProxy();
            gp.GrabEnabled = true;

            try
            {
                gp.GrabInterval = int.Parse(Global.cxdconfig.GetSetting("Interval"));
            }
            catch
            {
                gp.GrabInterval = 30;
            }

            switch (Global.cxdconfig.GetSetting("GetWordMode"))
            {
            case "0":
                gp.GrabMode = XDictGrabModeEnum.XDictGrabMouse;
                break;

            case "1":
                gp.GrabMode = XDictGrabModeEnum.XDictGrabMouseWithCtrl;
                break;

            case "2":
                gp.GrabMode = XDictGrabModeEnum.XDictGrabMouseWithShift;
                break;

            case "3":
                gp.GrabMode = XDictGrabModeEnum.XDictGrabMouseWithMiddleButton;
                break;

            default:
                gp.GrabMode = XDictGrabModeEnum.XDictGrabMouse;
                break;
            }

            gp.AdviseGrab(this);

            icon1            = global::CardXDict.Properties.Resources.ciba;
            icon2            = global::CardXDict.Properties.Resources.cibastop;
            notifyIcon1.Icon = icon1;
        }