Exemple #1
0
        /// <summary>
        /// 退出菜单点击事件
        /// </summary>
        private void ToolStripMenuItemQuit_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(LangTable["tipsQuit"].TypeString(), this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                AppCommon.ProcessExit("dboxSyncer.Task");
                AppCommon.ProcessExit("dboxSyncer.Process");

                Environment.Exit(0);
            }
        }
Exemple #2
0
        /// <summary>
        /// 同步设置按钮点击事件
        /// </summary>
        private void ButtonSetting_Click(object sender, EventArgs e)
        {
            XmlDocument XDocument     = new XmlDocument();
            XmlNode     XNode         = default(XmlNode);
            string      XPath         = "/configuration/appSettings/add[@key=\"{key}\"]";
            string      ConfigPath    = AppCommon.PathCombine(AppConfig.AppPath, "dboxSyncer.exe.config");
            string      IntervalTime  = listBoxIntervalTime.Text;
            string      UploadSpeed   = textBoxUploadSpeed.Text;
            string      DownloadSpeed = textBoxDownloadSpeed.Text;

            if (UploadSpeed.TypeInt() < 0 || UploadSpeed.TypeInt() > 1000)
            {
                MessageBox.Show(LangTable["tipsUploadSpeedError"].TypeString());
                return;
            }

            if (DownloadSpeed.TypeInt() < 0 || DownloadSpeed.TypeInt() > 1000)
            {
                MessageBox.Show(LangTable["tipsDownloadSpeedError"].TypeString());
                return;
            }

            XDocument.Load(ConfigPath);

            XNode = (XmlNode)XDocument.SelectSingleNode(XPath.Replace("{key}", "IntervalTime"));

            if (AppCommon.IsNothing(XNode) == false)
            {
                XNode.Attributes["value"].InnerText = IntervalTime;
            }

            XNode = (XmlNode)XDocument.SelectSingleNode(XPath.Replace("{key}", "UploadSpeed"));

            if (AppCommon.IsNothing(XNode) == false)
            {
                XNode.Attributes["value"].InnerText = UploadSpeed;
            }

            XNode = (XmlNode)XDocument.SelectSingleNode(XPath.Replace("{key}", "DownloadSpeed"));

            if (AppCommon.IsNothing(XNode) == false)
            {
                XNode.Attributes["value"].InnerText = DownloadSpeed;
            }

            XDocument.Save(ConfigPath);

            AppCommon.ProcessExit("dboxSyncer.Task");
            AppCommon.ProcessExecute(AppCommon.PathCombine(AppConfig.AppPath, "dboxSyncer.Task.exe"), "", -1);
        }
Exemple #3
0
        private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason.ToString() == "UserClosing")
            {
                if (MessageBox.Show(LangTable["tipsQuit"].TypeString(), this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    AppCommon.ProcessExit("dboxSyncer.Task");
                    AppCommon.ProcessExit("dboxSyncer.Process");

                    Environment.Exit(0);
                }
                else
                {
                    e.Cancel = true;
                }
            }
            else
            {
                AppCommon.ProcessExit("dboxSyncer.Task");
                AppCommon.ProcessExit("dboxSyncer.Process");

                Environment.Exit(0);
            }
        }