protected override void OnStartup(StartupEventArgs e) { MainForm = _queuedTablatureFile != null ? new MainForm(_queuedTablatureFile, _queuedFileInfo) : new MainForm(); MainForm.Visible = false; MainForm.Closed += (s, ev) => Stop(); base.OnStartup(e); }
void Application_Startup(object sender,StartupEventArgs e) { for(int i = 0;i != e.Args.Length;++i) { if(e.Args[i].Split('=')[0].ToLower() == "/u") { string guid = e.Args[i].Split('=')[1]; string path = Environment.GetFolderPath(Environment.SpecialFolder.System); ProcessStartInfo uninstallProcess = new ProcessStartInfo(path+"\\msiexec.exe","/x "+guid); Process.Start(uninstallProcess); System.Windows.Application.Current.Shutdown(); } } }
protected override void OnStartupNextInstance(StartupEventArgs e) { if (e.CommandLineArguments.Count > 0) { ProcessFirstArgForFile(e.CommandLineArguments[0]); if (_queuedTablatureFile != null) { TablatureViewForm.GetInstance(MainForm).LoadTablature(_queuedTablatureFile, _queuedFileInfo); } } base.OnStartupNextInstance(e); }
protected override bool OnStartup(StartupEventArgs e) { app = new App(); if (e.CommandLine != null && e.CommandLine.Count != 0) { if (System.IO.Directory.Exists(e.CommandLine[0])) { app.SettingDirectory = e.CommandLine[0]; } } app.InitializeComponent(); app.Run(); return false; }
/// <summary> /// Is called once the application has started. /// </summary> /// <param name="e">The event arguments that contain more information about the application startup.</param> protected override async void OnStartup(StartupEventArgs e) { // Calls the base implementation of this method base.OnStartup(e); // Signs up for the unhandled exception event, which is raised when an exception was thrown, which was not handled by user-code AppDomain.CurrentDomain.UnhandledException += async (sender, eventArguments) => await this.OnUnhandledExceptionAsync(eventArguments); // Determines whether this application instance is the first instance of the application or whether another instance is already running (this can be used to force the application to be a single instance application) bool isFirstApplicationInstance; Mutex mutex = new Mutex(true, Assembly.GetExecutingAssembly().FullName, out isFirstApplicationInstance); // If this is the first instance of the application, the mutex is set and stored, so that it can be disposed of when this instance closes if (isFirstApplicationInstance) this.singleInstanceMutex = mutex; // Calls the on started method where the user is able to call his own code to set up the application await this.OnStartedAsync(new ApplicationStartedEventArgs(e.Args, isFirstApplicationInstance)); }
void Application_Startup(object sender, StartupEventArgs e) { HtmlPage.RegisterScriptableObject("ASAP", this); string filename; if (e.InitParams.TryGetValue("file", out filename)) { string s; int song = -1; if (e.InitParams.TryGetValue("song", out s)) song = int.Parse(s, CultureInfo.InvariantCulture); Play(filename, song); } }
protected virtual void OnStartup(StartupEventArgs e) { _fileSystemWatcher.EnableRaisingEvents = false; WriteInstanceStatus(new InstanceStatus(Process.GetCurrentProcess().Id, e.CommandLineArguments)); _fileSystemWatcher.EnableRaisingEvents = true; Application.Run(MainForm); }
private void Application_Startup(object sender, StartupEventArgs e) { this.RootVisual = new MainPage(); }
protected override void OnStartup(StartupEventArgs e) { //StaticConnectionString.Instance.ConnectionString = // ConfigurationManager.ConnectionStrings["membershipConnectionString"].ConnectionString; }
void AppStartup(object sender, StartupEventArgs args) { Window1 mainWindow = new Window1(); mainWindow.Show(); }
private static void Application_Startup(object sender, StartupEventArgs e) { Logging.Info("---Application_Startup"); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var mw = new MainWindow(); mw.ShowDialog(); }
protected override void OnStartup(StartupEventArgs e) { ContainerConfigurator.Kernel.Get <MainWindow>().ShowDialog(); }
protected override void OnStartup(StartupEventArgs e) { IocKernel.Initialize(new IocConfiguration()); LogVersions(); base.OnStartup(e); }
protected override void OnStartup(StartupEventArgs e) { var key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v4.0", false); if (key == null) // || Util.Parse<int>(key.GetValue("ServicePackLevel")) < 2) { throw new Exception(Labels.AppRequiresSql); } key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Office"); bool found = false; if (key != null) { string[] versions = key.GetSubKeyNames().Where(v => Util.Parse <double>(v) >= 10).ToArray(); foreach (string v in versions) { key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Office\" + v + @"\PowerPoint\InstallRoot", false); if (key != null && !String.IsNullOrEmpty(key.GetValue("Path") as string)) { found = true; } } } if (!found) { key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Office"); if (key == null) { throw new Exception(Labels.AppRequiresOffice); } string[] versions = key.GetSubKeyNames().Where(v => Util.Parse <double>(v) >= 10).ToArray(); foreach (string v in versions) { key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Office\" + v + @"\PowerPoint\InstallRoot", false); if (key != null && !String.IsNullOrEmpty(key.GetValue("Path") as string)) { found = true; } } } if (!found) { throw new Exception(Labels.AppRequiresOffice); } Config.FontSize = Util.Parse <double?>(ConfigurationManager.AppSettings["FontSize"]) ?? SystemFonts.MessageFontSize; base.OnStartup(e); //accessing database causes 3 or 4 sec delay so place in background thread, useful preloading for when planner is opened new Action(() => { //determine if it's a new installation by whether there are any schedules loaded or not //if Presenter 0.9.9, will be running sql compact 3.5 that will need to be upgraded to 4.0 bool isnew = true; try { isnew = !Schedule.LoadSchedules().Any(); } catch (Exception ex) { if (ex.GetBaseException().Message == "The database file has been created by an earlier version of SQL Server Compact. Please upgrade using SqlCeEngine.Upgrade() method.") { var engine = new System.Data.SqlServerCe.SqlCeEngine(ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ConnectionString); engine.Upgrade(); engine.Compact(null); isnew = !Schedule.LoadSchedules().Any(); } else { throw ex; } } //gives warning that videos won't work without WMP10, not a requirement so only display if a new installation if (isnew) { key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\MediaPlayer\PlayerUpgrade", false); if (key == null || Util.Parse <int>((key.GetValue("PlayerVersion") ?? "").ToString().Split(',').FirstOrDefault()) < 10) { if (!Application.Current.Dispatcher.CheckAccess()) { Application.Current.Dispatcher.Invoke(new Action(() => { MessageBox.Show(MainWindow, Labels.AppRequiresWMP, "", MessageBoxButton.OK, MessageBoxImage.Exclamation); })); } } } }).BeginInvoke(null, null); }
private void Application_Startup(object sender, StartupEventArgs e) { MainWindow = new MainWindow(); MainWindow.Show(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); LoggingConfiguration.ConfigureLogging(); }
private void App_Startup(object sender, StartupEventArgs e) { this.StartupUri = new Uri(@"pack://application:,,,/Microsoft.Expression.Prototyping.Runtime;Component/WPF/Workspace/PlayerWindow.xaml"); }
private void Application_Startup(object sender, StartupEventArgs e) { DispatcherHelper.UIDispatcher = Dispatcher; SQLiteQuery.SetConnectionString($"Data Source={this.SQLiteDbPath};"); //AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); }
protected override void OnStartup(StartupEventArgs e) { CheckAlreadyRunning(); base.OnStartup(e); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); LifecycleObserver.NotifyStartup(e.Args); }
protected override void OnStartup(StartupEventArgs startupEventArgs) { SetDarkMode(Settings.Default.DarkMode); }
private void Application_Startup(object sender, StartupEventArgs e) { ParseInputs(e); ProcessInputs(); }
void App_Startup(object sender, StartupEventArgs e) { //Here if called from XAML, otherwise, this code can be in App() AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException; // Example 1 AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; // Example 3 }
private void Application_Startup(object sender, StartupEventArgs e) { DispatcherHelper.UIDispatcher = Dispatcher; //AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); }
protected override void OnStartup(StartupEventArgs e) { Modern.App.Run(InstanceType.Alpha, Resources); }
private void Application_Startup(object sender, StartupEventArgs e) { }
private void Application_Startup(object sender, StartupEventArgs e) { string[] args = System.Environment.GetCommandLineArgs(); string filePath = args[0]; }
private void App_Startup(object sender, StartupEventArgs e) { DispatcherHelper.Initialize(); }
protected override void OnStartup(object sender, StartupEventArgs e) { Application.ShutdownMode = ShutdownMode.OnMainWindowClose; DisplayRootViewFor <MainViewModel>(); }
protected virtual void OnStartupNextInstance(StartupEventArgs e) { }
private async void Application_Startup(object sender, StartupEventArgs e) { if (Config.local.showloadingscreen) { splash = new Views.SplashScreen(); splash.Show(); splash.BusyContent = "Loading main window"; } AutomationHelper.syncContext = System.Threading.SynchronizationContext.Current; System.Threading.Thread.CurrentThread.Name = "UIThread"; if (!Config.local.isagent) { if (!Config.local.showloadingscreen) { notifyIcon.Visible = true; } } else { notifyIcon.Visible = true; } if (Config.local.files_pending_deletion.Length > 0) { bool sucess = true; foreach (var f in Config.local.files_pending_deletion) { try { if (System.IO.File.Exists(f)) { System.IO.File.Delete(f); } } catch (Exception ex) { sucess = false; Log.Error(ex.ToString()); } } if (sucess) { Config.local.files_pending_deletion = new string[] { }; Config.Save(); } } RobotInstance.instance.Status += App_Status; Input.InputDriver.Instance.initCancelKey(Config.local.cancelkey); await Task.Run(async() => { try { if (Config.local.showloadingscreen) { splash.BusyContent = "loading plugins"; } // Plugins.LoadPlugins(RobotInstance.instance, Interfaces.Extensions.ProjectsDirectory); Plugins.LoadPlugins(RobotInstance.instance, Interfaces.Extensions.PluginsDirectory, false); if (Config.local.showloadingscreen) { splash.BusyContent = "Initialize main window"; } await RobotInstance.instance.init(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); CreateAndShowMainWindow(); }
public virtual void Invoke(object sender, StartupEventArgs e) { }
protected override void OnStartup(StartupEventArgs e) { (Resources["IDEState"] as IDEState).LoadConfiguration(); base.OnStartup(e); }
void Application_Startup(object sender, StartupEventArgs e) { this.RootVisual = this.MediaElement; this.MediaElement.Volume = 1; this.MediaElement.AutoPlay = true; this.MediaElement.MediaEnded += MediaElement_MediaEnded; HtmlPage.RegisterScriptableObject("ASAP", this); string filename; if (e.InitParams.TryGetValue("file", out filename)) { string s; int song = -1; if (e.InitParams.TryGetValue("song", out s)) song = int.Parse(s, CultureInfo.InvariantCulture); Play(filename, song); } }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); AutoGeneratedBaseCollection(); GetAllTopicFromSetting(); }
protected override void OnStartup(StartupEventArgs e) { Arguments = e.Args; base.OnStartup(e); }
// Methods public virtual System.IAsyncResult BeginInvoke(object sender, StartupEventArgs e, System.AsyncCallback DelegateCallback, object DelegateAsyncState) { }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); ObjectBase.Container = AutoFacLoader.Init(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); }
protected override void OnStartup(StartupEventArgs e) { List <Arg> args = ProcessArgs(e.Args); StartMinimized = args.Any(a => a.Type == ArgType.Minimized); _silent = args.Any(a => a.Type == ArgType.Silent); var arg = args.FirstOrDefault(a => a.Type == ArgType.Send); if (arg != null) { AttachConsole(-1); PrintHeader(); string[] cmds = arg.Param.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); var sys = SbmqSystem.Create(); try { foreach (var cmd in cmds) { var itm = sys.SavedCommands.Items.FirstOrDefault(c => c.DisplayName == cmd); if (itm != null) { Out(string.Format("Sending Command '{0}'...", cmd)); sys.SendCommand(itm.SentCommand.Server, itm.SentCommand.Queue, itm.SentCommand.Command); } else { Out(string.Format("No Command with name '{0}' found, exiting...", cmd)); } } } finally { sys.Manager.Terminate(); } Application.Current.Shutdown(0); return; } if (args.Where(a => a.Type != ArgType.Minimized).Count() > 0) { AttachConsole(-1); PrintHeader(); PrintHelp(); Application.Current.Shutdown(0); return; } // Check if we are already running... Process currProc = Process.GetCurrentProcess(); Process existProc = Process.GetProcessesByName(currProc.ProcessName).Where(p => p.Id != currProc.Id).FirstOrDefault(); if (existProc != null) { try { // Show the already started SBMQM WindowTools.EnumWindows(new WindowTools.EnumWindowsProc((hwnd, lparam) => { uint procId; WindowTools.GetWindowThreadProcessId(hwnd, out procId); if (procId == existProc.Id) { if (WindowTools.SendMessage(hwnd, ServiceBusMQManager.MainWindow.WM_SHOWWINDOW, 0, 0) == 1) { return(false); } } return(true); }), 0); } finally { Application.Current.Shutdown(); } return; } base.OnStartup(e); }
private void Application_Startup(object sender, StartupEventArgs e) { InitNavigationConfigurationInThisAssembly(); }
protected override void OnStartup(object sender, StartupEventArgs e) { DisplayRootViewFor <ShellViewModel>(); }
protected override void OnStartup(StartupEventArgs e) { InitNavigationConfigurationInThisAssembly(); base.OnStartup(e); }
/// <summary> /// Override this to add custom behavior to execute after the application starts. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The args.</param> protected override void OnStartup(Object sender, StartupEventArgs e) { DisplayRootViewFor <IShell>(); }