private static void SingleInstance_ArgsReceived(object sender, ArgumentsReceivedEventArgs e) { if (formMain == null) return; Action<string[]> UpdateForm = arguments => { // Issues #774, #855 : if IG is normal or maximized, do nothing. If IG is minimized, // restore it to previous state. if (formMain.WindowState == FormWindowState.Minimized) { ShowWindow(formMain.Handle, SW_RESTORE); } formMain.LoadFromParams(arguments); }; // KBR 20181009 Attempt to run a 2nd instance of IG when multi-instance turned off. Primary instance // will crash if no file provided (e.g. by double-clicking on .EXE in explorer). var realCount = 0; foreach (var arg in e.Args) { if (arg != null) { realCount++; } } var realArgs = new string[realCount]; Array.Copy(e.Args, realArgs, realCount); // Execute our delegate on the forms thread! formMain.Invoke(UpdateForm, (object)realArgs); // send our Win32 message to bring ImageGlass dialog to top NativeMethods.PostMessage((IntPtr)NativeMethods.HWND_BROADCAST, NativeMethods.WM_SHOWME, IntPtr.Zero, IntPtr.Zero); }
private static void SingleInstance_ArgumentsReceived(object sender, ArgumentsReceivedEventArgs e) { if (formMain == null) { return; } Action <String[]> UpdateForm = arguments => { formMain.WindowState = FormWindowState.Normal; formMain.LoadFromParams(arguments); }; // KBR 20181009 Attempt to run a 2d instance of IG when multi-instance turned off. Primary instance // will crash if no file provided (e.g. by double-clicking on .EXE in explorer). int realcount = 0; foreach (var arg in e.Args) { if (arg != null) { realcount++; } } string[] realargs = new string[realcount]; Array.Copy(e.Args, realargs, realcount); //Execute our delegate on the forms thread! formMain.Invoke(UpdateForm, (Object)realargs); // send our Win32 message to bring ImageGlass dialog to top NativeMethods.PostMessage((IntPtr)NativeMethods.HWND_BROADCAST, NativeMethods.WM_SHOWME, IntPtr.Zero, IntPtr.Zero); }
private void SingleInstance_ArgumentsReceived(object sender, ArgumentsReceivedEventArgs e) { if (e.Args.Contains(Constants.ParameterShow)) { Dispatcher?.InvokeAsync(() => { MainWindow?.ShowWindow(); }); } }
private static void Instance_ArgsReceived(object sender, ArgumentsReceivedEventArgs e) { if (formMain == null) { return; } Action <string[]> UpdateForm = args => { // activate form _ = formMain.ToggleAppVisibilityAsync(true); // load image file from arg formMain.LoadFromParams(args); }; // KBR 20181009 Attempt to run a 2nd instance of IG when multi-instance turned off. // Primary instance will crash if no file provided // (e.g. by double-clicking on .EXE in explorer). var realCount = 0; foreach (var arg in e.Args) { if (arg != null) { realCount++; } } var realArgs = new string[realCount]; Array.Copy(e.Args, realArgs, realCount); // Execute our delegate on the forms thread! formMain.Invoke(UpdateForm, (object)realArgs); }
private static void SingleInstance_ArgumentsReceived(object sender, ArgumentsReceivedEventArgs e) { if (e.Args.Contains(@"--show")) { MessageBox.Show(I18N.GetString("Find Shadowsocks icon in your notify tray.") + Environment.NewLine + I18N.GetString("If you want to start multiple Shadowsocks, make a copy in another directory."), I18N.GetString("ShadowsocksR is already running."), MessageBoxButton.OK, MessageBoxImage.Information); } }
public static void SingleInstanceArgumentsReceived(object sender, ArgumentsReceivedEventArgs e) { //if (ClientManager.Instance != null) //{ // ClientManager.Instance.RunCommands(e.Args); //} }
private void Mutex_ArgumentsReceived(object sender, ArgumentsReceivedEventArgs e) { var form = (Application?.MainWindow as WinWindow)?.Form; if (form != null) { form.SafeInvoke(() => ProcessCommandlineShortcut(e.Args)); } }
/// <summary> /// Process arguments past with app execution /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void singleInstance_ArgumentsReceived(object sender, ArgumentsReceivedEventArgs e) { foreach (String arg in e.Args) { //if arguments include OpenSettings open SettingsBox if (arg == "OpenSettings") { settingsBox.ShowDialog(); } } }
/// <summary> /// Attempting to run a second copy of the program /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void singleInstance_ArgumentsReceived(object _, ArgumentsReceivedEventArgs e) { try { if (_mw != null) { _mw.Invoke((MethodInvoker) delegate { _mw.notifyIcon1_MouseDoubleClick(null, null); }); _mw.Invoke((MethodInvoker) delegate { _mw.Activate(); }); } } catch (Exception ex) { ExceptionReporter.ReportException(ex, "singleInstance_ArgumentsReceived"); } }
/// <summary> /// Attempting to run a second copy of the program /// </summary> private static void singleInstance_ArgumentsReceived(object _, ArgumentsReceivedEventArgs e) { try { if (_mw != null) { _mw.Invoke((MethodInvoker) delegate { _mw.Activate(); }); } } catch (Exception ex) { Logger.Warn(ex.Message, ex); } }
private static void SingleInstance_ArgumentsReceived(object sender, ArgumentsReceivedEventArgs e) { if (e.Args.Contains(Constants.ParameterMultiplyInstance)) { MessageBox.Show(I18NUtil.GetAppStringValue(@"SuccessiveInstancesMessage1") + Environment.NewLine + I18NUtil.GetAppStringValue(@"SuccessiveInstancesMessage2"), I18NUtil.GetAppStringValue(@"SuccessiveInstancesCaption"), MessageBoxButton.OK, MessageBoxImage.Information); } Application.Current.Dispatcher?.Invoke(() => { _viewController.ImportAddress(string.Join(Environment.NewLine, e.Args)); }); }
/// <summary> /// Attempting to run a second copy of the program /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void singleInstance_ArgumentsReceived(object _, ArgumentsReceivedEventArgs e) { try { if (_mw != null) { Action <string[]> restoreWindow = arguments => { _mw.WindowState = FormWindowState.Normal; _mw.Activate(); }; _mw.Invoke(restoreWindow); } } catch (Exception ex) { ExceptionReporter.ReportException(ex, "singleInstance_ArgumentsReceived"); } }
private static void singleInstance_ArgumentsReceived(object sender, ArgumentsReceivedEventArgs e) { if (form == null) { return; } Action <String[]> updateForm = arguments => { form.WindowState = FormWindowState.Normal; // form.OpenFiles(arguments); //downloader.SFMLabURL = arguments[1].ToString().Remove(0,5); downloader.Download(arguments[1].ToString().Remove(0, 5)); }; form.Invoke(updateForm, (Object)e.Args); //Execute our delegate on the forms thread! }
private static void SingleInstance_ArgumentsReceived(object sender, ArgumentsReceivedEventArgs e) { if (formMain == null) { return; } Action <String[]> updateForm = arguments => { formMain.WindowState = FormWindowState.Normal; formMain.LoadFromParams(arguments); }; //Execute our delegate on the forms thread! formMain.Invoke(updateForm, (Object)e.Args); // send our Win32 message to bring ImageGlass dialog to top NativeMethods.PostMessage((IntPtr)NativeMethods.HWND_BROADCAST, NativeMethods.WM_SHOWME, IntPtr.Zero, IntPtr.Zero); }
/// <summary> /// Event treatment of singleInstance.ArgumentsReceived /// Send the arguments to form frmExplorer /// </summary> /// <param name="sender"></param> /// <param name="e"></param> static void SingleInstance_ArgumentsReceived(object sender, ArgumentsReceivedEventArgs e) { form = GetForm <frmExplorer>(); if (form == null) { return; } try { Action <String[]> updateForm = arguments => { form.WindowState = FormWindowState.Normal; form.UseNewArguments(arguments); }; form.Invoke(updateForm, (Object)e.Args); //Execute our delegate on the forms thread! } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private static async void OnSingleInstanceArgumentsReceived(object sender, ArgumentsReceivedEventArgs e) { await Process(e.Args); }
public static void SingleInstanceArgumentsReceived(object sender, ArgumentsReceivedEventArgs e) { }
private static void Instance_ArgumentsReceived(object sender, ArgumentsReceivedEventArgs e) { TryProcessAccount(e.Args); }