private async void OpenCurrentView(string directoryPath) { Debug.Assert(currentView == null); WatcherView view = new WatcherView(); view.Name = "view"; view.Dock = DockStyle.Fill; view.DirectoryPath = directoryPath; view.ColorSchemas = colorSchemas; Controls.Add(view); try { await view.Start(); } catch (Exception ex) { Controls.Remove(view); if (ex is ArgumentException || ex is IOException) { ShowError("Error opening directory {0}: {1}", directoryPath, ex.Message); } else { throw; } } currentView = view; view.BringToFront(); Text = ApplicationName + " " + directoryPath; }