コード例 #1
0
    /// <summary>
    /// Shows a Yes/No dialog.
    /// </summary>
    /// <param name="displayOptions">True if the options should be displayed.</param>
    /// <param name="ignoreRecent">True if the recent projects should be ignored.</param>
    /// <returns>True if Yes</returns>
    public static bool Ask(bool displayOptions, out bool ignoreRecent)
    {
        var dialog = new CacheDialog
        {
            DisplayOptions = displayOptions
        };
        var result = dialog.ShowDialog();

        ignoreRecent = dialog.IgnoreRecent;

        return(result.HasValue && result.Value);
    }
コード例 #2
0
        internal static void PurgeCache()
        {
            if (UserSettings.All.AskDeleteCacheWhenClosing && !CacheDialog.Ask(false, out _))
            {
                return;
            }

            try
            {
                var cache = Other.AdjustPath(UserSettings.All.TemporaryFolderResolved);

                Directory.Delete(cache, true);
            }
            catch (Exception e)
            {
                LogWriter.Log(e, "Purging cache");
            }
        }