Esempio n. 1
0
        /// <summary>
        /// 手工同步菜单点击事件
        /// </summary>
        private void ToolStripMenuItemSync_Click(object sender, EventArgs e)
        {
            if (AppCommon.ProcessExist("dboxSyncer.Process") == true)
            {
                MessageBox.Show(LangTable["tipsProcessing"].TypeString());
            }
            else
            {
                buttonSync.Enabled = false;
                buttonSync.Text    = LangTable["buttonProcessing"].TypeString();

                AppCommon.ProcessExecute(AppCommon.PathCombine(AppConfig.AppPath, "dboxSyncer.Process.exe"), "", -1);

                buttonSync.Enabled = true;
                buttonSync.Text    = LangTable["buttonSync"].TypeString();
            }
        }
Esempio n. 2
0
        public static void Main()
        {
            if (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length - 1 > 0)
            {
                Application.Exit();
            }

            TimeSpan TS = new TimeSpan();

            try
            {
                do
                {
                    TS = DateTime.Now.AddMinutes(AppConfig.IntervalTime.TypeInt()) - DateTime.Now;

                    Thread.Sleep((int)TS.TotalMilliseconds);

                    if (AppCommon.ProcessExist("dboxSyncer") == false)
                    {
                        Application.Exit();
                    }

                    if (AppCommon.ProcessExist("dboxSyncer.Process") == false)
                    {
                        AppCommon.ProcessExecute(AppCommon.PathCombine(AppConfig.AppPath, "dboxSyncer.Process.exe"), "", 0);
                    }
                } while (true);
            }
            catch (Exception ex)
            {
                File.AppendAllText(AppCommon.PathCombine(AppConfig.AppPath, "error.log"), "" + DateTime.Now.ToString() + "\n" + ex.ToString() + "\n\n");
            }
            finally
            {
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
        }