LunarPresentation/Commands/SaveDocColorSolution.cs

(开头部分) 7KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Windows;
using System.Xml.Linq;

namespace SHomeWorkshop.LunarPresentation.Commands
{
    public partial class Command
    {
        public static void ClearDocColorSolution()
        {
            if (System.IO.File.Exists(Globals.pathOfPreferences))
            {
                MessageBoxResult r = MessageBox.Show("此操作将清除“新建文档默认配色方案”,清除后不可恢复。要继续吗?",
                    Globals.appName, MessageBoxButton.YesNo, MessageBoxImage.Warning);
                if (r != MessageBoxResult.Yes) return;

                try
                {
                    System.IO.File.Delete(Globals.pathOfPreferences);
                    MessageBox.Show("已清除此前保存的配色方案。重新启动程序后会恢复程序初始配色方案。", Globals.appName,
                        MessageBoxButton.OK, MessageBoxImage.Information);
                }
                catch (Exception ex)
                {
                    Dialogs.LunarMsgBox.MsgBoxShow(
                        Globals.appName,
                        "未清除“新建文档默认配色方案",
                        "尝试清除相关记录时出错,似乎执行了不必要的清除操作。" +
                        "异常信息如下:\r\n" + ex.Message,
                        ex.StackTrace, MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }
            }
            else
            {
                MessageBox.Show("没有找到“新建文档默认配色方案”相关记录。无须清除。",
                    Globals.appName, MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
        }

        public static void SaveDocColorSolution()
        {
            if (Globals.selectedEditor == null)
            {
                MessageBox.Show("当前未打开任何文档!", Globals.appName,
                    MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            if (MessageBoxResult.Yes != MessageBox.Show("此操作会把当前文档的配色方案(含“默认背景色、" +
                "默认前景色、子面板选取框色、普通公式选取框色及1-4级文本标题的默认色彩”)作为程序下次启动后新建文档的默认配色方案。要继续吗?",
                Globals.appName, MessageBoxButton.YesNo, MessageBoxImage.Warning))
                return;

            if (System.IO.File.Exists(Globals.pathOfPreferences))
            {
                XDocument xDoc = XDocument.Load(/*"file:///" +加这个会出错!!*/ Globals.pathOfPreferences);

                XElement newDocDefSettingsElement = xDoc.Root.Element("NewDocDefSettings");
后面还有 95 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。