diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
deleted file mode 100644
index ef84a27..0000000
--- a/.config/dotnet-tools.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "version": 1,
- "isRoot": true,
- "tools": {
- "csharpier": {
- "version": "0.25.0",
- "commands": [
- "dotnet-csharpier"
- ]
- }
- }
-}
\ No newline at end of file
diff --git a/.idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.ask.xml b/.idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.ask.xml
new file mode 100644
index 0000000..7ef04e2
--- /dev/null
+++ b/.idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.ask.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.ask2agent.xml b/.idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.ask2agent.xml
new file mode 100644
index 0000000..1f2ea11
--- /dev/null
+++ b/.idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.ask2agent.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Sample/App.config b/DrfxFontFixer/App.config
similarity index 100%
rename from Sample/App.config
rename to DrfxFontFixer/App.config
diff --git a/DrfxFontFixer/App.xaml b/DrfxFontFixer/App.xaml
new file mode 100644
index 0000000..4c10f9e
--- /dev/null
+++ b/DrfxFontFixer/App.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Sample/App.xaml.cs b/DrfxFontFixer/App.xaml.cs
similarity index 92%
rename from Sample/App.xaml.cs
rename to DrfxFontFixer/App.xaml.cs
index 924c079..bf4e8f9 100644
--- a/Sample/App.xaml.cs
+++ b/DrfxFontFixer/App.xaml.cs
@@ -6,7 +6,7 @@ using System.Linq;
using System.Threading.Tasks;
using System.Windows;
-namespace Sample
+namespace DrfxFontFixer
{
///
/// App.xaml 的交互逻辑
diff --git a/DrfxFontFixer/DrfxFontFixer.csproj b/DrfxFontFixer/DrfxFontFixer.csproj
new file mode 100644
index 0000000..943c7a2
--- /dev/null
+++ b/DrfxFontFixer/DrfxFontFixer.csproj
@@ -0,0 +1,15 @@
+
+
+ net8.0-windows
+ WinExe
+ 13.0
+ true
+ true
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DrfxFontFixer/MainWindow.xaml b/DrfxFontFixer/MainWindow.xaml
new file mode 100644
index 0000000..8f6df15
--- /dev/null
+++ b/DrfxFontFixer/MainWindow.xaml
@@ -0,0 +1,175 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DrfxFontFixer/MainWindow.xaml.cs b/DrfxFontFixer/MainWindow.xaml.cs
new file mode 100644
index 0000000..1b0dd44
--- /dev/null
+++ b/DrfxFontFixer/MainWindow.xaml.cs
@@ -0,0 +1,595 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.IO;
+using System.IO.Compression;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Media;
+using Microsoft.Win32;
+using Newtonsoft.Json;
+
+namespace DrfxFontFixer
+{
+ public class FullMapping : INotifyPropertyChanged
+ {
+ private static Dictionary _systemFontDict;
+
+ public static void Initialize(Dictionary fontDict)
+ {
+ _systemFontDict = fontDict;
+ }
+
+ public string OriginalFont { get; init; }
+ public string OriginalStyle { get; init; }
+ private string newFont;
+
+ public string NewFont
+ {
+ get => newFont;
+ set
+ {
+ if (newFont != value)
+ {
+ newFont = value;
+ OnPropertyChanged(nameof(NewFont));
+ UpdateAvailableStyles();
+ }
+ }
+ }
+
+ private string newStyle;
+
+ public string NewStyle
+ {
+ get => newStyle;
+ set
+ {
+ newStyle = value;
+ OnPropertyChanged(nameof(NewStyle));
+ }
+ }
+
+ public ObservableCollection AvailableNewStyles { get; } = [];
+ public bool IsNewFontInSystem { get; private set; }
+ [JsonIgnore] private string usageInfo;
+
+ [JsonIgnore]
+ public string UsageInfo
+ {
+ get => usageInfo;
+ set
+ {
+ usageInfo = value;
+ OnPropertyChanged(nameof(UsageInfo));
+ }
+ }
+
+ private void UpdateAvailableStyles()
+ {
+ IsNewFontInSystem = _systemFontDict.TryGetValue(NewFont, out var fontFamily);
+ Application.Current.Dispatcher.Invoke(() => AvailableNewStyles.Clear());
+ if (IsNewFontInSystem)
+ {
+ var styles = new List();
+ foreach (var typeface in fontFamily.GetTypefaces())
+ {
+ styles.Add(typeface.FaceNames[System.Windows.Markup.XmlLanguage.GetLanguage("en-us")]);
+ }
+
+ styles.Distinct().OrderBy(s => s).ToList().ForEach(s => Application.Current.Dispatcher.Invoke(() => AvailableNewStyles.Add(s)));
+ if (!AvailableNewStyles.Contains(NewStyle))
+ {
+ NewStyle = AvailableNewStyles.Contains("Regular") ? "Regular" : AvailableNewStyles.FirstOrDefault();
+ }
+ }
+
+ OnPropertyChanged(nameof(IsNewFontInSystem));
+ OnPropertyChanged(nameof(AvailableNewStyles));
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ protected void OnPropertyChanged(string name) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
+ }
+
+ public partial class MainWindow
+ {
+ public ObservableCollection FullMappings { get; set; } = new ObservableCollection();
+ public List SystemFonts { get; set; } = new List();
+ private readonly string mappingFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "mapping.json");
+ private bool isProcessingComplete = false;
+ private string lastOutputDirectory = "";
+
+ public MainWindow()
+ {
+ InitializeComponent();
+ this.DataContext = this;
+ LoadSystemFonts();
+ OutputPath.Text = Path.Combine(
+ Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
+ "Blackmagic Design",
+ "DaVinci Resolve",
+ "Support",
+ "Fusion",
+ "Templates"
+ );
+ LoadMapping(false);
+ MappingDataGrid.ItemsSource = FullMappings;
+ }
+
+ #region Initialization, Persistence and Font Management
+
+ private void LoadSystemFonts()
+ {
+ var fontDict = new Dictionary();
+ foreach (var fontFamily in Fonts.SystemFontFamilies.OrderBy(f => f.Source))
+ {
+ if (!fontDict.ContainsKey(fontFamily.Source)) fontDict.Add(fontFamily.Source, fontFamily);
+ }
+
+ SystemFonts = fontDict.Keys.ToList();
+ FullMapping.Initialize(fontDict);
+ }
+
+ private void SaveMapping()
+ {
+ try
+ {
+ string json = JsonConvert.SerializeObject(FullMappings, Formatting.Indented);
+ File.WriteAllText(mappingFilePath, json);
+ Log("映射表已成功保存。", Brushes.Blue);
+ }
+ catch (Exception ex)
+ {
+ Log($"保存映射表失败: {ex.Message}", Brushes.Red);
+ }
+ }
+
+ private void LoadMapping(bool userInitiated = true)
+ {
+ if (!File.Exists(mappingFilePath))
+ {
+ if (userInitiated) MessageBox.Show("未找到 mapping.json 文件。", "提示");
+ return;
+ }
+
+ try
+ {
+ string json = File.ReadAllText(mappingFilePath);
+ var loaded = JsonConvert.DeserializeObject>(json);
+ if (loaded != null)
+ {
+ FullMappings = loaded;
+ MappingDataGrid.ItemsSource = null;
+ MappingDataGrid.ItemsSource = FullMappings;
+ Log("已成功加载本地映射表。", Brushes.Blue);
+ }
+ }
+ catch (Exception ex)
+ {
+ Log($"加载映射表失败: {ex.Message}", Brushes.Red);
+ }
+ }
+
+ #endregion
+
+ #region UI Event Handlers
+
+ private void NewFontComboBox_LostFocus(object sender, RoutedEventArgs e)
+ {
+ var comboBox = sender as ComboBox;
+ var mapping = comboBox?.DataContext as FullMapping;
+ if (mapping != null && mapping.NewFont != comboBox.Text)
+ {
+ mapping.NewFont = comboBox.Text;
+ }
+ }
+
+ private void NewStyleComboBox_Loaded(object sender, RoutedEventArgs e)
+ {
+ var comboBox = sender as ComboBox;
+ var mapping = comboBox?.DataContext as FullMapping;
+ if (mapping != null)
+ {
+ comboBox.ItemsSource = mapping.AvailableNewStyles;
+ }
+ }
+
+ private async void StartButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (FileListBox.Items.Count == 0)
+ {
+ MessageBox.Show("请先添加 .drfx 文件。");
+ return;
+ }
+
+ if (FullMappings.Count == 0)
+ {
+ MessageBox.Show("映射表为空。");
+ return;
+ }
+
+ var files = FileListBox.Items.Cast().ToList();
+ SetUiState(false);
+ LogTextBlock.Text = "";
+ MainProgressBar.Value = 0;
+ isProcessingComplete = false;
+ try
+ {
+ var progress = new Progress(r =>
+ {
+ if (!string.IsNullOrEmpty(r.Message)) Log(r.Message, r.Color);
+ MainProgressBar.Value = r.Percentage;
+ });
+ var outputPath = OutputPath.Text;
+ await Task.Run(() => ProcessFiles_Mapping(files, outputPath, FullMappings.ToList(), progress));
+ Log("====== 所有任务已完成! ======", Brushes.Green);
+ isProcessingComplete = true;
+ var result = MessageBox.Show("处理完成!是否打开输出目录", "完成", MessageBoxButton.YesNo, MessageBoxImage.Question);
+ if (result== MessageBoxResult.Yes)
+ {
+ Process.Start("explorer.exe", outputPath);
+ }
+ }
+ catch (Exception ex)
+ {
+ Log($"严重错误: {ex.Message}", Brushes.Red);
+ }
+ finally
+ {
+ SetUiState(true);
+ }
+ }
+
+ private async void ScanFilesButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (FileListBox.Items.Count == 0)
+ {
+ MessageBox.Show("请先添加要扫描的 .drfx 文件。");
+ return;
+ }
+
+ SetUiState(false);
+ Log("开始扫描文件...");
+
+ var usageDict = new Dictionary, List>();
+ try
+ {
+ await Task.Run(() =>
+ {
+ foreach (var drfxFile in FileListBox.Items.Cast())
+ {
+ using (var archive = ZipFile.OpenRead(drfxFile))
+ {
+ foreach (var entry in archive.Entries.Where(en => en.Name.EndsWith(".setting", StringComparison.OrdinalIgnoreCase)))
+ {
+ using (var entryStream = entry.Open())
+ using (var memoryStream = new MemoryStream())
+ {
+ entryStream.CopyTo(memoryStream);
+ byte[] contentBytes = memoryStream.ToArray();
+ using (var readableStream = new MemoryStream(contentBytes))
+ {
+ var encoding = GetFileEncoding(readableStream);
+ string content = encoding.GetString(contentBytes);
+ var foundPairs = ExtractFontAndStylePairs(content);
+ foreach (var pair in foundPairs)
+ {
+ if (!usageDict.ContainsKey(pair))
+ {
+ usageDict[pair] = new List();
+ }
+
+ usageDict[pair].Add(entry.Name);
+ }
+ }
+ }
+ }
+ }
+ }
+ });
+
+ int newItems = 0;
+ var existingMappings = FullMappings.ToDictionary(m => (m.OriginalFont, m.OriginalStyle));
+
+ foreach (var entry in usageDict.OrderBy(p => p.Key.Item1).ThenBy(p => p.Key.Item2))
+ {
+ var pair = (entry.Key.Item1, entry.Key.Item2);
+ string usageInfo = $"使用文件:\n{string.Join("\n", entry.Value.Distinct())}";
+ if (existingMappings.TryGetValue(pair, out var existingMapping))
+ {
+ existingMapping.UsageInfo = usageInfo;
+ }
+ else
+ {
+ FullMappings.Add(new FullMapping
+ {
+ OriginalFont = pair.Item1, OriginalStyle = pair.Item2, NewFont = pair.Item1, NewStyle = pair.Item2, UsageInfo = usageInfo
+ });
+ newItems++;
+ }
+ }
+
+ Log($"扫描完成,新增 {newItems} 个组合,并已更新所有文件引用信息。", Brushes.Blue);
+ }
+ catch (Exception ex)
+ {
+ Log($"扫描失败: {ex.Message}", Brushes.Red);
+ }
+ finally
+ {
+ SetUiState(true);
+ }
+ }
+
+ private void SaveMapButton_Click(object sender, RoutedEventArgs e) => SaveMapping();
+
+ private void LoadMapButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (MessageBox.Show("加载将覆盖当前更改,确定吗?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
+ {
+ LoadMapping();
+ }
+ }
+
+ private void ClearMapButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (MessageBox.Show("确定要清空映射表吗?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
+ {
+ FullMappings.Clear();
+ Log("映射表已清空。");
+ }
+ }
+
+ #endregion
+
+ #region Core Processing Logic
+
+ private void ProcessFiles_Mapping(List files, string outputDir, List mappings, IProgress progress)
+ {
+ int filesCompleted = 0;
+ var mappingDict = mappings.ToDictionary(m => (m.OriginalFont, m.OriginalStyle));
+
+ foreach (var drfxFile in files)
+ {
+ int totalReplacementsInFile = 0;
+ string tempDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
+
+ try
+ {
+ progress.Report(new ProgressReport { Message = $"---处理: {Path.GetFileName(drfxFile)} ---" });
+ ZipFile.ExtractToDirectory(drfxFile, tempDir);
+
+ var settingFiles = Directory.GetFiles(tempDir, "*.setting", SearchOption.AllDirectories);
+ foreach (var settingFile in settingFiles)
+ {
+ var (modifiedContent, replacementsCount) = ProcessSingleFile(settingFile, mappingDict, progress);
+ if (replacementsCount > 0)
+ {
+ Encoding encoding;
+ using (var stream = new FileStream(settingFile, FileMode.Open, FileAccess.Read))
+ {
+ encoding = GetFileEncoding(stream);
+ }
+
+ File.WriteAllText(settingFile, modifiedContent, encoding);
+ totalReplacementsInFile += replacementsCount;
+ }
+ }
+
+ if (!Directory.Exists(outputDir))
+ {
+ Directory.CreateDirectory(outputDir);
+ }
+
+ lastOutputDirectory = outputDir;
+ string finalDrfxPath = Path.Combine(outputDir, Path.GetFileName(drfxFile));
+ if (File.Exists(finalDrfxPath)) File.Delete(finalDrfxPath);
+ ZipFile.CreateFromDirectory(tempDir, finalDrfxPath, CompressionLevel.Optimal, false);
+
+ progress.Report(totalReplacementsInFile > 0
+ ? new ProgressReport { Message = $" - 总结: 共应用 {totalReplacementsInFile} 条替换规则。", Color = Brushes.Purple }
+ : new ProgressReport { Message = $" - 总结: 无需任何替换。", Color = Brushes.Gray });
+ progress.Report(new ProgressReport { Message = $" -> 成功! 已保存到 '{outputDir}' 文件夹。", Color = Brushes.Blue });
+ }
+ catch (Exception ex)
+ {
+ progress.Report(new ProgressReport { Message = $" -> 失败: {ex.Message}", Color = Brushes.Red });
+ }
+ finally
+ {
+ filesCompleted++;
+ progress.Report(new ProgressReport { Percentage = (int)(100.0 * filesCompleted / files.Count) });
+ if (Directory.Exists(tempDir)) Directory.Delete(tempDir, true);
+ }
+ }
+ }
+
+ private (string ModifiedContent, int ReplacementsCount) ProcessSingleFile(string filePath,
+ Dictionary<(string, string), FullMapping> mappingDict, IProgress progress)
+ {
+ Encoding encoding;
+ // if (filePath.Contains("Title 03"))
+ // {
+ // }
+
+ using (var stream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
+ {
+ encoding = GetFileEncoding(stream);
+ }
+
+ string originalContent = File.ReadAllText(filePath, encoding);
+
+ int replacementsCount = 0;
+ string toolBlockPattern =
+ @"\w+\s*=\s*(?:TextPlus)\s*(\{((?>[^{}]+|\{(?)|\}(?<-open>))*(?(open)(?!)))\})";
+
+ string modifiedContent = Regex.Replace(originalContent, toolBlockPattern, (match) =>
+ {
+ string toolBlockContent = match.Value;
+ string font = ExtractValue(toolBlockContent, "Font");
+ string style = ExtractValue(toolBlockContent, "Style");
+
+ if (font != null && style != null && mappingDict.TryGetValue((font, style), out var rule))
+ {
+ string newBlock = toolBlockContent;
+ if (rule.NewFont != font)
+ {
+ newBlock = Regex.Replace(newBlock, GetPattern("Font"), $"$1{rule.NewFont}$2");
+ progress.Report(new ProgressReport
+ { Message = $" - 字体映射: '{font}' -> '{rule.NewFont}' (文件: {Path.GetFileName(filePath)})", Color = Brushes.DarkGreen });
+ replacementsCount++;
+ }
+
+ if (rule.NewStyle != style)
+ {
+ newBlock = Regex.Replace(newBlock, GetPattern("Style"), $"$1{rule.NewStyle}$2");
+ progress.Report(new ProgressReport
+ { Message = $" - 样式映射: '{style}' -> '{rule.NewStyle}' (文件: {Path.GetFileName(filePath)})", Color = Brushes.DarkCyan });
+ replacementsCount++;
+ }
+
+ return newBlock;
+ }
+
+ return toolBlockContent;
+ });
+
+ return (modifiedContent, replacementsCount);
+ }
+
+ #endregion
+
+ #region Helper Methods
+
+ // --- 核心BUG终极修复: 使用两个捕获组,确保替换的完整性 ---
+ private string GetPattern(string fieldName) => $@"({GetExtractionPattern(fieldName, true)})[^""]*({GetTrailingPattern()})";
+
+ // 这个辅助方法只用于 GetPattern
+ private string GetTrailingPattern() => @"""(,?)\s*\S*\s*\}";
+
+ // 这个辅助方法只用于 GetPattern
+ private string GetExtractionPattern(string fieldName, bool forCapture)
+ {
+ string pattern = $@"\b{fieldName}\s*=\s*Input\s*\{{[^{{}}]*?Value\s*=\s*""";
+ return forCapture ? pattern : pattern + @"(?[^""]*)""";
+ }
+
+ private string ExtractValue(string content, string fieldName)
+ {
+ var match = Regex.Match(content, GetExtractionPattern(fieldName, false));
+ return match.Success ? match.Groups["value"].Value : null;
+ }
+
+ private List> ExtractFontAndStylePairs(string content)
+ {
+ var pairs = new List>();
+ string toolBlockPattern =
+ @"\w+\s*=\s*(?:TextPlus)\s*(\{((?>[^{}]+|\{(?)|\}(?<-open>))*(?(open)(?!)))\})";
+ var matches = Regex.Matches(content, toolBlockPattern);
+ foreach (Match match in matches)
+ {
+ string font = ExtractValue(match.Value, "Font");
+ string style = ExtractValue(match.Value, "Style");
+ if (font != null && style != null)
+ {
+ pairs.Add(new Tuple(font, style));
+ }
+ }
+
+ return pairs;
+ }
+
+ private Encoding GetFileEncoding(Stream stream)
+ {
+ var bom = new byte[4];
+ stream.Read(bom, 0, 4);
+ stream.Position = 0;
+ if (bom[0] == 0xef && bom[1] == 0xbb && bom[2] == 0xbf) return Encoding.UTF8;
+ if (bom[0] == 0xff && bom[1] == 0xfe) return Encoding.Unicode;
+ if (bom[0] == 0xfe && bom[1] == 0xff) return Encoding.BigEndianUnicode;
+ return new UTF8Encoding(false);
+ }
+
+ private void SetUiState(bool isEnabled)
+ {
+ StartButton.IsEnabled = isEnabled;
+ AddFilesButton.IsEnabled = isEnabled;
+ ClearListButton.IsEnabled = isEnabled;
+ ScanFilesButton.IsEnabled = isEnabled;
+ SaveMapButton.IsEnabled = isEnabled;
+ ClearMapButton.IsEnabled = isEnabled;
+ LoadMapButton.IsEnabled = isEnabled;
+ MappingDataGrid.IsEnabled = isEnabled;
+ OpenOutputButton.IsEnabled = isProcessingComplete || isEnabled;
+ }
+
+ private void Log(string message, Brush color = null)
+ {
+ var run = new Run(DateTime.Now.ToString("HH:mm:ss") + " - " + message + Environment.NewLine) { Foreground = color ?? Brushes.Black };
+ LogTextBlock.Inlines.Add(run);
+ LogScrollViewer.ScrollToEnd();
+ }
+
+ private void AddFilesButton_Click(object sender, RoutedEventArgs e)
+ {
+ OpenFileDialog ofd = new OpenFileDialog { Filter = "DRFX Files (*.drfx)|*.drfx", Multiselect = true, Title = "选择 DRFX 文件" };
+ if (ofd.ShowDialog() == true)
+ foreach (string f in ofd.FileNames)
+ if (!FileListBox.Items.Contains(f))
+ FileListBox.Items.Add(f);
+ }
+
+ private void ClearListButton_Click(object sender, RoutedEventArgs e)
+ {
+ FileListBox.Items.Clear();
+ Log("文件列表已清空。");
+ }
+
+ private void OpenOutputButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (string.IsNullOrEmpty(lastOutputDirectory) || !Directory.Exists(lastOutputDirectory))
+ {
+ MessageBox.Show("输出目录不存在。请先处理至少一个文件。", "提示");
+ return;
+ }
+
+ try
+ {
+ Process.Start("explorer.exe", lastOutputDirectory);
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("无法打开目录: " + ex.Message, "错误");
+ }
+ }
+
+ public struct ProgressReport
+ {
+ public int Percentage { get; set; }
+ public string Message { get; set; }
+ public Brush Color { get; set; }
+ }
+
+ #endregion
+
+ private void BrowserOutputPathButton_Click(object sender, RoutedEventArgs e)
+ {
+ var dlg = new OpenFolderDialog()
+ {
+ Title = "选择输出目录",
+ };
+ if (dlg.ShowDialog()== true)
+ {
+ OutputPath.Text = dlg.FolderName;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Sample/Properties/Resources.Designer.cs b/DrfxFontFixer/Properties/Resources.Designer.cs
similarity index 94%
rename from Sample/Properties/Resources.Designer.cs
rename to DrfxFontFixer/Properties/Resources.Designer.cs
index baeebd9..7d340eb 100644
--- a/Sample/Properties/Resources.Designer.cs
+++ b/DrfxFontFixer/Properties/Resources.Designer.cs
@@ -8,7 +8,7 @@
//
//------------------------------------------------------------------------------
-namespace Sample.Properties
+namespace DrfxFontFixer.Properties
{
@@ -44,7 +44,7 @@ namespace Sample.Properties
{
if ((resourceMan == null))
{
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sample.Properties.Resources", typeof(Resources).Assembly);
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DrfxFontFixer.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
diff --git a/Sample/Properties/Resources.resx b/DrfxFontFixer/Properties/Resources.resx
similarity index 100%
rename from Sample/Properties/Resources.resx
rename to DrfxFontFixer/Properties/Resources.resx
diff --git a/Sample/Properties/Settings.Designer.cs b/DrfxFontFixer/Properties/Settings.Designer.cs
similarity index 96%
rename from Sample/Properties/Settings.Designer.cs
rename to DrfxFontFixer/Properties/Settings.Designer.cs
index 3f527e3..0d45e4d 100644
--- a/Sample/Properties/Settings.Designer.cs
+++ b/DrfxFontFixer/Properties/Settings.Designer.cs
@@ -8,7 +8,7 @@
//
//------------------------------------------------------------------------------
-namespace Sample.Properties
+namespace DrfxFontFixer.Properties
{
diff --git a/Sample/Properties/Settings.settings b/DrfxFontFixer/Properties/Settings.settings
similarity index 100%
rename from Sample/Properties/Settings.settings
rename to DrfxFontFixer/Properties/Settings.settings
diff --git a/NeoUI/NeoUI/Appearance/ThemeManager.cs b/NeoUI/NeoUI/Appearance/ThemeManager.cs
index 1cea0bf..2074158 100644
--- a/NeoUI/NeoUI/Appearance/ThemeManager.cs
+++ b/NeoUI/NeoUI/Appearance/ThemeManager.cs
@@ -31,7 +31,7 @@ namespace NeoUI.Appearance
///
/// 该属性用于获取应用程序的命名空间,以便在构建资源路径或其他需要引用程序集名称的地方使用。例如,在定位主题字典路径或着色器文件时,`LibraryNamespace`提供了必要的程序集名称信息。
///
- public static string LibraryNamespace => Assembly.GetExecutingAssembly().GetName().Name;
+ public static string LibraryNamespace => Assembly.GetExecutingAssembly().GetName().Name!;
///
/// 获取主题字典的基路径,该路径用于定位应用程序中的主题资源文件。此属性返回一个字符串,表示到主题资源文件夹的包URI。
@@ -67,7 +67,7 @@ namespace NeoUI.Appearance
private static IReadOnlyList AnimatableBrushKeys
{
- get { lock (KeyLock) return _animatableBrushKeys.ToList(); }
+ get { lock (KeyLock) return [.. _animatableBrushKeys]; }
}
private static void RefreshAnimatableKeysFromCurrentManagedDictionaries(ResourceDictionary root, bool merge = false)
@@ -93,7 +93,7 @@ namespace NeoUI.Appearance
lock (KeyLock)
{
- _animatableBrushKeys = keys.ToList();
+ _animatableBrushKeys = [.. keys];
}
}
@@ -124,7 +124,7 @@ namespace NeoUI.Appearance
{
var src = dict.Source?.OriginalString;
if (string.IsNullOrEmpty(src)) return false;
- if (src.IndexOf("/ColorPalette/", StringComparison.OrdinalIgnoreCase) >= 0)
+ if (src?.IndexOf("/ColorPalette/", StringComparison.OrdinalIgnoreCase) >= 0)
return true;
var fileName = Path.GetFileName(src);
return fileName != null &&
@@ -133,7 +133,7 @@ namespace NeoUI.Appearance
}
private static Task AnimateToNewTheme(ResourceDictionary resources,
- IReadOnlyDictionary fromColors,
+ Dictionary fromColors,
int baseDurationMs)
{
var tasks = new List();
@@ -171,7 +171,7 @@ namespace NeoUI.Appearance
///
/// 【核心修改】针对单个 Brush 的颜色动画封装,在Completed事件中捕获异常。
///
- private static Task AnimateBrushColorAsync(SolidColorBrush brush, Color toColor, int durationMs)
+ private static Task AnimateBrushColorAsync(SolidColorBrush brush, Color toColor, int durationMs)
{
var tcs = new TaskCompletionSource();
if (brush.IsFrozen)
@@ -358,7 +358,7 @@ namespace NeoUI.Appearance
if (animate && fromColors != null)
{
RefreshAnimatableKeysFromCurrentManagedDictionaries(appResources, merge: true);
- await AnimateToNewTheme(appResources, fromColors, durationMs);
+ await AnimateToNewTheme(appResources, fromColors, durationMs).ConfigureAwait(true);
}
if (modeChanged)
@@ -487,7 +487,15 @@ namespace NeoUI.Appearance
#endregion
#region Persistence
+
+ ///
+ /// 【启用持久化】允许主题设置在应用会话之间保持不变。
+ ///
public static void EnablePersistence() => _persistenceEnabled = true;
+
+ ///
+ /// 【功能描述】禁用主题持久化功能。调用此方法后,将不会保存当前的主题设置到持久化存储中。
+ ///
public static void DisablePersistence() => _persistenceEnabled = false;
///
@@ -511,7 +519,7 @@ namespace NeoUI.Appearance
#if DEBUG
private static void DumpMerged(string tag)
{
- System.Diagnostics.Debug.WriteLine("==== " + tag + " MergedDictionaries ====");
+ System.Diagnostics.Debug.WriteLine($"==== {tag} MergedDictionaries ====");
int i = 0;
foreach (var d in Current.Resources.MergedDictionaries)
System.Diagnostics.Debug.WriteLine($"{i++}: {d.Source}");
@@ -601,7 +609,7 @@ namespace NeoUI.Appearance
{
if (resources == null)
{
- resources = new ResourceDictionary();
+ resources = [];
try
{
var themesDictionary = new ThemesDictionary() { Mode = ActiveThemeMode, Palette = ActiveThemePalette };
diff --git a/NeoUI/NeoUI/Assists/PopupAssist.cs b/NeoUI/NeoUI/Assists/PopupAssist.cs
index 997b0f3..e87621f 100644
--- a/NeoUI/NeoUI/Assists/PopupAssist.cs
+++ b/NeoUI/NeoUI/Assists/PopupAssist.cs
@@ -1,20 +1,34 @@
-// NeoUI/Assists/PopupAssist.cs
-using System;
-using System.Windows;
-using System.Windows.Controls.Primitives;
+using System.Windows.Controls.Primitives;
using System.Windows.Input;
namespace NeoUI.Assists
{
+ ///
+ /// PopupAssist 类提供了用于增强 Popup 控件行为的辅助方法和附加属性。
+ /// 通过设置 SimulateNativeBehavior 属性,可以使 Popup 的行为更接近于原生平台上的弹出窗口,
+ /// 比如在用户点击外部时自动关闭等。此功能对于需要跨平台一致用户体验的应用程序非常有用。
+ ///
public static class PopupAssist
{
- // 附加属性 SimulateNativeBehavior 的定义保持不变
+ ///
+ /// 表示是否使 Popup 控件模拟原生平台的弹出行为。当设置为 true 时,Popup 将会在用户点击外部区域或窗口失去焦点时自动关闭,从而提供更接近于原生应用程序的用户体验。
+ ///
public static readonly DependencyProperty SimulateNativeBehaviorProperty =
DependencyProperty.RegisterAttached(
"SimulateNativeBehavior", typeof(bool), typeof(PopupAssist),
new PropertyMetadata(false, OnSimulateNativeBehaviorChanged));
+ ///
+ ///
+ ///
+ ///
+ ///
public static void SetSimulateNativeBehavior(DependencyObject element, bool value) => element.SetValue(SimulateNativeBehaviorProperty, value);
+ ///
+ ///
+ ///
+ ///
+ ///
public static bool GetSimulateNativeBehavior(DependencyObject element) => (bool)element.GetValue(SimulateNativeBehaviorProperty);
// 私有状态属性的定义保持不变
@@ -28,7 +42,7 @@ namespace NeoUI.Assists
private static void OnSimulateNativeBehaviorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
- if (!(d is Popup popup)) return;
+ if (d is not Popup popup) return;
if ((bool)e.NewValue)
{
popup.Opened += OnPopupOpened;
@@ -41,10 +55,9 @@ namespace NeoUI.Assists
}
}
- private static void OnPopupOpened(object sender, EventArgs e)
+ private static void OnPopupOpened(object? sender, EventArgs e)
{
- var popup = sender as Popup;
- if (popup == null || !GetSimulateNativeBehavior(popup)) return;
+ if (sender is not Popup popup || !GetSimulateNativeBehavior(popup)) return;
var window = Window.GetWindow(popup);
if (window == null) return;
@@ -53,7 +66,7 @@ namespace NeoUI.Assists
CleanupHandlers(popup, window);
// --- 添加自动关闭逻辑 ---
- EventHandler windowEventHandler = (s, args) =>
+ EventHandler windowEventHandler = (_, _) =>
{
popup.Dispatcher.BeginInvoke(new Action(() => { popup.IsOpen = false; }));
};
@@ -62,9 +75,9 @@ namespace NeoUI.Assists
window.LocationChanged += windowEventHandler;
// --- 添加鼠标点击外部逻辑 ---
- MouseButtonEventHandler mouseDownHandler = (s, args) =>
+ MouseButtonEventHandler mouseDownHandler = (_, _) =>
{
- if (popup.IsMouseOver || (popup.PlacementTarget != null && popup.PlacementTarget.IsMouseOver))
+ if (popup.IsMouseOver || popup.PlacementTarget is { IsMouseOver: true })
{
return;
}
@@ -74,7 +87,7 @@ namespace NeoUI.Assists
window.AddHandler(UIElement.PreviewMouseDownEvent, mouseDownHandler, true);
// --- 添加鼠标滚轮拦截逻辑 ---
- MouseWheelEventHandler mouseWheelHandler = (s, args) =>
+ MouseWheelEventHandler mouseWheelHandler = (_, args) =>
{
if (!popup.IsMouseOver)
{
@@ -85,10 +98,9 @@ namespace NeoUI.Assists
window.AddHandler(UIElement.PreviewMouseWheelEvent, mouseWheelHandler, true);
}
- private static void OnPopupClosed(object sender, EventArgs e)
+ private static void OnPopupClosed(object? sender, EventArgs e)
{
- var popup = sender as Popup;
- if (popup == null || !GetSimulateNativeBehavior(popup)) return;
+ if (sender is not Popup popup || !GetSimulateNativeBehavior(popup)) return;
var window = Window.GetWindow(popup);
// 窗口可能在Popup关闭时已经不存在了
diff --git a/NeoUI/NeoUI/Controls/Accordion.xaml.cs b/NeoUI/NeoUI/Controls/Accordion.xaml.cs
index 1e34d7c..96b37e3 100644
--- a/NeoUI/NeoUI/Controls/Accordion.xaml.cs
+++ b/NeoUI/NeoUI/Controls/Accordion.xaml.cs
@@ -1,8 +1,10 @@
-using System.Windows;
-using System.Windows.Controls;
-
-namespace NeoUI.Controls
+namespace NeoUI.Controls
{
+ ///
+ /// Accordion 控件提供了一个可折叠的面板容器,允许用户通过点击标题来展开或收起内容。
+ /// 该控件继承自 ItemsControl,因此可以使用数据绑定来动态添加 AccordionItem 子项。
+ /// 每个 AccordionItem 可以独立地设置其标题和是否默认展开的状态。
+ ///
public class Accordion : ItemsControl
{
static Accordion()
@@ -10,16 +12,19 @@ namespace NeoUI.Controls
DefaultStyleKeyProperty.OverrideMetadata(typeof(Accordion), new FrameworkPropertyMetadata(typeof(Accordion)));
}
+ ///
protected override bool IsItemItsOwnContainerOverride(object item)
{
return item is AccordionItem;
}
+ ///
protected override DependencyObject GetContainerForItemOverride()
{
return new AccordionItem();
}
+ ///
protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
base.OnItemsChanged(e);
@@ -45,7 +50,11 @@ namespace NeoUI.Controls
}
}
- // 重写此方法是处理数据绑定时添加事件的更可靠方式
+ ///
+ /// 重写此方法是处理数据绑定时添加事件的更可靠方式
+ ///
+ ///
+ ///
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
{
base.PrepareContainerForItemOverride(element, item);
@@ -56,6 +65,7 @@ namespace NeoUI.Controls
}
}
+ ///
protected override void ClearContainerForItemOverride(DependencyObject element, object item)
{
if (element is AccordionItem accordionItem)
diff --git a/NeoUI/NeoUI/Controls/AccordionItem.cs b/NeoUI/NeoUI/Controls/AccordionItem.cs
index a5976d1..6e68e74 100644
--- a/NeoUI/NeoUI/Controls/AccordionItem.cs
+++ b/NeoUI/NeoUI/Controls/AccordionItem.cs
@@ -3,6 +3,10 @@ using System.Windows.Controls;
namespace NeoUI.Controls
{
+ ///
+ /// AccordionItem 类表示一个可以展开和折叠的项,通常用于 Accordion 控件中。
+ /// 继承自 HeaderedContentControl,允许设置标题和内容。
+ ///
public class AccordionItem : HeaderedContentControl
{
static AccordionItem()
@@ -10,13 +14,22 @@ namespace NeoUI.Controls
DefaultStyleKeyProperty.OverrideMetadata(typeof(AccordionItem), new FrameworkPropertyMetadata(typeof(AccordionItem)));
}
+ ///
+ /// 表示AccordionItem是否处于展开状态的依赖属性。
+ /// 该属性用于绑定和样式设置,以便在XAML中控制AccordionItem的展开或折叠状态。
+ ///
public static readonly DependencyProperty IsExpandedProperty =
- DependencyProperty.Register("IsExpanded", typeof(bool), typeof(AccordionItem), new PropertyMetadata(false));
+ DependencyProperty.Register(nameof(IsExpanded), typeof(bool), typeof(AccordionItem), new PropertyMetadata(false));
+ ///
+ /// 获取或设置一个值,表示当前的AccordionItem是否处于展开状态。
+ /// 当此属性为true时,表示AccordionItem是展开的;如果为false,则表示AccordionItem是折叠的。
+ ///
+ /// 类型为bool。默认值为false。
public bool IsExpanded
{
- get { return (bool)GetValue(IsExpandedProperty); }
- set { SetValue(IsExpandedProperty, value); }
+ get => (bool)GetValue(IsExpandedProperty);
+ set => SetValue(IsExpandedProperty, value);
}
}
}
\ No newline at end of file
diff --git a/NeoUI/NeoUI/Controls/Anchor.xaml.cs b/NeoUI/NeoUI/Controls/Anchor.xaml.cs
index 1aa315f..3f5d0ff 100644
--- a/NeoUI/NeoUI/Controls/Anchor.xaml.cs
+++ b/NeoUI/NeoUI/Controls/Anchor.xaml.cs
@@ -134,7 +134,7 @@ public class Anchor : ContentControl
///
/// 请求扫描锚点(防抖处理)
///
- private void RequestScan(object sender, EventArgs e)
+ private void RequestScan(object? sender, EventArgs e)
{
scanDebounceTimer?.Stop();
scanDebounceTimer?.Start();
diff --git a/NeoUI/NeoUI/Controls/AutoComplete.xaml.cs b/NeoUI/NeoUI/Controls/AutoComplete.xaml.cs
index 873ae19..c68b344 100644
--- a/NeoUI/NeoUI/Controls/AutoComplete.xaml.cs
+++ b/NeoUI/NeoUI/Controls/AutoComplete.xaml.cs
@@ -162,7 +162,7 @@ namespace NeoUI.Controls
try
{
- await Task.Delay(filterDelay, control.cts.Token);
+ await Task.Delay(filterDelay, control.cts.Token).ConfigureAwait(true);
control.FilterItemsSource();
}
catch (TaskCanceledException)
@@ -170,7 +170,7 @@ namespace NeoUI.Controls
// Ignore cancellation
}
}
-
+
private void OnTextBoxTextChanged(object sender, TextChangedEventArgs e)
{
if (isSelectionChanging) return;
@@ -231,7 +231,7 @@ namespace NeoUI.Controls
}
else
{
- view.Filter = item => item.ToString().IndexOf(Text, StringComparison.OrdinalIgnoreCase) >= 0;
+ view.Filter = item => item.ToString()?.IndexOf(Text, StringComparison.OrdinalIgnoreCase) >= 0;
}
view.Refresh();
diff --git a/NeoUI/NeoUI/Controls/Badge.xaml.cs b/NeoUI/NeoUI/Controls/Badge.xaml.cs
index 8980580..133dbbd 100644
--- a/NeoUI/NeoUI/Controls/Badge.xaml.cs
+++ b/NeoUI/NeoUI/Controls/Badge.xaml.cs
@@ -50,15 +50,15 @@ public class Badge : ContentControlBase
var content = Count;
- if (Count is string)
+ if (Count is string str)
{
try
{
- var d = int.Parse(Count as string);
+ var d = int.Parse(str);
if (d > OverflowCount)
{
- content = OverflowCount + "+";
+ content = $"{OverflowCount}+";
}
}
catch
diff --git a/NeoUI/NeoUI/Controls/Cascader.xaml.cs b/NeoUI/NeoUI/Controls/Cascader.xaml.cs
index 84f527e..2f43e1f 100644
--- a/NeoUI/NeoUI/Controls/Cascader.xaml.cs
+++ b/NeoUI/NeoUI/Controls/Cascader.xaml.cs
@@ -9,7 +9,7 @@ namespace NeoUI.Controls;
///
/// 用于实现级联选择器功能的控件类。该控件允许用户从多层级的数据源中选择一个值,通常应用于需要按类别或层级进行选择的场景。
///
-//[TemplatePart(Name = "PART_Popup", Type = typeof(Popup))]
+[TemplatePart(Name = "PART_Popup", Type = typeof(Popup))]
public class Cascader : Control
{
private static readonly DependencyPropertyKey FilteredItemsSourcePropertyKey = DependencyProperty.RegisterReadOnly("FilteredItemsSource", typeof(IEnumerable), typeof(Cascader), new PropertyMetadata(null));
@@ -54,7 +54,7 @@ public class Cascader : Control
SelectSearchResultCommand = new RelayCommand(ExecuteSelectSearchResult);
}
- private ItemsControl CreateItemsControl(IEnumerable items)
+ private ListBox CreateItemsControl(IEnumerable items)
{
var itemsControl = new ListBox
{
diff --git a/NeoUI/NeoUI/Controls/ColorPicker/ColorPicker.xaml b/NeoUI/NeoUI/Controls/ColorPicker/ColorPicker.xaml
index 4898adb..dc8050b 100644
--- a/NeoUI/NeoUI/Controls/ColorPicker/ColorPicker.xaml
+++ b/NeoUI/NeoUI/Controls/ColorPicker/ColorPicker.xaml
@@ -1,18 +1,18 @@
+ xmlns:internal="clr-namespace:NeoUI.Converters.Internal"
+ xmlns:markup="clr-namespace:NeoUI.Markup">
+ ViewportUnits="Absolute">
@@ -35,10 +35,10 @@
+ ViewportUnits="Absolute">
@@ -61,7 +61,7 @@
-
-
@@ -404,7 +409,7 @@
-
+
diff --git a/NeoUI/NeoUI/Controls/DataGridStyle.xaml b/NeoUI/NeoUI/Controls/DataGridStyle.xaml
index ac06a7b..f3e69ea 100644
--- a/NeoUI/NeoUI/Controls/DataGridStyle.xaml
+++ b/NeoUI/NeoUI/Controls/DataGridStyle.xaml
@@ -359,7 +359,7 @@
-
+
@@ -375,7 +375,7 @@
-
+
@@ -429,12 +429,10 @@
-
-
@@ -442,7 +440,6 @@
-
-
+
+
\ No newline at end of file
diff --git a/NeoUI/NeoUI/Controls/Decorations/GlassChromeDecorator.cs b/NeoUI/NeoUI/Controls/Decorations/GlassChromeDecorator.cs
index eb8aab6..5e89b1a 100644
--- a/NeoUI/NeoUI/Controls/Decorations/GlassChromeDecorator.cs
+++ b/NeoUI/NeoUI/Controls/Decorations/GlassChromeDecorator.cs
@@ -10,14 +10,15 @@ namespace NeoUI.Controls.Decorations;
///
///
///
-///
///
///
-///
+///
///
///
///
diff --git a/NeoUI/NeoUI/Controls/IconElement.xaml.cs b/NeoUI/NeoUI/Controls/IconElement.xaml.cs
index 82dae39..2df1ac1 100644
--- a/NeoUI/NeoUI/Controls/IconElement.xaml.cs
+++ b/NeoUI/NeoUI/Controls/IconElement.xaml.cs
@@ -9,21 +9,21 @@ namespace NeoUI.Controls;
///
///
///
-///
+///
///
-///
///
-///
+///
///
-///
///
-///
+///
///
-///
+///
///
///
public class IconElement : Control
@@ -114,7 +114,7 @@ public class IconElement : Control
///
/// 获取或设置图标元素的字形代码。此属性定义了IconElement将显示的具体字形,通常用于指定字体图标。
///
- public string Glyph
+ public string? Glyph
{
get => (string)GetValue(GlyphProperty);
set => SetValue(GlyphProperty, value);
diff --git a/NeoUI/NeoUI/Controls/MultiTreeView.xaml.cs b/NeoUI/NeoUI/Controls/MultiTreeView.xaml.cs
index b5ac0ea..d933e65 100644
--- a/NeoUI/NeoUI/Controls/MultiTreeView.xaml.cs
+++ b/NeoUI/NeoUI/Controls/MultiTreeView.xaml.cs
@@ -85,7 +85,7 @@ public sealed class MultiTreeView : TreeView
}
// 当绑定的SelectedItems集合内部发生Add/Remove/Clear等操作时
- private void OnSelectedItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+ private void OnSelectedItemsCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
if (isUpdatingSelection)
return;
@@ -180,10 +180,10 @@ public sealed class MultiTreeView : TreeView
}
// 根据子项的勾选状态,更新父项的状态(可能是 true, false, or null for indeterminate)
- private void UpdateParentItemCheckState(MultiTreeViewItem item)
+ private static void UpdateParentItemCheckState(MultiTreeViewItem item)
{
var children = GetGeneratedChildren(item);
- if (!children.Any()) return;
+ if (children.Count == 0) return;
bool? newCheckState;
if (children.All(c => c?.IsChecked == true))
@@ -219,11 +219,10 @@ public sealed class MultiTreeView : TreeView
}
private List GetAllGeneratedItems() => GetDescendants(this, false);
- private List GetGeneratedChildren(ItemsControl parent) =>
- Enumerable.Range(0, parent.Items.Count)
+ private static List GetGeneratedChildren(ItemsControl parent) =>
+ [.. Enumerable.Range(0, parent.Items.Count)
.Select(i => parent.ItemContainerGenerator.ContainerFromIndex(i) as MultiTreeViewItem)
- .Where(c => c != null)
- .ToList();
+ .Where(c => c != null)];
private static MultiTreeViewItem? GetParentItem(TreeViewItem item) => ItemsControl.ItemsControlFromItemContainer(item) as MultiTreeViewItem;
#endregion
@@ -285,7 +284,7 @@ public class MultiTreeViewItem : TreeViewItem
private static MultiTreeView? GetParentTreeView(DependencyObject item)
{
var parent = VisualTreeHelper.GetParent(item);
- while (parent != null && !(parent is MultiTreeView))
+ while (parent != null && parent is not MultiTreeView)
{
parent = VisualTreeHelper.GetParent(parent);
}
diff --git a/NeoUI/NeoUI/Controls/NeuComboBox.xaml.cs b/NeoUI/NeoUI/Controls/NeuComboBox.xaml.cs
index 723bbb0..fa776e6 100644
--- a/NeoUI/NeoUI/Controls/NeuComboBox.xaml.cs
+++ b/NeoUI/NeoUI/Controls/NeuComboBox.xaml.cs
@@ -378,8 +378,6 @@ public class NeuComboBox : Control
private static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var c = (NeuComboBox)d;
- Debug.WriteLine($"{nameof(OnIsDropDownOpenChanged)}:{(bool)e.NewValue}");
-
if ((bool)e.NewValue)
{
c.Dispatcher.BeginInvoke(new Action(c.FocusFilterBoxIfNeeded));
@@ -506,7 +504,7 @@ public class NeuComboBox : Control
///
///
///
- private void SelectedItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+ private void SelectedItems_CollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
if (isUpdatingSelection)
return;
@@ -551,8 +549,8 @@ public class NeuComboBox : Control
c.UpdateListBoxSelection();
var args = new SelectionChangedEventArgs(
Selector.SelectionChangedEvent,
- e.OldValue != null ? new[] { e.OldValue } : Array.Empty
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvFamily.RenameTypeViewModel.ModifyNameCommand))]
- //[NotifyPropertyChangedFor(nameof(IsAllItemsSelected))]
- private List renameItems;
+ public partial List RenameItems { get; set; }
[ObservableProperty]
- private bool canInput;
+ public partial bool CanInput { get; set; }
[ObservableProperty]
- private bool isRunning;
+ public partial bool IsRunning { get; set; }
///
/// 选中正在使用中的条目
///
[ObservableProperty]
- private bool isUsed;
+ public partial bool IsUsed { get; set; }
[ObservableProperty]
- private Dictionary> collection;
+ public partial Dictionary> Collection { get; set; }
[ObservableProperty]
- private int categoryCount;
+ public partial int CategoryCount { get; set; }
[ObservableProperty]
- private int modifyType;
+ public partial int ModifyType { get; set; }
[ObservableProperty]
- private string foundText;
+ public partial string FoundText { get; set; }
[ObservableProperty]
- private string prefixText;
+ public partial string PrefixText { get; set; }
[ObservableProperty]
- private string replaceText;
+ public partial string ReplaceText { get; set; }
[ObservableProperty]
- private string searchText;
+ public partial string SearchText { get; set; }
[ObservableProperty]
- private string separator = "-";
+ public partial string Separator { get; set; } = "-";
[ObservableProperty]
- private string suffixText;
+ public partial string SuffixText { get; set; }
//[ObservableProperty]
//private IList selectedItems;
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
- public bool CanModify => RenameItems != null && Enumerable.Any(RenameItems, item => item.IsSelected);
+ public bool CanModify => RenameItems != null && RenameItems.Any(item => item.IsSelected);
//[ObservableProperty]
//private bool? isAllItemsSelected;
diff --git a/ShrlAlgoToolkit.RevitAddins/RvIndependent/MetroTunnel/MetroTunnelCmd.cs b/ShrlAlgoToolkit.RevitAddins/RvIndependent/MetroTunnel/MetroTunnelCmd.cs
index 4ca3a9e..aa65f2c 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvIndependent/MetroTunnel/MetroTunnelCmd.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvIndependent/MetroTunnel/MetroTunnelCmd.cs
@@ -218,7 +218,7 @@ public class MetroTunnelCmd : ExternalCommand
}
}
- Document.Invoke(ts =>
+ Document.Invoke(_ =>
{
var familySymbol = Document
.OfClass()
diff --git a/ShrlAlgoToolkit.RevitAddins/RvIndependent/MetroTunnel/MetroTunnelViewModel.cs b/ShrlAlgoToolkit.RevitAddins/RvIndependent/MetroTunnel/MetroTunnelViewModel.cs
index 5d59cd1..775ef4a 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvIndependent/MetroTunnel/MetroTunnelViewModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvIndependent/MetroTunnel/MetroTunnelViewModel.cs
@@ -6,40 +6,40 @@ namespace ShrlAlgoToolkit.RevitAddins.RvIndependent.MetroTunnel
public partial class MetroTunnelViewModel : ObservableObject
{
[ObservableProperty]
- private int assembleSelectedIndex;
+ public partial int AssembleSelectedIndex { get; set; }
///
/// 后环邻接块
///
[ObservableProperty]
- private double backTubeAngle = 50.0;
+ public partial double BackTubeAngle { get; set; } = 50.0;
///
/// 前环邻接块跨度
///
[ObservableProperty]
- private double frontTubeAngle = 60;
+ public partial double FrontTubeAngle { get; set; } = 60;
[ObservableProperty]
- private double staggerAngle = 10;
+ public partial double StaggerAngle { get; set; } = 10;
///
/// 标准块
///
[ObservableProperty]
- private double standardTubeAngle = 67.5;
+ public partial double StandardTubeAngle { get; set; } = 67.5;
[ObservableProperty]
- private double startAngle = 10.0;
+ public partial double StartAngle { get; set; } = 10.0;
[ObservableProperty]
- private double tubeOuterDiameter = 6000;
+ public partial double TubeOuterDiameter { get; set; } = 6000;
[ObservableProperty]
- private double tubeThickness = 300.0;
+ public partial double TubeThickness { get; set; } = 300.0;
[ObservableProperty]
- private double tubeWidth = 2000.0;
+ public partial double TubeWidth { get; set; } = 2000.0;
[RelayCommand]
private static void Confirm(object obj)
diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/AddInsulationViewModel.cs b/ShrlAlgoToolkit.RevitAddins/RvMEP/AddInsulationViewModel.cs
index c9150d2..ae81005 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvMEP/AddInsulationViewModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/AddInsulationViewModel.cs
@@ -14,20 +14,24 @@ namespace ShrlAlgoToolkit.RevitAddins.RvMEP
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvMEP.AddInsulationViewModel.AddInsulationCommand))]
- private bool addToDuct;
+ public partial bool AddToDuct { get; set; }
+
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvMEP.AddInsulationViewModel.AddInsulationCommand))]
- private bool addToPipe;
+ public partial bool AddToPipe { get; set; }
+
///
/// 定义的风管保温层
///
[ObservableProperty]
- private InsulationItem ductInsulationItem;
+ public partial InsulationItem DuctInsulationItem { get; set; }
+
///
/// 定义的管道保温层
///
[ObservableProperty]
- private List pipeInsulationItems;
+ public partial List PipeInsulationItems { get; set; }
+
///
/// 选中的风管系统类型
///
@@ -65,7 +69,7 @@ namespace ShrlAlgoToolkit.RevitAddins.RvMEP
var uidoc = uiapp.ActiveUIDocument;
var doc = uidoc.Document;
doc.Invoke(
- ts =>
+ _ =>
{
if (AddToDuct)
{
diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/AnyConnectViewModel.cs b/ShrlAlgoToolkit.RevitAddins/RvMEP/AnyConnectViewModel.cs
index 1d00f79..0e29beb 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvMEP/AnyConnectViewModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/AnyConnectViewModel.cs
@@ -24,25 +24,25 @@ public partial class AnyConnectViewModel : ObservableValidator
private readonly ActionEventHandler anyConnectHandler = new();
[ObservableProperty]
- private bool activeSnackbar;
+ public partial bool ActiveSnackbar { get; set; }
[ObservableProperty]
- private bool isMultiSelect = true;
+ public partial bool IsMultiSelect { get; set; } = true;
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvMEP.AnyConnectViewModel.ConnectCommand))]
- private bool canRunning = true;
+ public partial bool CanRunning { get; set; } = true;
[ObservableProperty]
[Range(0, 90)]
[NotifyDataErrorInfo]
- private double angle = 90;
+ public partial double Angle { get; set; } = 90;
[ObservableProperty]
- private NeoUI.Controls.Alert messageQueue = new();
+ public partial NeoUI.Controls.Alert MessageQueue { get; set; } = new();
[ObservableProperty]
- private string message;
+ public partial string Message { get; set; }
[RelayCommand]
private static void Closing()
diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/ArrangeMEPCurveViewModel.cs b/ShrlAlgoToolkit.RevitAddins/RvMEP/ArrangeMEPCurveViewModel.cs
index 7c83db0..e0303f9 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvMEP/ArrangeMEPCurveViewModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/ArrangeMEPCurveViewModel.cs
@@ -16,13 +16,14 @@ namespace ShrlAlgoToolkit.RevitAddins.RvMEP
private readonly ActionEventHandler arrangeHandler = new();
[ObservableProperty]
- private double gap = 250;
+ public partial double Gap { get; set; } = 250;
[ObservableProperty]
- private bool mEPCurveCenter = true;
+ public partial bool MEPCurveCenter { get; set; } = true;
[ObservableProperty]
- private bool isHorizon = true;
+ public partial bool IsHorizon { get; set; } = true;
+
[RelayCommand]
private void Arrange()
{
@@ -32,7 +33,7 @@ namespace ShrlAlgoToolkit.RevitAddins.RvMEP
var uidoc = uiapp.ActiveUIDocument;
var doc = uidoc.Document;
doc.Invoke(
- ts =>
+ _ =>
{
try
{
diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/CableLayoutViewModel.cs b/ShrlAlgoToolkit.RevitAddins/RvMEP/CableLayoutViewModel.cs
index 1382365..ae9500c 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvMEP/CableLayoutViewModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/CableLayoutViewModel.cs
@@ -13,15 +13,15 @@ public partial class CableLayoutViewModel : ObservableValidator
public CableLayoutViewModel(Document doc)
{
this.doc = doc;
- specifications = new FilteredElementCollector(doc).OfClass(typeof(ConduitType)).Cast().ToList();
+ Specifications = new FilteredElementCollector(doc).OfClass(typeof(ConduitType)).Cast().ToList();
}
[ObservableProperty]
- private ConduitType selectedConduitType;
+ public partial ConduitType SelectedConduitType { get; set; }
[Range(1, 20, ErrorMessage = "输入值有误!")]
[ObservableProperty]
[NotifyDataErrorInfo]
- private int count;
+ public partial int Count { get; set; }
//public int Count
//{
@@ -30,11 +30,13 @@ public partial class CableLayoutViewModel : ObservableValidator
//}
[ObservableProperty]
- private List specifications;
+ public partial List Specifications { get; set; }
+
[ObservableProperty]
- private ConduitSize size;
+ public partial ConduitSize Size { get; set; }
+
[ObservableProperty]
- private Dictionary sizes;
+ public partial Dictionary Sizes { get; set; }
[RelayCommand]
private void CloseWin(object obj)
diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/ClashReportViewModel.cs b/ShrlAlgoToolkit.RevitAddins/RvMEP/ClashReportViewModel.cs
index b1070ad..3141c33 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvMEP/ClashReportViewModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/ClashReportViewModel.cs
@@ -18,17 +18,18 @@ public partial class ClashReportViewModel(UIApplication uiapp) : ObservableObjec
{
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvMEP.ClashReportViewModel.RefreshCommand))]
- private string filePathName;
+ public partial string FilePathName { get; set; }
public UIApplication UiApp { get; set; } = uiapp;
[ObservableProperty]
- private bool inCurrentView = true;
- [ObservableProperty]
- private bool isSetSectionBox;
+ public partial bool InCurrentView { get; set; } = true;
+ [ObservableProperty]
+ public partial bool IsSetSectionBox { get; set; }
public DataTable DataSource { get; set; } = new DataTable();
[ObservableProperty]
- private DataTable currentViewItems = new();
+ public partial DataTable CurrentViewItems { get; set; } = new();
+
[RelayCommand]
private void LvScroll(ScrollViewer scrollViewer)
{
diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/ClashResolveViewModel.cs b/ShrlAlgoToolkit.RevitAddins/RvMEP/ClashResolveViewModel.cs
index ed254a1..06f7434 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvMEP/ClashResolveViewModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/ClashResolveViewModel.cs
@@ -18,27 +18,26 @@ namespace ShrlAlgoToolkit.RevitAddins.RvMEP;
public partial class ClashResolveViewModel : ObservableObject
{
[ObservableProperty]
- private AdjustDirection adjustDirection;
+ public partial AdjustDirection AdjustDirection { get; set; }
[ObservableProperty]
- private AdjustType adjustType = AdjustType.OneSide;
+ public partial AdjustType AdjustType { get; set; } = AdjustType.OneSide;
///
/// 正在执行命令
///
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvMEP.ClashResolveViewModel.ResolveCommand))]
- private bool canRunning = true;
+ public partial bool CanRunning { get; set; } = true;
[ObservableProperty]
- private double angle = 90.0;
+ public partial double Angle { get; set; } = 90.0;
[ObservableProperty]
- private double offset = 800;
+ public partial double Offset { get; set; } = 800;
[ObservableProperty]
- private LocationType locationType = LocationType.Manual;
-
+ public partial LocationType LocationType { get; set; } = LocationType.Manual;
public ActionEventHandler ActionEventHandler { get; } = new();
partial void OnLocationTypeChanged(LocationType value)
{
diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/CorrectMEPCurveSlopeCmd.cs b/ShrlAlgoToolkit.RevitAddins/RvMEP/CorrectMEPCurveSlopeCmd.cs
index b1b7d49..bf14075 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvMEP/CorrectMEPCurveSlopeCmd.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/CorrectMEPCurveSlopeCmd.cs
@@ -77,7 +77,7 @@ public class CorrectMEPCurveSlopeCmd : ExternalCommand
private void CorrectSlope()
{
var ids = UiDocument.Selection.GetElementIds();
- Document.Invoke(ts =>
+ Document.Invoke(_ =>
{
foreach (var id in ids)
{
diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/FlipWorkplaneCmd.cs b/ShrlAlgoToolkit.RevitAddins/RvMEP/FlipWorkplaneCmd.cs
index 3b6f98d..d4b2719 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvMEP/FlipWorkplaneCmd.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/FlipWorkplaneCmd.cs
@@ -25,7 +25,7 @@ namespace ShrlAlgoToolkit.RevitAddins.RvMEP
familyInstances = UiDocument.SelectObjects("请选择族实例");
}
Document.Invoke(
- ts =>
+ _ =>
{
foreach (var ins in familyInstances)
{
@@ -36,7 +36,7 @@ namespace ShrlAlgoToolkit.RevitAddins.RvMEP
}
});
}
- catch (Exception ex)
+ catch (Exception)
{
}
diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/HeadroomCheckViewModel.cs b/ShrlAlgoToolkit.RevitAddins/RvMEP/HeadroomCheckViewModel.cs
index 4418b23..19a3050 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvMEP/HeadroomCheckViewModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/HeadroomCheckViewModel.cs
@@ -29,7 +29,8 @@ public partial class HeadroomCheckViewModel : ObservableObject
private readonly Document document;
[ObservableProperty]
- private List rooms;
+ public partial List Rooms { get; set; }
+
private List GetRoomItems()
{
var roomItems = new List();
diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/InsulationItem.cs b/ShrlAlgoToolkit.RevitAddins/RvMEP/InsulationItem.cs
index b84c5ad..4620a18 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvMEP/InsulationItem.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/InsulationItem.cs
@@ -36,7 +36,8 @@ public partial class InsulationItem : ObservableValidator
[Range(10, 1000)]
[NotifyDataErrorInfo]
[ObservableProperty]
- private double thickness;
+ public partial double Thickness { get; set; }
+
//{
// get => thickness;
// set => SetProperty(ref thickness, value, true);
@@ -44,7 +45,8 @@ public partial class InsulationItem : ObservableValidator
//private double thickness;
[ObservableProperty]
- private PipeInsulationType pipeInsulationType;
+ public partial PipeInsulationType PipeInsulationType { get; set; }
+
[ObservableProperty]
- private DuctInsulationType ductInsulationType;
+ public partial DuctInsulationType DuctInsulationType { get; set; }
}
diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/MoveMEPCurveViewModel.cs b/ShrlAlgoToolkit.RevitAddins/RvMEP/MoveMEPCurveViewModel.cs
index f3ba78f..1180bce 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvMEP/MoveMEPCurveViewModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/MoveMEPCurveViewModel.cs
@@ -12,16 +12,17 @@ namespace ShrlAlgoToolkit.RevitAddins.RvMEP;
public partial class MoveMEPCurveViewModel : ObservableValidator
{
[ObservableProperty]
- private bool isSingle = true;
+ public partial bool IsSingle { get; set; } = true;
[ObservableProperty]
- private bool byDistance = true;
+ public partial bool ByDistance { get; set; } = true;
+
private readonly ActionEventHandler moveHandler = new();
[IsNumeric]
[ObservableProperty]
[NotifyDataErrorInfo]
- private double distance;
+ public partial double Distance { get; set; }
//public double Distance
//{
@@ -34,7 +35,7 @@ public partial class MoveMEPCurveViewModel : ObservableValidator
///
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvMEP.MoveMEPCurveViewModel.MoveCommand))]
- private bool canRunning = true;
+ public partial bool CanRunning { get; set; } = true;
[RelayCommand]
private void Closing()
diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/RoomCheckItem.cs b/ShrlAlgoToolkit.RevitAddins/RvMEP/RoomCheckItem.cs
index c59d69e..30b518a 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvMEP/RoomCheckItem.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/RoomCheckItem.cs
@@ -7,12 +7,15 @@ namespace ShrlAlgoToolkit.RevitAddins.RvMEP
public partial class RoomCheckItem : ObservableObject
{
[ObservableProperty]
- private bool isSelected;
+ public partial bool IsSelected { get; set; }
+
[ObservableProperty]
- private string name;
+ public partial string Name { get; set; }
+
[ObservableProperty]
- private Room room;
+ public partial Room Room { get; set; }
+
[ObservableProperty]
- private Color color;
+ public partial Color Color { get; set; }
}
}
diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/RotateMEPViewModel.cs b/ShrlAlgoToolkit.RevitAddins/RvMEP/RotateMEPViewModel.cs
index 50f8ac9..752ad9c 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvMEP/RotateMEPViewModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/RotateMEPViewModel.cs
@@ -13,9 +13,11 @@ namespace ShrlAlgoToolkit.RevitAddins.RvMEP
public partial class RotateMEPViewModel : ObservableObject
{
[ObservableProperty]
- private double angle = 90;
+ public partial double Angle { get; set; } = 90;
+
[ObservableProperty]
- private bool isSingleSelect = true;
+ public partial bool IsSingleSelect { get; set; } = true;
+
[RelayCommand]
private void RotateInstance()
{
@@ -83,7 +85,7 @@ namespace ShrlAlgoToolkit.RevitAddins.RvMEP
if (referConn != null)
{
doc.Invoke(
- ts =>
+ _ =>
{
ElementTransformUtils.RotateElement(
doc,
diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/StandMepCurveViewModel.cs b/ShrlAlgoToolkit.RevitAddins/RvMEP/StandMepCurveViewModel.cs
index 5b1c0ec..a057f0d 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvMEP/StandMepCurveViewModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/StandMepCurveViewModel.cs
@@ -26,64 +26,64 @@ public partial class StandMepCurveViewModel : ObservableObject
private readonly ActionEventHandler standMepCurveEventHandler = new();
[ObservableProperty]
- private IEnumerable cableTrayTypes;
+ public partial IEnumerable CableTrayTypes { get; set; }
[ObservableProperty]
- private IEnumerable conduitTypes;
+ public partial IEnumerable ConduitTypes { get; set; }
[ObservableProperty]
- private IEnumerable ductSystemTypes;
-
+ public partial IEnumerable DuctSystemTypes { get; set; }
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvMEP.StandMepCurveViewModel.CreateMepCurveCommand))]
- private IEnumerable ductTypes;
+ public partial IEnumerable DuctTypes { get; set; }
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvMEP.StandMepCurveViewModel.CreateMepCurveCommand))]
- private bool? isCableTray;
+ public partial bool? IsCableTray { get; set; }
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvMEP.StandMepCurveViewModel.CreateMepCurveCommand))]
- private bool? isConduit;
+ public partial bool? IsConduit { get; set; }
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvMEP.StandMepCurveViewModel.CreateMepCurveCommand))]
- private bool? isDuct;
+ public partial bool? IsDuct { get; set; }
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvMEP.StandMepCurveViewModel.CreateMepCurveCommand))]
- private bool? isPipe = true;
+ public partial bool? IsPipe { get; set; } = true;
[ObservableProperty]
- private IEnumerable pipeSystemTypes;
+ public partial IEnumerable PipeSystemTypes { get; set; }
[ObservableProperty]
- private IEnumerable pipeTypes;
+ public partial IEnumerable PipeTypes { get; set; }
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvMEP.StandMepCurveViewModel.CreateMepCurveCommand))]
- private CableTrayType selectedCableTrayType;
+ public partial CableTrayType SelectedCableTrayType { get; set; }
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvMEP.StandMepCurveViewModel.CreateMepCurveCommand))]
- private ConduitType selectedConduitType;
+ public partial ConduitType SelectedConduitType { get; set; }
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvMEP.StandMepCurveViewModel.CreateMepCurveCommand))]
- private MechanicalSystemType selectedDuctSystemType;
+ public partial MechanicalSystemType SelectedDuctSystemType { get; set; }
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvMEP.StandMepCurveViewModel.CreateMepCurveCommand))]
- private DuctType selectedDuctType;
+ public partial DuctType SelectedDuctType { get; set; }
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvMEP.StandMepCurveViewModel.CreateMepCurveCommand))]
- private PipingSystemType selectedPipeSystemType;
+ public partial PipingSystemType SelectedPipeSystemType { get; set; }
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvMEP.StandMepCurveViewModel.CreateMepCurveCommand))]
- private PipeType selectedPipeType;
+ public partial PipeType SelectedPipeType { get; set; }
+
partial void OnSelectedPipeTypeChanged(PipeType value)
{
var rule = value.RoutingPreferenceManager.GetRule(RoutingPreferenceRuleGroupType.Segments, 0);
@@ -92,7 +92,7 @@ public partial class StandMepCurveViewModel : ObservableObject
}
[ObservableProperty]
- private ICollection pipeSizes;
+ public partial ICollection PipeSizes { get; set; }
private bool isRunning;
diff --git a/ShrlAlgoToolkit.RevitAddins/RvMEP/SystemModel.cs b/ShrlAlgoToolkit.RevitAddins/RvMEP/SystemModel.cs
index 00e9d55..0d2ca7c 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvMEP/SystemModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvMEP/SystemModel.cs
@@ -18,27 +18,29 @@ namespace ShrlAlgoToolkit.RevitAddins.RvMEP
Abbreviation = systemType.Abbreviation;
}
[ObservableProperty]
- private System.Windows.Media.Brush backgroundColor;
+ public partial System.Windows.Media.Brush BackgroundColor { get; set; }
[ObservableProperty]
- private Color fillColor;
+ public partial Color FillColor { get; set; }
[ObservableProperty]
- private MEPSystemClassification mEPSystemClassification;
+ public partial MEPSystemClassification MEPSystemClassification { get; set; }
[ObservableProperty]
- private string name;
+ public partial string Name { get; set; }
+
[ObservableProperty]
- private PipeSystemType pipeSystemType;
+ public partial PipeSystemType PipeSystemType { get; set; }
+
//系统类型
[ObservableProperty]
- private MEPSystemType systemType;
+ public partial MEPSystemType SystemType { get; set; }
[ObservableProperty]
- private Color lineColor;
- [ObservableProperty]
- private string abbreviation;
+ public partial Color LineColor { get; set; }
+ [ObservableProperty]
+ public partial string Abbreviation { get; set; }
}
public enum MEPSystemClassification
diff --git a/ShrlAlgoToolkit.RevitAddins/RvView/AdaptiveMEPTagCmd.cs b/ShrlAlgoToolkit.RevitAddins/RvView/AdaptiveMEPTagCmd.cs
index c27729b..be86bb9 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvView/AdaptiveMEPTagCmd.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvView/AdaptiveMEPTagCmd.cs
@@ -36,7 +36,7 @@ public class AdaptiveMEPTagCmd : ExternalCommand
}
}
Document.Invoke(
- ts =>
+ _ =>
{
foreach (var item in toRotate)
{
diff --git a/ShrlAlgoToolkit.RevitAddins/RvView/AlignTagsView.xaml b/ShrlAlgoToolkit.RevitAddins/RvView/AlignTagsView.xaml
index 3ac5040..2cda68a 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvView/AlignTagsView.xaml
+++ b/ShrlAlgoToolkit.RevitAddins/RvView/AlignTagsView.xaml
@@ -16,19 +16,15 @@
-
+
-
+
\ No newline at end of file
diff --git a/ShrlAlgoToolkit.RevitAddins/RvView/AlignTagsViewModel.cs b/ShrlAlgoToolkit.RevitAddins/RvView/AlignTagsViewModel.cs
index 3e695dc..cf66da6 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvView/AlignTagsViewModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvView/AlignTagsViewModel.cs
@@ -8,10 +8,10 @@ namespace ShrlAlgoToolkit.RevitAddins.RvView;
public partial class AlignTagsViewModel : ObservableObject
{
- [ObservableProperty]
- private bool isAutomatic;
+ [ObservableProperty]
+ public partial bool IsAutomatic { get; set; }
- private List> groups = new();
+ private List> groups = new();
private readonly ActionEventHandler alignTagsHandler = new();
@@ -36,7 +36,7 @@ public partial class AlignTagsViewModel : ObservableObject
.ToList();
groups = GroupTags(independentTags);
document.InvokeGroup(
- tg =>
+ _ =>
{
foreach (var tags in groups)
{
diff --git a/ShrlAlgoToolkit.RevitAddins/RvView/ElementControlDock.xaml b/ShrlAlgoToolkit.RevitAddins/RvView/ElementControlDock.xaml
index 4e26c58..443ad17 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvView/ElementControlDock.xaml
+++ b/ShrlAlgoToolkit.RevitAddins/RvView/ElementControlDock.xaml
@@ -1,31 +1,31 @@
+ Background="{DynamicResource WindowBackground}"
+ mc:Ignorable="d">
+ Content="隐藏元素" />
+ ToolTip="在所有视图中隐藏该元素" />
+ Content="隐藏类别" />
-
+
-
+
-
+ Content="解锁类别" />
+
-
+ Content="隔离元素" />
+ Content="隔离类别" />
+
\ No newline at end of file
diff --git a/ShrlAlgoToolkit.RevitAddins/RvView/ElementControlDock.xaml.cs b/ShrlAlgoToolkit.RevitAddins/RvView/ElementControlDock.xaml.cs
index b7e9a28..ff14f6c 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvView/ElementControlDock.xaml.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvView/ElementControlDock.xaml.cs
@@ -43,7 +43,7 @@ public partial class ElementsControlDock : IDockablePaneProvider
var selectedIds = uidoc.Selection.GetElementIds();
var view = uidoc.ActiveView;
doc.Invoke(
- ts =>
+ _ =>
{
//隐藏元素
if (HideElements == btn)
diff --git a/ShrlAlgoToolkit.RevitAddins/RvView/QuickViewSectionViewModel.cs b/ShrlAlgoToolkit.RevitAddins/RvView/QuickViewSectionViewModel.cs
index a363f65..b560497 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvView/QuickViewSectionViewModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvView/QuickViewSectionViewModel.cs
@@ -14,7 +14,8 @@ namespace ShrlAlgoToolkit.RevitAddins.RvView
private readonly ActionEventHandler handler = new();
[ObservableProperty]
- private bool isParallel = true;
+ public partial bool IsParallel { get; set; } = true;
+
private readonly List viewSections = [];
[RelayCommand]
@@ -26,7 +27,7 @@ namespace ShrlAlgoToolkit.RevitAddins.RvView
var uidoc = uiapp.ActiveUIDocument;
var doc = uidoc.Document;
doc.Invoke(
- ts =>
+ _ =>
{
for (var i = viewSections.Count - 1; i >= 0; i--)
{
diff --git a/ShrlAlgoToolkit.RevitAddins/RvView/SectionBoxControllerViewModel.cs b/ShrlAlgoToolkit.RevitAddins/RvView/SectionBoxControllerViewModel.cs
index d0c6aa8..5f29ba8 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvView/SectionBoxControllerViewModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvView/SectionBoxControllerViewModel.cs
@@ -47,11 +47,14 @@ public partial class SectionBoxControllerViewModel : ObservableObject
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvView.SectionBoxControllerViewModel.RecordSectionBoxCommand), nameof(RevitAddins.RvView.SectionBoxControllerViewModel.UpdateSectionBoxCommand))]
- private bool canModify;
+ public partial bool CanModify { get; set; }
+
[ObservableProperty]
- private SectionBoxType sectionBoxType;
+ public partial SectionBoxType SectionBoxType { get; set; }
+
[ObservableProperty]
- private bool needExtend;
+ public partial bool NeedExtend { get; set; }
+
///
/// 记录剖面框修改
///
diff --git a/ShrlAlgoToolkit.RevitAddins/RvView/SystemDisplayViewModel.cs b/ShrlAlgoToolkit.RevitAddins/RvView/SystemDisplayViewModel.cs
index 12627c4..ad2777f 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvView/SystemDisplayViewModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvView/SystemDisplayViewModel.cs
@@ -13,10 +13,10 @@ public partial class SystemDisplayViewModel : ObservableRecipient, IRecipient systemsCollection;
+ [ObservableProperty]
+ public partial List SystemsCollection { get; set; }
- public SystemDisplayViewModel(UIApplication uiapp)
+ public SystemDisplayViewModel(UIApplication uiapp)
{
var doc = uiapp.ActiveUIDocument.Document;
var enumerable = doc.OfClass().Cast();
diff --git a/ShrlAlgoToolkit.RevitAddins/RvView/ViewManagerModel.cs b/ShrlAlgoToolkit.RevitAddins/RvView/ViewManagerModel.cs
index 2a31fc8..7684f93 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvView/ViewManagerModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvView/ViewManagerModel.cs
@@ -6,35 +6,35 @@ namespace ShrlAlgoToolkit.RevitAddins.RvView;
public partial class ViewManagerModel : ObservableObject
{
- [ObservableProperty]
- private UserViewDetailLevel? detailLevel;
+ [ObservableProperty]
+ public partial UserViewDetailLevel? DetailLevel { get; set; }
- [ObservableProperty]
+ [ObservableProperty]
private UserViewDiscipline? discipline;
- [ObservableProperty]
- private UserDisplayStyle displayStyle;
+ [ObservableProperty]
+ public partial UserDisplayStyle DisplayStyle { get; set; }
- [ObservableProperty]
+ [ObservableProperty]
private string name;
- [ObservableProperty]
- private int scale;
+ [ObservableProperty]
+ public partial int Scale { get; set; }
- [ObservableProperty]
+ [ObservableProperty]
private string sheetName;
- [ObservableProperty]
- private string sheetNumber;
+ [ObservableProperty]
+ public partial string SheetNumber { get; set; }
- [ObservableProperty]
+ [ObservableProperty]
private UserViewType userViewType;
public View View { get; set; }
- [ObservableProperty]
- private View viewTemplate;
- public List ViewTemplates { get; private set; }
+ [ObservableProperty]
+ public partial View ViewTemplate { get; set; }
+ public List ViewTemplates { get; private set; }
public ViewManagerModel(View view)
{
diff --git a/ShrlAlgoToolkit.RevitAddins/RvView/ViewManagerViewModel.cs b/ShrlAlgoToolkit.RevitAddins/RvView/ViewManagerViewModel.cs
index 5942bde..b87aa25 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvView/ViewManagerViewModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvView/ViewManagerViewModel.cs
@@ -16,28 +16,28 @@ public partial class ViewManagerViewModel : ObservableObject
{
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvView.ViewManagerViewModel.CopyAsDependentCommand))]
- private bool canCopyAsDependent;
+ public partial bool CanCopyAsDependent { get; set; }
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvView.ViewManagerViewModel.CopyOnlyCommand))]
- private bool canCopyOnly;
+ public partial bool CanCopyOnly { get; set; }
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvView.ViewManagerViewModel.CopyWithDetailCommand))]
- private bool canCopyWidthDetail;
+ public partial bool CanCopyWidthDetail { get; set; }
[ObservableProperty]
- ICollectionView filteredList;
+ public partial ICollectionView FilteredList { get; set; }
private readonly ActionEventHandler handler;
[ObservableProperty]
- string searchText;
+ public partial string SearchText { get; set; }
private List selectedItems;
[ObservableProperty]
- private List viewTemplates;
+ public partial List ViewTemplates { get; set; }
public ViewManagerViewModel(UIApplication uiapp)
{
@@ -272,7 +272,7 @@ public partial class ViewManagerViewModel : ObservableObject
{
var doc = uiapp.ActiveUIDocument.Document;
doc.Invoke(
- __ =>
+ _ =>
{
foreach (var model in list)
{
@@ -323,7 +323,7 @@ public partial class ViewManagerViewModel : ObservableObject
{
return;
}
- handler.Raise(uiapp =>
+ handler.Raise(_ =>
{
var list = items.Cast().ToList();
foreach (var model in list)
diff --git a/ShrlAlgoToolkit.RevitAddins/RvView/VisibilityViewModel.cs b/ShrlAlgoToolkit.RevitAddins/RvView/VisibilityViewModel.cs
index eb0e91b..0503594 100644
--- a/ShrlAlgoToolkit.RevitAddins/RvView/VisibilityViewModel.cs
+++ b/ShrlAlgoToolkit.RevitAddins/RvView/VisibilityViewModel.cs
@@ -13,28 +13,28 @@ public partial class VisibilityViewModel : ObservableObject
public ActionEventHandler VisibilityHandler { get; } = new();
[ObservableProperty]
- private bool wallChecked;
+ public partial bool WallChecked { get; set; }
[ObservableProperty]
- private bool floorChecked;
+ public partial bool FloorChecked { get; set; }
[ObservableProperty]
- private bool beamChecked;
+ public partial bool BeamChecked { get; set; }
[ObservableProperty]
- private bool mechanicalChecked;
+ public partial bool MechanicalChecked { get; set; }
[ObservableProperty]
- private bool columnChecked;
+ public partial bool ColumnChecked { get; set; }
[ObservableProperty]
- private bool plumbingChecked;
+ public partial bool PlumbingChecked { get; set; }
[ObservableProperty]
- private bool cableTrayChecked;
+ public partial bool CableTrayChecked { get; set; }
[ObservableProperty]
- private bool conduitChecked;
+ public partial bool ConduitChecked { get; set; }
partial void OnBeamCheckedChanged(bool value)
{
diff --git a/ShrlAlgoToolkit.RevitAddins/ShrlAlgoToolkit.RevitAddins.csproj b/ShrlAlgoToolkit.RevitAddins/ShrlAlgoToolkit.RevitAddins.csproj
index bfab7c3..7c833e6 100644
--- a/ShrlAlgoToolkit.RevitAddins/ShrlAlgoToolkit.RevitAddins.csproj
+++ b/ShrlAlgoToolkit.RevitAddins/ShrlAlgoToolkit.RevitAddins.csproj
@@ -156,7 +156,6 @@
-
diff --git a/ShrlAlgoToolkit.RevitAddins/UIRibbon/DrawingViewApp.cs b/ShrlAlgoToolkit.RevitAddins/UIRibbon/DrawingViewApp.cs
index fdc33de..ede910e 100644
--- a/ShrlAlgoToolkit.RevitAddins/UIRibbon/DrawingViewApp.cs
+++ b/ShrlAlgoToolkit.RevitAddins/UIRibbon/DrawingViewApp.cs
@@ -137,7 +137,7 @@ public class DrawingViewApp
// IsCheckable = true,
// Orientation = System.Windows.Controls.Orientation.Vertical,
//};
- tog.CheckStateChanged += (s, e) =>
+ tog.CheckStateChanged += (_, _) =>
{
zoomElementHandler.Raise(
uiapp =>
diff --git a/ShrlAlgoToolkit.RevitAddins/UIRibbon/RvApp.cs b/ShrlAlgoToolkit.RevitAddins/UIRibbon/RvApp.cs
index 31de4c9..5a3203e 100644
--- a/ShrlAlgoToolkit.RevitAddins/UIRibbon/RvApp.cs
+++ b/ShrlAlgoToolkit.RevitAddins/UIRibbon/RvApp.cs
@@ -37,9 +37,9 @@ public class RvApp : ExternalApplication
var doc = app.ActiveUIDocument.Document;
#if REVIT2018
- if (doc.IsModified && !string.IsNullOrEmpty(doc.PathName))
+ if (doc.IsModified && !string.IsNullOrEmpty(doc.PathName) && !doc.IsReadOnlyFile)
#else
- if (!doc.IsBackgroundCalculationInProgress() && doc.IsModified && !string.IsNullOrEmpty(doc.PathName))
+ if (!doc.IsBackgroundCalculationInProgress() && doc.IsModified && !string.IsNullOrEmpty(doc.PathName)&&!doc.IsReadOnlyFile)
#endif
{
try
diff --git a/ShrlAlgoToolkit.RevitAddins/WPFUI.xaml b/ShrlAlgoToolkit.RevitAddins/WPFUI.xaml
index 303bbc7..2a72ec3 100644
--- a/ShrlAlgoToolkit.RevitAddins/WPFUI.xaml
+++ b/ShrlAlgoToolkit.RevitAddins/WPFUI.xaml
@@ -1,24 +1,24 @@
+ mc:Ignorable="d">
-
+
pack://application:,,,/ShrlAlgoToolkit.RevitAddins;component/Fonts/#BoxIcons
- pack://application:,,,/ShrlAlgoToolkit.RevitAddins;component/Fonts/#Source Han Sans SC
+
-
+
-
+