Пример #1
0
 protected override bool OnStartup(StartupEventArgs e)
 {
     _app = new ExtendedApplication();
     ExtendedApplicationBase.Current = _app;
     _app.Run();
     return false;
 }
Пример #2
0
 protected override bool OnStartup(StartupEventArgs e)
 {
     // First time app is launched
     _app = new SingleInstanceApplication();
     _app.Run();
     return false;
 }
Пример #3
0
 protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
 {
     a = new App();
     a.InitializeComponent();
     a.Run();
     return(false);
 }
Пример #4
0
 protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
 {
     // First time app is launched
     app = new App();
     app.Run();
     return(false);
 }
Пример #5
0
        /// <summary>
        /// Overrides the OnStartup Method from Base.
        /// On first startup, creates a new Application and runs it. 
        /// </summary>
        /// <param name="e"></param>
        /// <returns>A System.Boolean that indicates if the application should continue starting up.</returns>
        /// 
        protected override bool OnStartup(StartupEventArgs e)
        {
            App = new SynclessApplication();
            App.Run();

            return false;
        }
Пример #6
0
        /// <summary>
        /// Подпрограмма инициализации первого экземпляра программы
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
        {
            var path = AppDomain.CurrentDomain.BaseDirectory;

            if (UacClass.CheckDirectory(path))
            {
                // Доступ к рабочей директории текущим пользователем возможен
                Run();
            }
            else
            {
                // Права доступа текущего пользователя Windows
                // не позволяют получить доступ к рабочей директории
                if (UacClass.IsAdmin())
                {
                    // Пользователь обладает правами Администатора
                    // но права на доступ к папке
                    // по неизвестным причинам отсутствуют
                    MessageBox.Show(
                        "Права доступа текущего пользователя Windows" +
                        Environment.NewLine +
                        "не позволяют получить доступ к директории",
                        "Error",
                        MessageBoxButton.OK,
                        MessageBoxImage.Error);
                }
                else
                {
                    // Пользователю не предоставлены права Администатора
                    // Запуск процесса с правами Администратора
                    UacClass.RunAsAdmin();
                }
            }
            return(false);
        }
Пример #7
0
 protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
 {
     // First time app is launched
     mainForm = new FrmMain();
     Application.Run(mainForm);
     return(false);
 }
		protected override bool OnStartup(StartupEventArgs e)
		{
			//XmlConfigurator.Configure();
			_touchMouseEventManager.Init();

			_icon = new NotifyIcon
			{
				Icon = Properties.Resources.mouse,
				Visible = true
			};

			var contextMenuStrip = new ContextMenuStrip();
			contextMenuStrip.Items.Add(new MiddleClickStripMenuItem(_touchConfiguration));
			contextMenuStrip.Items.Add(new TouchOverStripMenuItem(_touchConfiguration));
			contextMenuStrip.Items.Add(new LeftHandedStripMenuItem(_touchConfiguration));
			contextMenuStrip.Items.Add(new HelpToolStripMenuItem());
			contextMenuStrip.Items.Add(new ToolStripSeparator());
			contextMenuStrip.Items.Add(new MouseMapStripMenuItem(_touchMouseEventManager));
			contextMenuStrip.Items.Add(new TouchZoneConfigurationStripMenuItem(_touchMouseEventManager, _touchZoneProvider));
			contextMenuStrip.Items.Add(new ToolStripSeparator());
			contextMenuStrip.Items.Add(new ExitStripMenuItem(_icon));

			//Published on November 23rd 2008 by Aston.
			//Released under the Free Art (copyleft) license.
			// Icon for Windows XP, Vista and 7.

			_icon.ContextMenuStrip = contextMenuStrip;
			_icon.ShowBalloonTip(5000, "Info", "Touch Mouse Mate has started", ToolTipIcon.Info);
			_icon.Text = string.Format("Touch Mouse Mate {0}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version);
			Application.Run();
			return false;
		}
Пример #9
0
 protected override bool OnStartup(StartupEventArgs eventArgs)
 {   
     m_app = new StahpIt();
     m_app.InitializeComponent();
     m_app.Run();
     return false;
 }
        protected override bool OnStartup(StartupEventArgs eventArgs) {
            InitSettings();

            SongPlayer = new SongPlayer(ApplicationSettings.Volume);
            Playlist = new Playlist();
            TransitionMgr = new TransitionManager(SongPlayer, Playlist, ApplicationSettings);

            if(eventArgs.CommandLine.Count > 0) {
                HandleArgs(eventArgs.CommandLine.ToArray()).Wait();
            } else {
                LoadStartupSongFiles();
            }

            SpeechController = new SpeechController(SongPlayer, Playlist, ApplicationSettings);
            SpeechController.Init();

            Application = new SpeechMusicControllerApp();
            Application.InitializeComponent();

            var windowMgr = new WindowManager((Hardcodet.Wpf.TaskbarNotification.TaskbarIcon)Application.FindResource(TrayIconResourceName));
            windowMgr.Init(ApplicationSettings, SongPlayer, Playlist, SpeechController);

            Application.Exiting += (s, a) => {
                ApplicationSettings.WriteToDisc();
            };

            windowMgr.Overlay.DisplayText("SMC Running...", 2000);
            Application.Run();
            return false;
        }
Пример #11
0
        protected override bool OnStartup(StartupEventArgs e)
        {
            App = new App();
            App.Run();

            return false;
        }
Пример #12
0
 protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
 {
     // First time _application is launched
     _commandLine = eventArgs.CommandLine;
     _application = new SingleInstanceApplication();
     _application.Run();
     return(false);
 }
Пример #13
0
 protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
 {
     //在程序第一次运行时调用
     app = new MainForm();
     Application.Run(app);
     //运行后返回FLASE
     return(false);
 }
 protected override bool OnStartup(StartupEventArgs e)
 {
     // First time app is launched
     app = new App();
     app.InitializeComponent();
     app.Run();
     return false;
 }
Пример #15
0
        /// <summary>
        /// First time app is launched
        /// </summary>
        protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
        {
            Logger.DebugFormat("OnStartup");

            app = new App();
            app.Run();
            return(false);
        }
 /// <summary>
 /// Event handler to override the default application startup
 /// </summary>
 /// <param name="eventArgs">Command-line arguments of the application</param>
 /// <returns>Flag that indicates if the application should continue starting up</returns>
 protected override bool OnStartup(StartupEventArgs eventArgs)
 {
     // First time application is launched
     this.app = new App();
     this.app.InitializeComponent();
     this.app.Run();
     return false;
 }
Пример #17
0
        protected override bool OnStartup(StartupEventArgs args)
        {
            //this is the first time
            _instance = new App();
            _instance.Run();

            return false;
        }
        protected override bool OnStartup(StartupEventArgs eventArgs)
        {
            base.OnStartup(eventArgs);

            app = new App();
            app.Run();
            return false;
        }
Пример #19
0
        protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
        {
            base.OnStartup(e);
            app = new WpfApp();
            app.Run();

            return(false);
        }
Пример #20
0
 protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
 {
     //First time app is launched
     app = new SingleInstanceApplication();
     app.Run();
     //app.Start();
     //MessageBox.Show("first");
     return(false);
 }
Пример #21
0
        protected override bool OnStartup(StartupEventArgs eventArgs)
        {
            SplashScreen splashScreen = new SplashScreen("splashscreen.png");

            splashScreen.Show(true);
            app = new App();
            app.Run();
            return(false);
        }
Пример #22
0
        static void StartupHandler(object sender, StartupEventArgs e)
        {
            SingleInstanceApplication app = (SingleInstanceApplication) sender;
            MainForm form = (MainForm) app.AppMainForm;

            form.CreateNotifyIcon();

            processCommandLine(form, e.CommandLine);
        }
Пример #23
0
            protected override bool OnStartup(StartupEventArgs eventArgs)
            {
                AppLog = new Logger(System.IO.Path.Combine(Application.StartupPath, "ClientLog.txt"));
                App = new GameClientModuleHost(new MetroClientForm(), AppLog);
                MetroMessageBox.SetOwner(App.UI.GetForm());
                Application.Run();

                return false;
            }
Пример #24
0
        protected override bool OnStartup(StartupEventArgs eventArgs) {
            if (settings.FirstRun) {
                settings.FirstRun = false;
                settings.LfsExePath = LfsRegistryHelper.GetLfsExePath();
                settings.ExportPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            }

            return base.OnStartup(eventArgs);
        }
Пример #25
0
 protected override bool OnStartup(StartupEventArgs eventArgs)
 {
     ProcessSquirrelStartup();
     // First time _application is launched
     _commandLine = eventArgs.CommandLine;
     _application = new App();
     _application.Run();
     return(false);
 }
Пример #26
0
        protected override bool OnStartup(
            Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
        {
            base.OnStartup(eventArgs);
            App app = new App();     //Your application instance

            app.Run();
            return(false);
        }
Пример #27
0
        protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
        {
            base.OnStartup(eventArgs);

            ProcessArguments(eventArgs.CommandLine);
            _app.Run(this._app.MainWindow);

            return(false);
        }
        /// <summary>
        /// <para>Does what the constructor normally should do.</para>
        /// <para>This way the window stays hidden when we start a next instance</para>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void Init(object sender, StartupEventArgs e)
        {
            InitializeComponent();

            this.Log = new Log(this);
            this.Log.Show();
            this.EventMgr = new Events.Manager(this);
            this.TaskMgr = new Tasks.Manager(this);
            this.Log.LogLine(new String('-', 32), Log.Type.Other);
        }
Пример #29
0
        protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
        {
            // First time app is launched.
            _app = new App();
            _app.InitializeComponent();
            _app.ProcessArgs(eventArgs.CommandLine.ToArray(), true);
            _app.Run();

            return(false);
        }
Пример #30
0
        protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
        {
            Application app = new Application();

            main = new MainWindow();
            app.Run(main);
            bool tag = base.OnStartup(eventArgs);

            return(tag);
        }
Пример #31
0
        protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
        {
            bool result = base.OnStartup(eventArgs);

            App app = new App();

            app.Run();

            return(result);
        }
Пример #32
0
        protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
        {
            base.OnStartup(e);
            // First time app is launched
            SplashScreen splashScreen = new SplashScreen("/images/splashscreen1.png");

            splashScreen.Show(true);
            app            = new App();
            app.StartupUri = new Uri("MainWindow.xaml", UriKind.Relative);
            app.Run();
            return(false);
        }
Пример #33
0
 protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
 {
     try
     {
         App app = new App();
         app.Run();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     return(false);
 }
Пример #34
0
        /// <summary>
        /// Handles the Startup event of the SingleInstanceController control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Microsoft.VisualBasic.ApplicationServices.StartupEventArgs"/> instance containing the event data.</param>
        private static void SingleInstanceController_Startup(object sender, StartupEventArgs e)
        {
            if (e.CommandLine.Count <= 0 || string.IsNullOrEmpty(e.CommandLine[0]))
            {
                return;
            }

            var extractedUrl = ProtocolHelper.ProccesArguments(e.CommandLine[0]);

            if (!string.IsNullOrEmpty(extractedUrl))
            {
                Clipboard.SetText(extractedUrl);
            }
        }
Пример #35
0
 protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
 {
     // First time app is launched
     app = new App();
     app.InitializeComponent();
     try
     {
         app.Run();
     }
     catch (Exception ex)
     {
     }
     return(false);
 }
Пример #36
0
 protected override bool OnStartup(StartupEventArgs eventArgs)
 {
     /* if no files opened from the Explorer, pose the open file dialog to get them, then open the lot */
     ICollection<string> filesToOpen = eventArgs.CommandLine.Count == 0 ?
         (ICollection<string>)FormController.Instance.FilesToOpen() :
         (ICollection<string>)eventArgs.CommandLine;
     if (filesToOpen != null) {
         MainForm = FormController.Instance.OpenFiles(filesToOpen);
         return base.OnStartup(eventArgs);
     }
     else
         /* user cancelled open dialog, so just quit */
         return false;
 }
Пример #37
0
        protected override bool OnStartup(VB.StartupEventArgs eventArgs)
        {
            app = new Application();
            var vmMain = new ViewModel.ApplicationViewModel();

            View.WindowMain winmain = new View.WindowMain()
            {
                //Title = "PFT v" + Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                DataContext = vmMain
            };

            app.Run(winmain);
            return(false);
        }
Пример #38
0
            protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
            {
                // First time app is launched

                //app = new SingleInstanceApplication();

                //app.Run();

                app = new MainForm();//改为自己的程序运行窗体

                Application.Run(app);

                return(false);
            }
        /// <summary>
        /// Overrides the OnStartup Method from Base.
        /// On first startup, creates a new Application and runs it.
        /// </summary>
        /// <returns>A System.Boolean that indicates if the application should continue starting up.</returns>
        protected override bool OnStartup(StartupEventArgs eventArgs)
        {
            try
            {
                //to use async/await
                InitializeStartup();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }

            return(false);
        }
 protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
 {
     try
     {
         string extension            = ".test";
         string title                = "TestApplication";
         string extensionDescription = "A Test Document";
         ExtensionRegisterHelper.SetFileAssociation(extension, title + "." + extensionDescription);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     return(false);
 }
Пример #41
0
 protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
 {
     //set acplay
     if (e.CommandLine.Count > 0)
     {
         string f = e.CommandLine[0].Trim('"');
         if (Regex.IsMatch(f, @"^\w:\\.+?\.acplay", RegexOptions.IgnoreCase))
         {
             AcPlayStartup.IsHandled = false;
             AcPlayStartup.FilePath  = f;
         }
     }
     Program.frmStart = new FormStart();
     Application.Run(Program.frmStart);
     return(false);
 }
Пример #42
0
        protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
        {
            // First time app is launched
            app = new App();
            app.DispatcherUnhandledException += (sender, args) =>
            {
                logger.Error(args.Exception, "程序崩溃");
            };

            AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
            {
                logger.Error(args.ExceptionObject as Exception, "程序崩溃");
            };

            app.Run();
            return(false);
        }
        protected override bool OnStartup(StartupEventArgs e)
        {
            _resetSplashCreated = new ManualResetEvent(false);
            _splashThread = new Thread(ShowSplash);
            _splashThread.SetApartmentState(ApartmentState.STA);
            _splashThread.IsBackground = true;
            _splashThread.Name = "Splash Screen";
            _splashThread.Start();

            _resetSplashCreated.WaitOne();

            _wpfApp = new App((IgnoreStartupURI) _splashWindow);
            _wpfApp.InitializeComponent();
            _wpfApp.Run();

            return false;
        }
Пример #44
0
        protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
        {
            var preCheck = true;

            if (OnPreCheckEvent != null)
            {
                preCheck = OnPreCheckEvent.Invoke();
            }

            if (preCheck)
            {
                _app = new Application();
                OnPreLoadEvent?.Invoke();
                _app.Run(_mainWindow);
                return(false);
            }
            return(false);
        }
Пример #45
0
        protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
        {
            // First time app is launched
            _app = new SingleInstanceApplication();
            _app.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown;

            var dataDirectory = ApplicationDeployment.IsNetworkDeployed ? ApplicationDeployment.CurrentDeployment.DataDirectory : "logs";

            var log4NetConfiguration = new Log4NetConfiguration("TRex.SmartClient", dataDirectory);

            log4NetConfiguration.Configure();

            AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
            TaskScheduler.UnobservedTaskException      += TaskSchedulerOnUnobservedTaskException;
            _app.Run();

            return(false);
        }
 /// <summary>
 /// 程序启动
 /// </summary>
 /// <param name="e"></param>
 /// <returns></returns>
 protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
 {
     try
     {
         if (WPFApplication != null)
         {
             WPFApplication.Run();
         }
         else if (MainWindow != null)
         {
             System.Windows.Forms.Application.Run(MainWindow);
         }
     }
     catch (Exception ex)
     {
         ex.ToString().WriteToLog("", log4net.Core.Level.Error);
         System.Windows.MessageBox.Show("系统异常,请联系管理员!", "提示信息", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error, System.Windows.MessageBoxResult.OK);
         System.Environment.Exit(System.Environment.ExitCode);
     }
     return(false);
 }
Пример #47
0
 protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
 {
     // First time _application is launched
     _commandLine = eventArgs.CommandLine;
     _application = new App();
     try
     {
         _application.Run();
     }
     catch (Exception ex)
     {
         while (ex.InnerException != null)
         {
             ex = ex.InnerException;
         }
         MessageBox.Show(Application.Current.MainWindow, ex.Message + Environment.NewLine + ex.StackTrace, "Serious problem occured - App may crash!", MessageBoxButton.OK, MessageBoxImage.Error);
         ((ServiceLocator.GetService <IMainWindow>() as Window1).DataContext as Main).ExitCommand.Execute(null);
         return(false);
     }
     ((ServiceLocator.GetService <IMainWindow>() as Window1).DataContext as Main).ExitCommand.Execute(null);
     return(false);
 }
Пример #48
0
        /// <summary>
        /// Invoked when the application starts.
        /// </summary>
        /// <param name="e">Contains the command-line arguments of the application and indicates whether the
        /// application startup should be canceled.</param>
        /// <returns>A value indicating whether the application should continue starting up.</returns>
        protected override bool OnStartup(StartupEventArgs e)
        {
            AppManager.Instance.Initialize();

            CommandLineArguments arguments = CommandLineArguments.Parse(e.CommandLine);
            if (arguments.ShouldShowUsage || arguments.HasParseError)
            {
                CommandLineArguments.ShowUsage(arguments.ParseErrorMessage);
                AppManager.Instance.Dispose();
                return false;
            }

            SetGlobalSettingsFromArguments(arguments);

            TimerWindow window = GetTimerWindowFromArguments(arguments);

            this.app = new App();
            this.app.Exit += AppExit;
            this.app.Run(window);

            return false;
        }
Пример #49
0
        /// <summary>
        /// Invoked when the application starts.
        /// </summary>
        /// <param name="e">Contains the command-line arguments of the application and indicates whether the
        /// application startup should be canceled.</param>
        /// <returns>A value indicating whether the application should continue starting up.</returns>
        protected override bool OnStartup(StartupEventArgs e)
        {
            AppManager.Instance.Initialize();

            CommandLineArguments arguments = CommandLineArguments.Parse(e.CommandLine);

            if (arguments.ShouldShowUsage || arguments.HasParseError)
            {
                CommandLineArguments.ShowUsage(arguments.ParseErrorMessage);
                AppManager.Instance.Dispose();
                return(false);
            }

            SetGlobalSettingsFromArguments(arguments);

            TimerWindow window = GetTimerWindowFromArguments(arguments);

            this.app       = new App();
            this.app.Exit += AppExit;
            this.app.Run(window);

            return(false);
        }
 protected override bool OnStartup(StartupEventArgs eventArgs)
 {
     _wpfApp = new App();
     _wpfApp.Run();
     return false;
 }
 protected override bool OnStartup( StartupEventArgs eventArgs )
 {
     // First time _application is launched
     _application.Start( );
     return false;
 }
Пример #52
0
        private void App_Startup(object sender, StartupEventArgs e)
        {
            // If /exit was passed on the command line, then just exit immediately
            foreach (string commandLineArg in Environment.GetCommandLineArgs())
            {
                if (commandLineArg.ToUpperInvariant() == "/EXIT")
                {
                    e.Cancel = true;
                    return;
                }
            }

            // Set up the application database and perform any required updates or cleanup
            if (!DatabaseInit.Startup())
            {
                e.Cancel = true;
                return;
            }
        }
        protected override bool OnStartup(StartupEventArgs e)
        {
            //XmlConfigurator.Configure();
            _callback = NativeMethods.TouchMouseCallbackFunction;
            // Set up callback with TouchMouseSensor DLL.
            TouchMouseSensorInterop.RegisterTouchMouseCallback(_callback);

            var strip = new ContextMenuStrip();
            var help = new ToolStripMenuItem("Help",
                                             Properties.Resources.help_browser,
                                             (sender, args) =>
                                             Help.ShowHelp(null, @"http://touchmousemate.codeplex.com"));
            var touchOverClick = new ToolStripMenuItem("Touch-over-click",
                                                         Properties.Resources.user_desktop,
                                                         (sender, args) =>
                                                             {
                                                                 var menu = (ToolStripMenuItem)sender;
                                                                 NativeMethods.Section.TouchOverClick = menu.Checked;
                                                                 NativeMethods.Config.Save();
                                                             }) { Checked = NativeMethods.Section.TouchOverClick, CheckOnClick = true }; 
            var middleClick = new ToolStripMenuItem("Middle-click",
                                                          Properties.Resources.start_here,
                                                          (sender, args) =>
                                                              {
                                                                  var menu = (ToolStripMenuItem)sender;
                                                                  NativeMethods.Section.MiddleClick = menu.Checked;
                                                                  NativeMethods.Config.Save();
                                                              }) {Checked = NativeMethods.Section.MiddleClick, CheckOnClick = true};
            var leftHand = new ToolStripMenuItem("Left-handed",
                                                 Properties.Resources.input_mouse,
                                                 (sender, args) =>
                                                     {
                                                         var menu = (ToolStripMenuItem)sender;
                                                         NativeMethods.Section.LeftHandMode = menu.Checked;
                                                         NativeMethods.Config.Save();
                                                     }) {Checked = NativeMethods.Section.LeftHandMode, CheckOnClick = true};
            var exit = new ToolStripMenuItem("Exit",
                                             Properties.Resources.system_log_out,
                                             (sender, args) =>
                                                 {
                                                     // Cancel callback with TouchMouseSensor DLL.
                                                     TouchMouseSensorInterop.
                                                         UnregisterTouchMouseCallback();
                                                     _icon.Visible = false;
                                                     Application.Exit();
                                                 });
            strip.Items.Add(middleClick);
            strip.Items.Add(touchOverClick);
            strip.Items.Add(leftHand);
            strip.Items.Add(help);
            strip.Items.Add(new ToolStripSeparator());
            strip.Items.Add(exit);
            //Published on November 23rd 2008 by Aston.
            //Released under the Free Art (copyleft) license.
            // Icon for Windows XP, Vista and 7.
            _icon = new NotifyIcon
                        {
                            Icon = Properties.Resources.mouse,
                            ContextMenuStrip = strip,
                            Visible = true
                        };
            _icon.ShowBalloonTip(5000, "Info", "Touch Mouse Mate has started", ToolTipIcon.Info);
            _icon.Text = string.Format("Touch Mouse Mate {0}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version);
            Application.Run();
            return false;
        }
Пример #54
0
			protected override bool OnStartup(StartupEventArgs args) {
				HandleCommandLine(args.CommandLine);
				return true;
			}
Пример #55
0
        private static void StartupHandler(object sender, StartupEventArgs e)
        {
            string appGuid = ((GuidAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(GuidAttribute), false).GetValue(0)).Value.ToString();

            using (Mutex mutex = new Mutex(false, appGuid)) // Required for installer
            {
                IsSilentRun = CLIHelper.CheckArgs(Arguments, "silent", "s");
                IsSandbox = CLIHelper.CheckArgs(Arguments, "sandbox");

                if (!IsSandbox)
                {
                    IsPortable = CLIHelper.CheckArgs(Arguments, "portable", "p");

                    if (IsPortable)
                    {
                        CustomPersonalPath = PortablePersonalPath;
                    }
                    else
                    {
                        CheckPersonalPathConfig();
                    }

                    if (!string.IsNullOrEmpty(PersonalPath) && !Directory.Exists(PersonalPath))
                    {
                        Directory.CreateDirectory(PersonalPath);
                    }
                }

                DebugHelper.WriteLine("{0} started", Title);
                DebugHelper.WriteLine("Operating system: " + Environment.OSVersion.VersionString);
                DebugHelper.WriteLine("Command line: " + Environment.CommandLine);
                DebugHelper.WriteLine("Personal path: " + PersonalPath);

                string gitHash = GetGitHash();
                if (!string.IsNullOrEmpty(gitHash))
                {
                    DebugHelper.WriteLine("Git: https://github.com/ShareX/ShareX/tree/" + gitHash);
                }

                SettingsResetEvent = new ManualResetEvent(false);
                UploaderSettingsResetEvent = new ManualResetEvent(false);
                HotkeySettingsResetEvent = new ManualResetEvent(false);
                TaskEx.Run(() => LoadSettings());

                DebugHelper.WriteLine("MainForm init started");
                MainForm = new MainForm();
                applicationBase.MainForm = MainForm;
                DebugHelper.WriteLine("MainForm init finished");

                if (Settings == null)
                {
                    SettingsResetEvent.WaitOne();
                }
            }
        }
Пример #56
0
 protected override bool OnStartup(VBStartupEventArgs e)
 {
     var app = new App();
     app.InitializeComponent();
     app.Run();
     return false;
 }
Пример #57
0
 protected override bool OnStartup(StartupEventArgs eventArgs)
 {
     Loader.Start();
     return false;
 }
Пример #58
0
 private void Form1_Startup(object sender, StartupEventArgs e)
 {
     AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(this.LoadDLLFromStream);
 }
Пример #59
0
 protected override bool OnStartup(StartupEventArgs e)
 {
     Application.Run(new AppContext());
     return false;
 }
Пример #60
0
        /// <summary>
        /// A normal (non-single-instance) application raises the Startup event every time it starts. 
        /// A single-instance application raises the Startup  event when it starts only if the application
        /// is not already active; otherwise, it raises the StartupNextInstance  event.
        /// </summary>
        /// <see cref="http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.applicationservices.windowsformsapplicationbase.startup.aspx"/>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ApplicationDidFinishLaunching(object sender, StartupEventArgs e)
        {
            Logger.debug("ApplicationDidFinishLaunching");
            CommandsAfterLaunch(CommandLineArgs);

            UpdateController.Instance.CheckForUpdatesIfNecessary();

            if (Preferences.instance().getBoolean("queue.openByDefault"))
            {
                TransferController.Instance.View.Show();
            }

            if (Preferences.instance().getBoolean("browser.serialize"))
            {
                _bc.Background(delegate { _sessions.load(); },
                               delegate
                                   {
                                       foreach (
                                           Host host in
                                               _sessions)
                                       {
                                           NewBrowser().Mount(host);
                                       }
                                       _sessions.clear();
                                   });
            }
            //Registering for Growl is an expensive operation. Takes up to 500ms on my machine.
            _bc.Background(delegate { ch.cyberduck.ui.growl.Growl.instance().register(); }, delegate { });

            // User bookmarks and thirdparty applications
            CountdownEvent cde = new CountdownEvent(2);

            _bc.Background(delegate
                               {
                                   BookmarkCollection c = BookmarkCollection.defaultCollection();
                                   c.load();
                                   cde.Signal();
                               }, delegate
                                      {
                                          if (Preferences.instance
                                              ().getBoolean(
                                                  "browser.openUntitled"))
                                          {
                                              if (
                                                  Browsers.Count ==
                                                  0)
                                              {
                                                  OpenDefaultBookmark
                                                      (NewBrowser());
                                              }
                                          }
                                      });
            _bc.Background(delegate { HistoryCollection.defaultCollection().load(); }, delegate { });
            _bc.Background(delegate { TransferCollection.defaultCollection().load(); }, delegate { });

            // Bonjour initialization);
            if (Preferences.instance().getBoolean("rendezvous.enable"))
            {
                try
                {
                    RendezvousFactory.instance().init();
                }
                catch (COMException)
                {
                    Logger.warn("No Bonjour support available");
                }
            }
            if (Preferences.instance().getBoolean("defaulthandler.reminder")
                && Preferences.instance().getInteger("uses") > 0)
            {
                if (!URLSchemeHandlerConfiguration.Instance.IsDefaultApplicationForFtp()
                    || !URLSchemeHandlerConfiguration.Instance.IsDefaultApplicationForSftp())
                {
                    _bc.CommandBox(
                        Locale.localizedString("Default Protocol Handler", "Preferences"),
                        Locale.localizedString("Set Cyberduck as default application for FTP and SFTP locations?",
                                               "Configuration"),
                        Locale.localizedString(
                            "As the default application, Cyberduck will open when you click on FTP or SFTP links in other applications, such as your web browser. You can change this setting in the Preferences later.",
                            "Configuration"),
                        String.Format("{0}|{1}",
                                      Locale.localizedString("Change", "Configuration"),
                                      Locale.localizedString("Cancel", "Configuration")),
                        false, Locale.localizedString("Don't ask again", "Configuration"), SysIcons.Question,
                        delegate(int option, bool verificationChecked)
                            {
                                if (verificationChecked)
                                {
                                    // Never show again.
                                    Preferences.instance().setProperty(
                                        "defaulthandler.reminder", false);
                                }
                                switch (option)
                                {
                                    case 0:
                                        URLSchemeHandlerConfiguration.Instance.
                                            RegisterFtpProtocol();
                                        URLSchemeHandlerConfiguration.Instance.
                                            RegisterSftpProtocol();
                                        break;
                                }
                            });
                }
            }
            // Import thirdparty bookmarks.
            IList<ThirdpartyBookmarkCollection> thirdpartyBookmarks = GetThirdpartyBookmarks();
            _bc.Background(delegate
                               {
                                   foreach (ThirdpartyBookmarkCollection c in thirdpartyBookmarks)
                                   {
                                       if (!Preferences.instance().getBoolean(c.getConfiguration()))
                                       {
                                           if (!c.isInstalled())
                                           {
                                               Logger.info("No application installed for " + c.getBundleIdentifier());
                                               continue;
                                           }
                                           c.load();
                                           if (c.isEmpty())
                                           {
                                               // Flag as imported
                                               Preferences.instance().setProperty(c.getConfiguration(), true);
                                           }
                                       }
                                   }
                               },
                           delegate
                               {
                                   foreach (ThirdpartyBookmarkCollection c in thirdpartyBookmarks)
                                   {
                                       if (!Preferences.instance().getBoolean(c.getConfiguration()))
                                       {
                                           if (!c.isEmpty())
                                           {
                                               ThirdpartyBookmarkCollection c1 = c;
                                               _bc.CommandBox(Locale.localizedString("Import", "Configuration"),
                                                              String.Format(
                                                                  Locale.localizedString("Import {0} Bookmarks",
                                                                                         "Configuration"), c.getName()),
                                                              String.Format(
                                                                  Locale.localizedString(
                                                                      "{0} bookmarks found. Do you want to add these to your bookmarks?",
                                                                      "Configuration"), c.size()),
                                                              String.Format("{0}",
                                                                            Locale.localizedString("Import",
                                                                                                   "Configuration")),
                                                              true,
                                                              Locale.localizedString("Don't ask again", "Configuration"),
                                                              SysIcons.Question,
                                                              delegate(int option, bool verificationChecked)
                                                                  {
                                                                      if (verificationChecked)
                                                                      {
                                                                          // Flag as imported
                                                                          Preferences.instance().setProperty(
                                                                              c1.getConfiguration(), true);
                                                                      }
                                                                      switch (option)
                                                                      {
                                                                          case 0:
                                                                              BookmarkCollection.defaultCollection().
                                                                                  addAll(c1);
                                                                              // Flag as imported
                                                                              Preferences.instance().setProperty(
                                                                                  c1.getConfiguration(), true);
                                                                              break;
                                                                      }
                                                                  });
                                           }
                                       }
                                   }
                                   cde.Signal();
                               });

            _bc.Background(delegate
                               {
                                   cde.Wait();
                                   BookmarkCollection c = BookmarkCollection.defaultCollection();
                                   if (c.isEmpty())
                                   {
                                       FolderBookmarkCollection defaults =
                                           new FolderBookmarkCollection(LocalFactory.createLocal(
                                               Preferences.instance().getProperty("application.bookmarks.path")
                                                                            ));
                                       defaults.load();
                                       foreach (Host bookmark in defaults)
                                       {
                                           if (Logger.isDebugEnabled())
                                           {
                                               Logger.debug("Adding default bookmark:" + bookmark);
                                           }
                                           c.add(bookmark);
                                       }
                                   }
                               }, delegate { });
        }