protected override void OnStartup(StartupEventArgs e) { // Register Activator and COM server ActivatorHelper.RegisterActivator <NotificationActivator>(); ActivatorHelper.RegisterComServer(typeof(NotificationActivator), Process.GetCurrentProcess().MainModule.FileName); if (e.Args.Length > 0) { // If "-Embedding" argument is appended, it will mean this application is started by COM. if (e.Args.Contains("-Embedding")) { Logger.Info("Started by COM"); } else { if (e.Args.Length == 0) { Console.WriteLine("No args provided.\n"); } else { var toastModel = new ToastModel(); for (int i = 0; i < e.Args.Length; i++) { switch (e.Args[i]) { case "-t": if (i + 1 < e.Args.Length) { toastModel.Title = e.Args[i + 1]; } else { Console.WriteLine( @"Missing argument to -t. Supply argument as -t ""bold title string"""); Environment.Exit(-1); } break; case "-b": if (i + 1 < e.Args.Length) { toastModel.Body = e.Args[i + 1]; } break; case "-p": if (i + 1 < e.Args.Length) { toastModel.ImagePath = e.Args[i + 1]; } else { Console.WriteLine( "Missing argument to -p.\n Supply argument as -p \"image path\"\n"); Environment.Exit(-1); } break; case "-silent": toastModel.Silent = true; break; //case "-w": // //wait = true; // break; default: break; } } // Pop Toast ToastService.ShowInteractiveToast(toastModel, AppId); // base.OnStartup(e); Application.Current.Shutdown(); } } } }