private void Application_Startup(object sender, StartupEventArgs e) { try { Current.StartLog(); "------------------------ Application Starting now... ------------------------".NOTICE(); NBug.Settings.Destinations.Add(new NBug.Core.Submission.Custom.Custom()); NBug.Settings.CustomSubmissionEvent += Settings_CustomSubmissionEvent; //add handler on application load AppDomain.CurrentDomain.UnhandledException += NBug.Handler.UnhandledException; Current.DispatcherUnhandledException += NBug.Handler.DispatcherUnhandledException; Current.InitAppWatcher(Current.GetRoot()); Current.BindingHotkeys(); } catch (Exception ex) { ex.Message.ShowMessageBox("ERROR"); } finally { var setting = this.LoadSetting(true); if (setting.SingleInstance && Current.Activate()) { var checkinstance = true; if (e.Args.Length > 0) { foreach (var arg in e.Args) { var param = new string[] { "nocheckinstance", "restart" }; if (param.Contains(arg.Trim('"').ToLower())) { checkinstance = false; break; } } } if (checkinstance) { Current.Shutdown(-1); } } } }
public IInterfaceContent Activate(string name, params string[] arguments) { if (!content.ContainsKey(name)) { throw new ArgumentException("Interface Content '" + name + "' not registered"); } if (Current != null) { Current.Deactivate(); } Current = content[name]; Current.Activate(arguments); if (ContentChanged != null) { ContentChanged(this, new ReferenceArgs <IInterfaceContent>(Current)); } return(Current); }