/// <summary> /// Prompts the user about cleaning up external files. /// </summary> /// <param name="document">The document.</param> /// <returns>True if external files should be cleaned, otherwise false.</returns> private static bool PromptUserAboutCleaningExternalFiles(Document document) { var viewModel = new YesNoPromptViewModel { Title = @"CodeMaid: Cleanup External File", Message = document.Name + " is not in the solution so some cleanup actions may be unavailable." + Environment.NewLine + Environment.NewLine + "Do you want to perform a partial cleanup?", CanRemember = true }; var window = new YesNoPromptWindow { DataContext = viewModel }; var response = window.ShowModal(); if (!response.HasValue) { return false; } if (viewModel.Remember) { var preference = (int)(response.Value ? AskYesNo.Yes : AskYesNo.No); Settings.Default.Cleaning_PerformPartialCleanupOnExternal = preference; Settings.Default.Save(); } return response.Value; }
/// <summary> /// Prompts the user about reorganizing files with preprocessor conditionals. /// </summary> /// <param name="document">The document.</param> /// <returns>True if files with preprocessor conditionals should be reorganized, otherwise false.</returns> private static bool PromptUserAboutReorganizingPreprocessorConditionals(Document document) { try { var viewModel = new YesNoPromptViewModel { Title = @"CodeMaid: Reorganize Preprocessor Conditionals", Message = document.Name + " contains preprocessor conditionals (e.g. #if, #pragma) which reorganization does not currently support." + Environment.NewLine + Environment.NewLine + "Do you want to reorganize anyways (DANGEROUS)?", CanRemember = true }; var window = new YesNoPromptWindow { DataContext = viewModel }; var response = window.ShowModal(); if (!response.HasValue) { return false; } if (viewModel.Remember) { var preference = (int)(response.Value ? AskYesNo.Yes : AskYesNo.No); Settings.Default.Reorganizing_PerformWhenPreprocessorConditionals = preference; Settings.Default.Save(); } return response.Value; } catch (Exception ex) { OutputWindowHelper.ExceptionWriteLine("Unable to prompt user about reorganizing preprocessor conditionals", ex); return false; } }