protected override void OnStartup(StartupEventArgs e) { _cancelStartUp = false; this.UIServices = new WindowUIServices(); var processes = Process.GetProcessesByName("WatchHistory"); if (processes.Length > 1) { if (this.UIServices.ShowMessageBox("There's already an instance running. If you start another one, you could invalidate your cache. Continue?" , "Continue?", Buttons.YesNo, Icon.Error) == Result.No) { _cancelStartUp = true; this.Shutdown(0); return; } } this.IOServices = new IOServices(); var clipboardServices = new WindowClipboardServices(); AppDomain.CurrentDomain.UnhandledException += this.OnUnhandledException; (new DataUpgrader(this.IOServices)).Upgrade(); Environment.Init(this.IOServices); this.DataManager = new DataManager(Environment.SettingsFile, Environment.DataFile, this.IOServices); var youtubeManager = new AddYoutubeLink.Implementations.YoutubeManager(); var windowFactory = new WindowFactory(this.IOServices, this.UIServices, clipboardServices, this.DataManager, youtubeManager); windowFactory.OpenSelectUserWindow(); }