예제 #1
0
파일: FormView.cs 프로젝트: piksel/parahalf
 public FormView()
 {
     InitializeComponent();
     screenBounds = Screen.PrimaryScreen.Bounds;
     Top = -6 - screenBounds.Top - (screenBounds.Height / 2);
     Width = screenBounds.Width;
     Height = screenBounds.Height / 2;
     Opacity = 0.0;
     ghm = new GlobalHotkeyManager();
 }
예제 #2
0
파일: FormView.cs 프로젝트: piksel/parahalf
        private void initAll()
        {
            appViewHandles = new List<AppViewHandle>();

            string settingsFile = "settings.json";
            if (File.Exists(settingsFile))
            {
                var fs = File.Open(settingsFile, FileMode.Open);
                var sr = new StreamReader(fs);
                settings = Settings.FromJson(sr.ReadToEnd());
                ghm = new GlobalHotkeyManager();

                for (int i = 0; i < settings.appViews.Count; i++)
                {
                    appViewHandles.Add(spawnProc(settings.appViews[i]));
                    ghm.Register(
                        settings.appViews[i].hotKeyModifier,
                        settings.appViews[i].hotKey,
                        this,
                        GetDelegate(i));

                    var tsmiView = new ToolStripMenuItem(settings.appViews[i].name);

                    var tsmiRebind = new ToolStripMenuItem("Rebind");
                    tsmiRebind.Enabled = false;
                    tsmiView.DropDownItems.Add(tsmiRebind);

                    var tsmiRelaunch = new ToolStripMenuItem("Relaunch");
                    tsmiRelaunch.Enabled = false;
                    tsmiView.DropDownItems.Add(tsmiRelaunch);

                    viewsToolStripMenuItem.DropDownItems.Add(tsmiView);
                }
                tAnimate.Interval = settings.animationDelay;
            }
            else
            {
                settings = new Settings();
                if (MessageBox.Show("You have not configured any settings.\nDo you want to do that now?",
                    "No settings file found",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    settingsToolStripMenuItem_Click(null, null);
                }
            }
        }