private void OnStartupNextInstance(object sender, StartupNextInstanceEventArgs e) { // Catch with args and forward a message with them if (e.Args.Length > 0) { this.CatchAndForwardArgs(e.Args); } }
/// <summary> /// Called on next application instance startup. /// </summary> /// <param name = "args">The parameters used to run the next instance of the application.</param> private void OnStartupNextApplicationInstance(string[] args) { var e = new StartupNextInstanceEventArgs(args, true); OnStartupNextInstance(e); if (e.BringToForeground && (MainWindow != null)) { (new UIPermission(UIPermissionWindow.AllWindows)).Assert(); if (MainWindow.WindowState == WindowState.Minimized) MainWindow.WindowState = WindowState.Normal; MainWindow.Activate(); CodeAccessPermission.RevertAssert(); } }
/// <summary> /// Raises the <see cref = "Custom.Windows.InstanceAwareApplication.StartupNextInstance" /> event. /// </summary> /// <param name = "e">The <see cref = "Custom.Windows.StartupNextInstanceEventArgs" /> instance containing the event data.</param> protected virtual void OnStartupNextInstance(StartupNextInstanceEventArgs e) { StartupNextInstanceEventHandler startupNextInstanceEvent = StartupNextInstance; if (startupNextInstanceEvent != null) startupNextInstanceEvent(this, e); }
/// <summary> /// Raises the <see cref="Custom.Windows.InstanceAwareApplication.StartupNextInstance"/> event. /// </summary> /// <param name="e">The <see cref="Custom.Windows.StartupNextInstanceEventArgs"/> instance containing the event data.</param> protected override void OnStartupNextInstance(StartupNextInstanceEventArgs e) { e.BringToForeground = false; if (e.Args.Length > 0) { db = new Database(); AddCallFromArgs(e.Args); Window1 w = (Window1)App.Current.MainWindow; w.DataContext = new CallViewModel(); } base.OnStartupNextInstance(e); // //string message = "Another instance of this application was started"; //const string title = "TestApplication - First instance"; //if (e.Args.Length > 0) // message += Environment.NewLine + "args:" + Environment.NewLine + EnumerableToString(e.Args); //if (window != null) // MessageBox.Show(window, message, title); //else // MessageBox.Show(message, title); }