优化空引用
This commit is contained in:
@@ -87,7 +87,7 @@ namespace Melskin.Appearance
|
|||||||
foreach (var key in dict.Keys.OfType<object>())
|
foreach (var key in dict.Keys.OfType<object>())
|
||||||
{
|
{
|
||||||
if (dict[key] is SolidColorBrush)
|
if (dict[key] is SolidColorBrush)
|
||||||
keys.Add(key.ToString());
|
keys.Add(key.ToString()!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,13 +85,13 @@ public class Cascader : Control
|
|||||||
|
|
||||||
private string GetObjectDisplayText(object? item)
|
private string GetObjectDisplayText(object? item)
|
||||||
{
|
{
|
||||||
if (item == null) return "";
|
if (item == null) return string.Empty;
|
||||||
if (!string.IsNullOrEmpty(DisplayMemberPath))
|
if (!string.IsNullOrEmpty(DisplayMemberPath))
|
||||||
{
|
{
|
||||||
var prop = item.GetType().GetProperty(DisplayMemberPath);
|
var prop = item.GetType().GetProperty(DisplayMemberPath);
|
||||||
return prop?.GetValue(item)?.ToString() ?? "";
|
return prop?.GetValue(item)?.ToString() ?? string.Empty;
|
||||||
}
|
}
|
||||||
return item.ToString();
|
return item.ToString()!;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建了完整的、非空的 CascadingPanel
|
// 创建了完整的、非空的 CascadingPanel
|
||||||
@@ -130,7 +130,7 @@ public class Cascader : Control
|
|||||||
private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.AddedItems.Count == 0) return;
|
if (e.AddedItems.Count == 0) return;
|
||||||
var selectedItem = e.AddedItems[0];
|
var selectedItem = e.AddedItems[0]!;
|
||||||
var currentMenu = sender as ItemsControl;
|
var currentMenu = sender as ItemsControl;
|
||||||
var parentPanel = CascadingPanel;
|
var parentPanel = CascadingPanel;
|
||||||
if (parentPanel == null) return;
|
if (parentPanel == null) return;
|
||||||
|
|||||||
@@ -31,8 +31,7 @@ namespace Melskin.Controls
|
|||||||
public override void OnApplyTemplate()
|
public override void OnApplyTemplate()
|
||||||
{
|
{
|
||||||
base.OnApplyTemplate();
|
base.OnApplyTemplate();
|
||||||
_editableTextBox = GetTemplateChild("PART_EditableTextBox") as TextBox;
|
if (GetTemplateChild("PART_EditableTextBox") is TextBox _editableTextBox)
|
||||||
if (_editableTextBox != null)
|
|
||||||
{
|
{
|
||||||
_editableTextBox.TextChanged += OnEditableTextBoxTextChanged;
|
_editableTextBox.TextChanged += OnEditableTextBoxTextChanged;
|
||||||
// 点击时全选
|
// 点击时全选
|
||||||
@@ -100,7 +99,7 @@ namespace Melskin.Controls
|
|||||||
var prop = item.GetType().GetProperty(path);
|
var prop = item.GetType().GetProperty(path);
|
||||||
if (prop != null) return prop.GetValue(item)?.ToString() ?? string.Empty;
|
if (prop != null) return prop.GetValue(item)?.ToString() ?? string.Empty;
|
||||||
}
|
}
|
||||||
return item.ToString();
|
return item.ToString()!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,6 @@
|
|||||||
using Autodesk.Revit.Attributes;
|
using Autodesk.Revit.Attributes;
|
||||||
using Nice3point.Revit.Toolkit.External;
|
using Nice3point.Revit.Toolkit.External;
|
||||||
|
|
||||||
using ShrlAlgoToolkit.RevitAddins.RvCommon;
|
|
||||||
using ShrlAlgoToolkit;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins.General;
|
|
||||||
using ShrlAlgoToolkit;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins;
|
|
||||||
|
|
||||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||||
[Transaction(TransactionMode.Manual)]
|
[Transaction(TransactionMode.Manual)]
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
using ShrlAlgoToolkit.RevitAddins.RvCommon;
|
|
||||||
using ShrlAlgoToolkit;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins.General;
|
|
||||||
using ShrlAlgoToolkit;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins;
|
|
||||||
|
|
||||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// QuickSelectionView.xaml 的交互逻辑
|
/// QuickSelectionView.xaml 的交互逻辑
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class CADCurveToModelCurveCmd : ExternalCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Autodesk.Revit.Exceptions.OperationCanceledException ex)
|
catch (Autodesk.Revit.Exceptions.OperationCanceledException)
|
||||||
{
|
{
|
||||||
if (trans.GetStatus() == TransactionStatus.Started)
|
if (trans.GetStatus() == TransactionStatus.Started)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,13 +1,6 @@
|
|||||||
using Autodesk.Revit.Attributes;
|
using Autodesk.Revit.Attributes;
|
||||||
using Nice3point.Revit.Toolkit.External;
|
using Nice3point.Revit.Toolkit.External;
|
||||||
|
|
||||||
using ShrlAlgoToolkit.RevitAddins.RvCommon;
|
|
||||||
using ShrlAlgoToolkit;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins.General;
|
|
||||||
using ShrlAlgoToolkit;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins;
|
|
||||||
|
|
||||||
namespace ShrlAlgoToolkit.RevitAddins.Standardizer;
|
namespace ShrlAlgoToolkit.RevitAddins.Standardizer;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 合并共享参数
|
/// 合并共享参数
|
||||||
|
|||||||
@@ -8,13 +8,6 @@ using Autodesk.Revit.UI.Selection;
|
|||||||
|
|
||||||
using Nice3point.Revit.Toolkit.External;
|
using Nice3point.Revit.Toolkit.External;
|
||||||
|
|
||||||
using ShrlAlgoToolkit.RevitAddins.RvCommon;
|
|
||||||
using ShrlAlgoToolkit;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins.General;
|
|
||||||
using ShrlAlgoToolkit;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins;
|
|
||||||
|
|
||||||
namespace ShrlAlgoToolkit.RevitAddins.Standardizer;
|
namespace ShrlAlgoToolkit.RevitAddins.Standardizer;
|
||||||
|
|
||||||
[Transaction(TransactionMode.Manual)]
|
[Transaction(TransactionMode.Manual)]
|
||||||
|
|||||||
@@ -1,13 +1,6 @@
|
|||||||
using Autodesk.Revit.Attributes;
|
using Autodesk.Revit.Attributes;
|
||||||
using Nice3point.Revit.Toolkit.External;
|
using Nice3point.Revit.Toolkit.External;
|
||||||
|
|
||||||
using ShrlAlgoToolkit.RevitAddins.ModelManager;
|
|
||||||
using ShrlAlgoToolkit;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins.General;
|
|
||||||
using ShrlAlgoToolkit;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins;
|
|
||||||
|
|
||||||
namespace ShrlAlgoToolkit.RevitAddins.Standardizer;
|
namespace ShrlAlgoToolkit.RevitAddins.Standardizer;
|
||||||
|
|
||||||
[Transaction(TransactionMode.Manual)]
|
[Transaction(TransactionMode.Manual)]
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
using ShrlAlgoToolkit.RevitAddins.ModelManager;
|
|
||||||
using ShrlAlgoToolkit;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins.General;
|
|
||||||
using ShrlAlgoToolkit;
|
|
||||||
using ShrlAlgoToolkit.RevitAddins;
|
|
||||||
|
|
||||||
namespace ShrlAlgoToolkit.RevitAddins.Standardizer;
|
namespace ShrlAlgoToolkit.RevitAddins.Standardizer;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// TemplateManagerView.xaml 的交互逻辑
|
/// TemplateManagerView.xaml 的交互逻辑
|
||||||
|
|||||||
Reference in New Issue
Block a user