Ejemplo n.º 1
0
        static void Main()
        {
            var current = Process.GetCurrentProcess();
            var v = Process.GetProcessesByName(current.ProcessName);
            if (v.Length > 1)
            {
                foreach (Process proc in v)
                {
                    if (proc.Id == current.Id) continue;
                    //ShowWindow(proc.MainWindowHandle, 9 /* SW_RESTORE */);
                    SetForegroundWindow(proc.MainWindowHandle);
                    return;
                }
            }

            var setting = new UserSetting();
            setting.Load();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm(setting));
            setting.Save();
        }
Ejemplo n.º 2
0
 /* ----------------------------------------------------------------- */
 /// SaveSetting
 /* ----------------------------------------------------------------- */
 private void SaveSetting(string path)
 {
     UserSetting setting = new UserSetting();
     foreach (KeyValuePair<string, ScheduleItem> item in this._schedule) {
         if (item.Key == DEFAULT_SETTING_NAME) setting.DefaultSetting = item.Value;
         else setting.Schedule.Add(item.Value);
     }
     setting.Save(path);
 }
Ejemplo n.º 3
0
 /* ----------------------------------------------------------------- */
 /// constructor
 /* ----------------------------------------------------------------- */
 public MainForm(UserSetting setting)
 {
     InitializeComponent();
     this._setting = setting;
     this.Initialize();
 }
Ejemplo n.º 4
0
 /* ----------------------------------------------------------------- */
 /// constructor
 /* ----------------------------------------------------------------- */
 public MainForm(UserSetting setting)
 {
     InitializeComponent();
     this._setting = setting;
     this.Initialize();
 }