コード例 #1
0
ファイル: Program.cs プロジェクト: cube-soft/CubePowerMonitor
        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();
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: cube-soft/CubePowerSaver
 /* ----------------------------------------------------------------- */
 /// 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);
 }
コード例 #3
0
 /* ----------------------------------------------------------------- */
 /// constructor
 /* ----------------------------------------------------------------- */
 public MainForm(UserSetting setting)
 {
     InitializeComponent();
     this._setting = setting;
     this.Initialize();
 }
コード例 #4
0
 /* ----------------------------------------------------------------- */
 /// constructor
 /* ----------------------------------------------------------------- */
 public MainForm(UserSetting setting)
 {
     InitializeComponent();
     this._setting = setting;
     this.Initialize();
 }