Ejemplo n.º 1
0
 private void 设为开机启动ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (设为开机启动ToolStripMenuItem.Checked == false) //设置开机自启动
         {
             string      path = Application.ExecutablePath;
             RegistryKey rk   = Registry.LocalMachine;
             RegistryKey rk2  = rk.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run");
             rk2.SetValue("JcShutdown", path);
             rk2.Close();
             rk.Close();
             设为开机启动ToolStripMenuItem.Checked     = true;
             Properties.Settings.Default.Startup = true;
         }
         else //取消开机自启动
         {
             string      path = Application.ExecutablePath;
             RegistryKey rk   = Registry.LocalMachine;
             RegistryKey rk2  = rk.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run");
             rk2.DeleteValue("JcShutdown", false);
             rk2.Close();
             rk.Close();
             设为开机启动ToolStripMenuItem.Checked     = false;
             Properties.Settings.Default.Startup = false;
         }
     }
     catch (Exception ex)
     {
         FrmTips.ShowTipsWarning(this, "请使用管理员模式运行");
         //MessageBox.Show(ex.Message,"请使用管理员模式");
     }
     NotifyMenu.Show();
 }
Ejemplo n.º 2
0
        private void InitData()
        {
            cultureManager = new CultureManager();
            cultureManager.SelectCulture("ko-KR");
            canDrag = false;

            now = DateTime.Now;

            selectedMonth = now.Month;
            selectedYear  = now.Year;

            notify          = new NotifyMenu(this);
            dailyMemos      = new List <DailyMemo>();
            loadMemoManager = new LoadMemoManager();

            MemoManager.Instance.LoadDataFromFile();
            SettingManager.LoadCurrentSetting();
        }
Ejemplo n.º 3
0
        private void closingTask()
        {
            refcontrol.BeginInvoke((MethodInvoker) delegate()
            {
                ConnectButton.Enabled = false;
            });
            if (Manager != null)
            {
                if (Manager.CheckifTask())
                {
                    if (!fMonoFramework)
                    {
                        AppNotifyIcon.BalloonTipText = "Bitfresh is closing. Please wait until running tasks complete.";
                        AppNotifyIcon.ShowBalloonTip(3 * Constants.second);
                    }
                    refcontrol.BeginInvoke((MethodInvoker) delegate()
                    {
                        IsEnabled = false;
                    });
                }

                Manager.Dispose();
            }

            if (!fMonoFramework)
            {
                NotifyMenu.Dispose();
                AppNotifyIcon.Dispose();
            }

            refcontrol.BeginInvoke((MethodInvoker) delegate()
            {
                PrfWindow.Dispose();
                Application.Exit();
            });
        }