Exemplo n.º 1
0
        protected override async void OnStartup(StartupEventArgs e)
        {
            var first = await ApplicationActivator.LaunchOrReturnAsync(
                otherInstance => { MessageBox.Show("got data"); });

            if (!first)
            {
                Shutdown();
            }

            base.OnStartup(e);
        }
Exemplo n.º 2
0
        static async Task Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var first = await ApplicationActivator.LaunchOrReturnAsync(otherInstance =>
            {
                MessageBox.Show("got data: " + otherInstance.Skip(1).FirstOrDefault());
            });

            if (!first)
            {
                return;
            }
            Application.Run(new Form1());
        }