protected override void OnStartup(StartupEventArgs e) { var isDebugMode = false; var args = Environment.GetCommandLineArgs(); if (args.Length > 1 && args[1] == "--debug") { isDebugMode = true; } #if DEBUG isDebugMode = true; if (Debugger.IsAttached) { isDebugMode = false; } #endif if (isDebugMode) { Win32API.AllocConsole(); Console.WriteLine("[DEBUG]Debug mode enabled."); Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); } Trace.WriteLine("[DEBUG]Application Start."); ITunesWatcher.CreateWatcherTask(); base.OnStartup(e); }
private void OnQuittingEvent() { isITunesInitialized = false; //wait until itunes exits. while (true) { if (!Process.GetProcessesByName("iTunes").Any()) { Trace.WriteLine("[DEBUG]itunes quit ok."); ITunesWatcher.CreateWatcherTask(); return; } Thread.Sleep(1000); } }
protected override void OnStartup(StartupEventArgs e) { ITunesWatcher.CreateWatcherTask(); base.OnStartup(e); }