Example #1
0
 protected override void OnStartupNextInstance(Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs eventArgs)
 {
     if (eventArgs.CommandLine.Count > 0)
     {
         _app.OpenBasedOnArguments(new WarwolfStartupEventArgs(eventArgs));
     }
 }
 // Direct multiple instances.
 protected override void OnStartupNextInstance(Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs e)
 {
     if (e.CommandLine.Count > 0)
     {
         app.NewStartRequest(e.CommandLine);
     }
 }
Example #3
0
 // Direct multiple instances
 protected override void OnStartupNextInstance(
     Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs e)
 {
     if (e.CommandLine.Count > 0)
     {
         app.ProcessMessage(e.CommandLine[0]);
     }
 }
Example #4
0
        protected override void OnStartupNextInstance(Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs eventArgs)
        {
            base.OnStartupNextInstance(eventArgs);

            _loginIDs.Add(Guid.NewGuid().ToString());
            System.Windows.MessageBox.Show(_loginIDs.Count.ToString());
            //app.Activate();
        }
Example #5
0
 // Direct multiple instances
 protected override void OnStartupNextInstance(
     Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs e)
 {
     if (e.CommandLine.Count > 0)
     {
         ((MainWindow)app.MainWindow).openFile(e.CommandLine[0]);
     }
 }
Example #6
0
        // Direct multiple instance
        //当另一个应用程序实例启动时触发的OnStartupNextInstance()方法。该方法提供了访问命令行参数的功能。此时,可调用WPF应用程序类中的方法来显示新的窗口,
        //但不创建另一个应用程序对象
        protected override void OnStartupNextInstance(Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs eventArgs)
        {
            base.OnStartupNextInstance(eventArgs);

            if (eventArgs.CommandLine.Count > 0)
            {
                app.ShowDocument(eventArgs.CommandLine[0]);
            }
        }
Example #7
0
        /// <summary>
        /// Simply activates the first instance and opens all files passed as command arguments
        /// </summary>
        protected override void OnStartupNextInstance(Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs eventArgs)
        {
            IDEManager.Instance.MainWindow.Activate();

            foreach (var s in eventArgs.CommandLine)
            {
                IDEManager.Instance.OpenFile(s);
            }
        }
Example #8
0
 /// <summary>
 /// Gets called when subsequent application launches occur.  The subsequent app launch will result in this function getting called
 /// and then the subsequent instances will just exit.  You might use this method to open the requested doc, or whatever
 /// </summary>
 /// <param name="eventArgs"></param>
 protected override void OnStartupNextInstance(Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs eventArgs)
 {
     base.OnStartupNextInstance(eventArgs);
     eventArgs.BringToForeground = true;
     if (eventArgs.CommandLine.Count > 0)
     {
         (this.MainForm as BSABrowser).OpenArchive(eventArgs.CommandLine[0], true);
     }
 }
Example #9
0
        protected override void OnStartupNextInstance(Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs e)
        {
            app.MainWindow?.ShowOnTop();
            var deepLink = e.CommandLine.FirstOrDefault();

            if (deepLink != null && deepLink.StartsWith(DeepLinkProtocolInstaller.StartupUri))
            {
                (app.MainWindow as MainWindow)?.ProcessStartupUri(deepLink);
            }
        }
Example #10
0
        protected override void OnStartupNextInstance(Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs eventArgs)
        {
            System.Collections.ObjectModel.ReadOnlyCollection <string> argsCollection = eventArgs.CommandLine;
            int count = argsCollection.Count - 1;

            string[] args = new string[count];
            for (int i = 0; i < count; ++i)
            {
                args[i] = argsCollection[i + 1];
            }
            App.OnStartupNextInstance(args);
        }
Example #11
0
        // Direct multiple instances.
        protected override void OnStartupNextInstance(
            Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs e)
        {
            if (e.CommandLine.Count > 0)
            {
                String[] cmdLine = new string[1];
                cmdLine[0]      = e.CommandLine[0];
                app.commandLine = cmdLine;
            }

            SingleInstance.MainWindow wnd = (SingleInstance.MainWindow)app.MainWindow;
            wnd.addWindow();
        }
Example #12
0
        private void App_StartupNextInstance(object sender, Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs e)
        {
            Logger.Append("Sending data to other instance");

            string[] args = new string[e.CommandLine.Count];
            e.CommandLine.CopyTo(args, 0);

            object[] parameters = new object[1];
            parameters[0] = args;

            this.MainForm.Invoke(
                new Form1.ProcessArgumentsDelegate(((Form1)this.MainForm).ProcessArguments)
                , parameters
                );
        }
Example #13
0
        // Метод срабатывает при последующих запусках приложения.
        protected override void OnStartupNextInstance(Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs eventArgs)
        {
            //if (eventArgs.CommandLine.Count > 0)
            //{
            //    (Application.Current.MainWindow as MainWindow).ShowFileText(eventArgs.CommandLine[0]);
            //}
            //Application.Current.MainWindow.Activate();

            //Application.Current.Windows.OfType<Window>().SingleOrDefault(x => x.IsActive).Topmost = true;

            foreach (Window window in Application.Current.Windows)
            {
                if (window.IsVisible == true)
                {
                    window.WindowState = WindowState.Normal;
                    window.Topmost     = true;
                    window.Topmost     = false;
                    return;
                }
            }
        }
Example #14
0
 protected override void OnStartupNextInstance(Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs eventArgs)
 {
     //此处的操作是用户在已经有一个当前的程序进程运行时又启动了一个这个进程时执行的代码,单实例运行时此处应为空
     return;
 }
Example #15
0
            private void SingleInstanceController_StartupNextInstance(object sender, Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs e)
            {
                var mainForm = MainForm as Forms.MainForm;

                mainForm.RestoreFromTray();
            }
Example #16
0
 protected override void OnStartupNextInstance(Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs eventArgs)
 {
     app.MainWindow.Activate();
     return;
 }
Example #17
0
 protected override void OnStartupNextInstance(Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs e)
 {
     app.MainWindow?.ShowOnTop();
 }
Example #18
0
 /// <summary>
 /// 再次打开调这个方法
 /// </summary>
 /// <param name="e"></param>
 protected override void OnStartupNextInstance(Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs e)
 {
     // 当用户试图再次打开这个程序的时候,激活已有的系统
     base.OnStartupNextInstance(e);
     app.Activate();
 }
Example #19
0
        //重写新增程序时的响应事件
        protected override void OnStartupNextInstance(Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs eventArgs)
        {
            base.OnStartupNextInstance(eventArgs);

            app.showWindow();
        }