Пример #1
0
        public static void Main()
        {
      #if !DEBUG
            Application.ThreadException +=
                new ThreadExceptionEventHandler(Application_ThreadException);
            Application.SetUnhandledExceptionMode(
                UnhandledExceptionMode.CatchException);

            AppDomain.CurrentDomain.UnhandledException +=
                new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
      #endif

            if (!AllRequiredFilesAvailable())
            {
                Environment.Exit(0);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            /*using (GUI.MainWindow form = new GUI.MainWindow()) {
             * form.FormClosed += delegate(Object sender, FormClosedEventArgs e) {
             *  Application.Exit();
             * };
             * Application.Run();
             * }*/
            using (GUI.MainForm form = new GUI.MainForm())
            {
                form.FormClosed += delegate(Object sender, FormClosedEventArgs e) {
                    Application.Exit();
                };
                Application.Run();
            }
        }
Пример #2
0
 void notifyIcon_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         MusicAlarm.GUI.MainForm form = new GUI.MainForm();
         form.Show();
     }
 }
Пример #3
0
 private void btnDangNhap_Click(object sender, EventArgs e)
 {
     if (txtUser.Text == "admin" && txtPassword.Text == "admin")
     {
         MessageBox.Show("Đăng nhập thành công!", "Đăng Nhập", MessageBoxButtons.OK, MessageBoxIcon.Information);
         GUI.MainForm mf = new GUI.MainForm();
         this.Hide();
     }
     else
     {
         MessageBox.Show("Đăng nhập thất bại!", "Đăng Nhập", MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtPassword.Text = "";
         txtUser.Text     = "";
     }
 }
Пример #4
0
        public static void StartApp(bool block, string[] args)
        {
            try
            {
                bool hideOnLoad     = false;
                bool verboseLogging = false;

                foreach (string arg in args)
                {
                    string lowerArg = arg.ToLower();
                    if (lowerArg == "/hide")
                    {
                        hideOnLoad = true;
                    }
                    else if (lowerArg == "/verbose")
                    {
                        verboseLogging = true;
                    }
                }

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                GUI.MainForm m = new GUI.MainForm(hideOnLoad);
                Config.CreateInstance();
                PWLib.UsbDrive.UsbDriveList.CreateInstance(m);

                m.ControlSwitcher.SwitchUserControl(FormControlType.Welcome, FormControlSwitchType.Start);

                Log.Init(verboseLogging);
                Log.WriteLine(LogType.TextLog, "******************* Starting application *******************");

                m.StartSpineThread();

                if (block)
                {
                    Application.Run(m);
                }
                else
                {
                    m.Show();
                }
            }
            catch (System.Exception ex)
            {
                Log.WriteException("Fatal exception caught", ex);
            }
        }
Пример #5
0
        public static void StartApp( bool block, string[] args )
        {
            try
            {
                bool hideOnLoad = false;
                bool verboseLogging = false;

                foreach ( string arg in args )
                {
                    string lowerArg = arg.ToLower();
                    if ( lowerArg == "/hide" )
                        hideOnLoad = true;
                    else if ( lowerArg == "/verbose" )
                        verboseLogging = true;
                }

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault( false );

                GUI.MainForm m = new GUI.MainForm( hideOnLoad );
                Config.CreateInstance();
                PWLib.UsbDrive.UsbDriveList.CreateInstance( m );

                m.ControlSwitcher.SwitchUserControl( FormControlType.Welcome, FormControlSwitchType.Start );

                Log.Init( verboseLogging );
                Log.WriteLine( LogType.TextLog, "******************* Starting application *******************" );

                m.StartSpineThread();

                if ( block )
                    Application.Run( m );
                else
                    m.Show();
            }
            catch ( System.Exception ex )
            {
                Log.WriteException( "Fatal exception caught", ex );
            }
        }