コード例 #1
0
ファイル: Program.cs プロジェクト: nbclark/sideline
        static void Main(string[] args)
        {
            if (Settings.Default.FirstRun)
            {
                if (!Utils.CheckRegistration())
                {
                    using (Register reg = new Register())
                    {
                        if (DialogResult.OK == reg.ShowDialog())
                        {
                            // all good here
                        }
                    }
                }
                Settings.Default.FirstRun = false;
            }
            _callerQ = new Sideline();

            IntPtr hwnd = Win32.FindWindow(null, "sidelineMsg");
            Win32.SetSystemPowerState(null, Win32.POWER_STATE_ON, Win32.POWER_FORCE);
            using (CustomMessageWindow window = new CustomMessageWindow())
            {
                window.Text = "sidelineMsg";
                _callerQ.Load += new EventHandler(_callerQ_Load_Notify);

                for (int i = 0; i < args.Length; i+=2)
                {
                    string arg = args[i].ToLower();

                    if (args.Length > i+1 && arg.Length > 1 && (arg[0] == '-' || arg[0] == '/'))
                    {
                        string command = arg.Substring(1);
                        string value = args[i + 1];

                        switch (command)
                        {
                            case "oid":
                                {
                                    _oid = Convert.ToInt32(value);
                                    _callerQ.Load += new EventHandler(_callerQ_Load_Oid);
                                }
                                break;
                            //case "notify":
                            //    {
                            //        _callerQ.Load += new EventHandler(_callerQ_Load_Notify);
                            //    }
                            //    break;
                        }
                    }
                }

                Application.Run(_callerQ);
                SetNotification();
            }
        }