清理多余引用
This commit is contained in:
@@ -8,15 +8,11 @@ internal class RelayCommand : ICommand
|
||||
{
|
||||
private readonly Action<object?> execute;
|
||||
private readonly Predicate<object?>? canExecute;
|
||||
|
||||
/// <summary>
|
||||
/// 当命令的可执行状态更改时发生的事件。
|
||||
/// 广播此事件通知UI,当命令的CanExecute方法返回值发生变化时,需要重新查询命令的状态。
|
||||
/// 当命令的可执行状态更改时发生的事件。 广播此事件通知UI,当命令的CanExecute方法返回值发生变化时,需要重新查询命令的状态。
|
||||
/// </summary>
|
||||
public event EventHandler? CanExecuteChanged
|
||||
{
|
||||
add => CommandManager.RequerySuggested += value;
|
||||
remove => CommandManager.RequerySuggested -= value;
|
||||
}
|
||||
public event EventHandler? CanExecuteChanged;
|
||||
/// <summary>
|
||||
/// 初始化 RelayCommand 的新实例。
|
||||
/// </summary>
|
||||
@@ -43,8 +39,12 @@ internal class RelayCommand : ICommand
|
||||
public void Execute(object? parameter) => execute(parameter);
|
||||
|
||||
/// <summary>
|
||||
/// 通知命令管理器重新查询此命令的 CanExecute 状态,手动更新,应对一些特殊场景,如倒计时功能结束,手动调用刷新按钮状态。
|
||||
/// 手动通知 UI 刷新此按钮的状态。
|
||||
/// </summary>
|
||||
public void RaiseCanExecuteChanged() => CommandManager.InvalidateRequerySuggested();
|
||||
public void RaiseCanExecuteChanged()
|
||||
{
|
||||
// 触发事件,通知订阅了此命令的 UI 控件
|
||||
CanExecuteChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,15 +25,10 @@ namespace Melskin.Utilities
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当命令的可执行状态更改时触发的事件。
|
||||
/// 广播此事件允许UI元素订阅并响应命令可执行性变化,从而能够适时更新其状态(如启用或禁用按钮)。
|
||||
/// 当命令的可执行状态更改时触发的事件。 广播此事件允许UI元素订阅并响应命令可执行性变化,从而能够适时更新其状态(如启用或禁用按钮)。
|
||||
/// 通过将此事件与CommandManager.RequerySuggested关联,可以确保每当应用程序中的命令状态可能改变时,UI都会自动检查命令是否仍然可执行。
|
||||
/// </summary>
|
||||
public event EventHandler? CanExecuteChanged
|
||||
{
|
||||
add => CommandManager.RequerySuggested += value;
|
||||
remove => CommandManager.RequerySuggested -= value;
|
||||
}
|
||||
public event EventHandler? CanExecuteChanged;
|
||||
|
||||
/// <summary>
|
||||
/// 判断命令是否可以执行。
|
||||
@@ -45,8 +40,7 @@ namespace Melskin.Utilities
|
||||
if (canExecute == null) return true;
|
||||
|
||||
// 使用安全的类型获取机制,防止 InvalidCastException
|
||||
T? validParameter = GetSafeParameter(parameter);
|
||||
return canExecute(validParameter);
|
||||
return canExecute(GetSafeParameter(parameter));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -55,15 +49,17 @@ namespace Melskin.Utilities
|
||||
/// <param name="parameter">传递给命令的参数。</param>
|
||||
public void Execute(object? parameter)
|
||||
{
|
||||
T? validParameter = GetSafeParameter(parameter);
|
||||
execute(validParameter);
|
||||
execute(GetSafeParameter(parameter));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通知命令管理器重新查询此命令的CanExecute状态。
|
||||
/// 此方法用于在命令执行条件可能已更改时更新UI,手动更新,应对一些特殊场景,如倒计时功能结束,手动调用刷新按钮状态
|
||||
/// 此方法用于在命令执行条件可能已更改时更新UI
|
||||
/// </summary>
|
||||
public void RaiseCanExecuteChanged() => CommandManager.InvalidateRequerySuggested();
|
||||
public void RaiseCanExecuteChanged()
|
||||
{
|
||||
CanExecuteChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
/// <summary>
|
||||
/// 安全地将 object 参数转换为泛型 T。如果类型不匹配,则返回 T 的默认值。
|
||||
/// </summary>
|
||||
|
||||
@@ -12,7 +12,7 @@ public class CivilConnectionCmd : ExternalCommand
|
||||
{
|
||||
try
|
||||
{
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<ResolveCivilConnectView, ResolveCivilConnectViewModel>(UiDocument);
|
||||
WinDialogAssist.ShowOrActivate<ResolveCivilConnectView, ResolveCivilConnectViewModel>(UiDocument);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ public class CreateOpeningsCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<CreateOpeningsView, CreateOpeningsViewModel>();
|
||||
WinDialogAssist.ShowOrActivate<CreateOpeningsView, CreateOpeningsViewModel>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -474,7 +474,7 @@ public partial class ResolveCivilConnectViewModel : ObservableObject
|
||||
|
||||
if (elementsToSkip.Any())
|
||||
{
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<MessageWin, MessageViewModel>(uidoc, elementsToSkip, "未解决构件");
|
||||
WinDialogAssist.ShowOrActivate<MessageWin, MessageViewModel>(uidoc, elementsToSkip, "未解决构件");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -134,7 +134,7 @@ public class SplitComsByLevelCmd : ExternalCommand
|
||||
|
||||
if (errors.Any())
|
||||
{
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<MessageWin, MessageViewModel>(UiDocument, errors, "未解决错误");
|
||||
WinDialogAssist.ShowOrActivate<MessageWin, MessageViewModel>(UiDocument, errors, "未解决错误");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace ShrlAlgoToolkit.RevitAddins.RvCivil
|
||||
public override void Execute()
|
||||
{
|
||||
var wallTypes = Document.OfCollector().OfClass(typeof(WallType)).Cast<WallType>().ToList();
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<WallFinishesView, WallFinishesViewModel>(wallTypes);
|
||||
WinDialogAssist.ShowOrActivate<WallFinishesView, WallFinishesViewModel>(wallTypes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,18 +13,18 @@ public partial class WallFinishesViewModel(List<WallType> wallTypes) : Observabl
|
||||
private readonly ActionEventHandler wallFinishHandler = new ();
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvCivil.WallFinishesViewModel.PlaceWallCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(PlaceWallCommand))]
|
||||
public partial double WallBaseOffset { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvCivil.WallFinishesViewModel.PlaceWallCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(PlaceWallCommand))]
|
||||
private double wallHeight;
|
||||
|
||||
[ObservableProperty]
|
||||
public partial List<WallType> WallTypes { get; set; } = wallTypes;
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvCivil.WallFinishesViewModel.PlaceWallCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(PlaceWallCommand))]
|
||||
private WallType selectedWallType;
|
||||
|
||||
public PlacementType PlaceType { get; set; }
|
||||
@@ -58,7 +58,7 @@ public partial class WallFinishesViewModel(List<WallType> wallTypes) : Observabl
|
||||
PlaceWallFinishesByFace(uiapp, SelectedWallType, wallWidth, WallHeight, WallBaseOffset);
|
||||
break;
|
||||
*/
|
||||
WallFinishesViewModel.PlaceWallFinishesByFace(uidoc, SelectedWallType, wallWidth, WallHeight, WallBaseOffset);
|
||||
PlaceWallFinishesByFace(uidoc, SelectedWallType, wallWidth, WallHeight, WallBaseOffset);
|
||||
break;
|
||||
case PlacementType.ByWall:
|
||||
PlaceWallFinishesByWall(uidoc, SelectedWallType, wallWidth, WallHeight, WallBaseOffset);
|
||||
|
||||
@@ -9,5 +9,5 @@ namespace ShrlAlgoToolkit.RevitAddins.ModelManager;
|
||||
[UsedImplicitly]
|
||||
public class ModelCheckCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute() => Common.Assists.WinDialogAssist.ShowOrActivate<ModelCheckView, ModelCheckViewModel>(UiApplication);//ModelCheckView view = SingletonViewAssist<ModelCheckView>.GetInstance(out var isNewCreate);//if (isNewCreate)//{// view.DataContext = new ModelCheckViewModel(uiApplication);// view.ShowAhead();//}//view.Activate();
|
||||
public override void Execute() => WinDialogAssist.ShowOrActivate<ModelCheckView, ModelCheckViewModel>(UiApplication);//ModelCheckView view = SingletonViewAssist<ModelCheckView>.GetInstance(out var isNewCreate);//if (isNewCreate)//{// view.DataContext = new ModelCheckViewModel(uiApplication);// view.ShowAhead();//}//view.Activate();
|
||||
}
|
||||
@@ -3,10 +3,6 @@ using ACadSharp.Entities;
|
||||
|
||||
using Autodesk.Revit.DB;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
public static class DWGAssist
|
||||
|
||||
@@ -86,7 +86,7 @@ public static class ImageAssist
|
||||
/// <returns></returns>
|
||||
public static BitmapSource LoadFileImage(string filename, int width, int height)
|
||||
{
|
||||
var bm = Assists.WindowsThumbnailProvider.GetThumbnail(filename, width, height, Assists.ThumbnailOptions.None);
|
||||
var bm = WindowsThumbnailProvider.GetThumbnail(filename, width, height, ThumbnailOptions.None);
|
||||
return Imaging.CreateBitmapSourceFromHBitmap(
|
||||
bm.GetHbitmap(),
|
||||
IntPtr.Zero,
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
public static class LogAssist
|
||||
@@ -20,7 +16,7 @@ public static class LogAssist
|
||||
{
|
||||
if (logFolder == default)
|
||||
{
|
||||
var assemblyPath = typeof(Assists.LogAssist).Assembly.Location;
|
||||
var assemblyPath = typeof(LogAssist).Assembly.Location;
|
||||
var directory = Path.GetDirectoryName(assemblyPath);
|
||||
logFolder = Path.Combine(directory, "Logs");
|
||||
}
|
||||
@@ -46,7 +42,7 @@ public static class LogAssist
|
||||
{
|
||||
if (logFolder == default)
|
||||
{
|
||||
var assemblyPath = typeof(Assists.LogAssist).Assembly.Location;
|
||||
var assemblyPath = typeof(LogAssist).Assembly.Location;
|
||||
var directory = Path.GetDirectoryName(assemblyPath);
|
||||
logFolder = $"{directory}\\Logs";
|
||||
}
|
||||
@@ -81,7 +77,7 @@ public static class LogAssist
|
||||
{
|
||||
var filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + $"\\{fileName}.txt";
|
||||
File.WriteAllText(filePath, sb.ToString());
|
||||
System.Diagnostics.Process.Start(filePath);
|
||||
Process.Start(filePath);
|
||||
}
|
||||
|
||||
public static void WriteTextFile(this string lineContent, string filePath)
|
||||
@@ -132,10 +128,10 @@ public static class LogAssist
|
||||
}
|
||||
|
||||
var t = ex.GetType();
|
||||
var currentUICulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
|
||||
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CN");
|
||||
var currentUICulture = Thread.CurrentThread.CurrentUICulture;
|
||||
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CN");
|
||||
var o = Activator.CreateInstance(t);
|
||||
System.Threading.Thread.CurrentThread.CurrentUICulture = currentUICulture;
|
||||
Thread.CurrentThread.CurrentUICulture = currentUICulture;
|
||||
|
||||
return ((Exception)o).Message;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System.Windows;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
public sealed record SingletonViewAssist<T>
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
using System.Windows;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Assists
|
||||
{
|
||||
public class TextSearchAssist
|
||||
{
|
||||
// Using a DependencyProperty as the backing store for IsTextMatch. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty IsTextMatchProperty =
|
||||
DependencyProperty.RegisterAttached("IsTextMatch", typeof(bool), typeof(Assists.TextSearchAssist), new UIPropertyMetadata(false));
|
||||
DependencyProperty.RegisterAttached("IsTextMatch", typeof(bool), typeof(TextSearchAssist), new UIPropertyMetadata(false));
|
||||
|
||||
// Using a DependencyProperty as the backing store for SearchValue. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty SearchValueProperty =
|
||||
DependencyProperty.RegisterAttached("SearchValue", typeof(string), typeof(Assists.TextSearchAssist),
|
||||
DependencyProperty.RegisterAttached("SearchValue", typeof(string), typeof(TextSearchAssist),
|
||||
new FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.Inherits));
|
||||
|
||||
public static bool GetIsTextMatch(DependencyObject obj)
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
public enum ThumbnailOptions
|
||||
{
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
|
||||
@@ -43,32 +42,6 @@ public static class WinDialogAssist
|
||||
return dialog;
|
||||
//return $"{filterName}({str})|{str}";
|
||||
}
|
||||
/// <summary>
|
||||
/// 释放命令行管理程序分配的ITEMIDLIST结构
|
||||
/// Frees an ITEMIDLIST structure allocated by the Shell.
|
||||
/// </summary>
|
||||
/// <param name="pidlList"></param>
|
||||
[DllImport("shell32.dll", ExactSpelling = true)]
|
||||
private static extern void ILFree(IntPtr pidlList);
|
||||
/// <summary>
|
||||
/// 返回与指定文件路径关联的ITEMIDLIST结构。
|
||||
/// Returns the ITEMIDLIST structure associated with a specified file path.
|
||||
/// </summary>
|
||||
/// <param name="pszPath"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("shell32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
|
||||
private static extern IntPtr ILCreateFromPathW(string pszPath);
|
||||
/// <summary>
|
||||
/// 打开一个Windows资源管理器窗口,其中选择了特定文件夹中的指定项目。
|
||||
/// Opens a Windows Explorer window with specified items in a particular folder selected.
|
||||
/// </summary>
|
||||
/// <param name="pidlList"></param>
|
||||
/// <param name="cild"></param>
|
||||
/// <param name="children"></param>
|
||||
/// <param name="dwFlags"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("shell32.dll", ExactSpelling = true)]
|
||||
private static extern int SHOpenFolderAndSelectItems(IntPtr pidlList, uint cild, IntPtr children, uint dwFlags);
|
||||
|
||||
/// <summary>
|
||||
/// 打开或在现有目录并选中相应文件
|
||||
@@ -82,7 +55,7 @@ public static class WinDialogAssist
|
||||
{
|
||||
throw new FileNotFoundException("指定的文件不存在", fileFullName);
|
||||
}
|
||||
var proc = new System.Diagnostics.Process();
|
||||
var proc = new Process();
|
||||
proc.StartInfo.FileName = "explorer";
|
||||
//打开资源管理器
|
||||
proc.StartInfo.Arguments = "/select," + fileFullName;
|
||||
@@ -102,7 +75,7 @@ public static class WinDialogAssist
|
||||
////选中"notepad.exe"这个程序,即记事本
|
||||
//proc.Start();
|
||||
|
||||
System.Diagnostics.Process.Start("explorer.exe", $"/select,\"{fileOrFolderPath}\"");
|
||||
Process.Start("explorer.exe", $"/select,\"{fileOrFolderPath}\"");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -123,12 +96,12 @@ public static class WinDialogAssist
|
||||
dialog.SetFilter(title, extensions);
|
||||
return dialog.ShowDialog() == true ? dialog.FileName : null;
|
||||
}
|
||||
public static void UpdateViewDisplay(Autodesk.Revit.UI.PreviewControl _currentPreviewControl, System.Windows.Controls.Grid PreviewContainer, Document _backgroundDoc, View view, ViewDetailLevel detailLevel, DisplayStyle displayStyle)
|
||||
public static void UpdateViewDisplay(PreviewControl currentPreviewControl, System.Windows.Controls.Grid previewContainer, Document backgroundDoc, View view, ViewDetailLevel detailLevel, DisplayStyle displayStyle)
|
||||
{
|
||||
if (_backgroundDoc == null || view == null) return;
|
||||
if (backgroundDoc == null || view == null) return;
|
||||
|
||||
_backgroundDoc.Invoke(
|
||||
ts =>
|
||||
backgroundDoc.Invoke(
|
||||
_ =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -142,48 +115,25 @@ public static class WinDialogAssist
|
||||
});
|
||||
|
||||
// 2. 销毁旧控件
|
||||
if (_currentPreviewControl != null)
|
||||
if (currentPreviewControl != null)
|
||||
{
|
||||
PreviewContainer.Children.Clear();
|
||||
_currentPreviewControl.Dispose();
|
||||
_currentPreviewControl = null;
|
||||
previewContainer.Children.Clear();
|
||||
currentPreviewControl.Dispose();
|
||||
currentPreviewControl = null;
|
||||
}
|
||||
|
||||
// 3. 创建新控件并加入 UI
|
||||
_currentPreviewControl = new Autodesk.Revit.UI.PreviewControl(_backgroundDoc, view.Id);
|
||||
PreviewContainer.Children.Add(_currentPreviewControl);
|
||||
currentPreviewControl = new PreviewControl(backgroundDoc, view.Id);
|
||||
previewContainer.Children.Add(currentPreviewControl);
|
||||
}
|
||||
///// <summary>
|
||||
///// 单选文件夹路径
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//public static string GetSelectedFolderPath()
|
||||
//{
|
||||
// var dialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog { Multiselect = false };
|
||||
|
||||
// var folderPath = dialog.ShowDialog() == true ? dialog.SelectedPath : null;
|
||||
|
||||
// return folderPath;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 多选文件夹路径
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//public static string[] GetSelectedFolderPaths()
|
||||
//{
|
||||
// var dialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog { Multiselect = true };
|
||||
|
||||
// return dialog.ShowDialog() == true ? dialog.SelectedPaths : null;
|
||||
//}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 打开窗口,非模态窗口置顶显示,默认非模态
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static void ShowAhead(this Window window)
|
||||
{
|
||||
_ = new WindowInteropHelper(window) { Owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle };
|
||||
_ = new WindowInteropHelper(window) { Owner = Process.GetCurrentProcess().MainWindowHandle };
|
||||
window.Show();
|
||||
}
|
||||
|
||||
@@ -191,7 +141,7 @@ public static class WinDialogAssist
|
||||
where T : Window, new()
|
||||
{
|
||||
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
|
||||
var view = Assists.SingletonViewAssist<T>.GetInstance(out var isNewCreate);
|
||||
var view = SingletonViewAssist<T>.GetInstance(out var isNewCreate);
|
||||
if (isNewCreate)
|
||||
{
|
||||
view.DataContext = viewModel;
|
||||
@@ -201,36 +151,29 @@ public static class WinDialogAssist
|
||||
AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
|
||||
}
|
||||
|
||||
private static readonly Dictionary<Type, Window> _windows = [];
|
||||
private static readonly Dictionary<Type, Window> Windows = [];
|
||||
public static void ShowOrActivate<TView, TViewModel>(params object[] viewModelParams)
|
||||
where TView : Window,new()
|
||||
where TViewModel : class
|
||||
{
|
||||
var windowType = typeof(TView);
|
||||
if (!_windows.ContainsKey(windowType) || _windows[windowType] == null)
|
||||
if (!Windows.ContainsKey(windowType) || Windows[windowType] == null)
|
||||
{
|
||||
//CloseAllWindowsExcept(windowType);
|
||||
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
|
||||
_windows[windowType] = new TView();
|
||||
_windows[windowType].Closed += WindowClosed;
|
||||
_windows[windowType].Closed += (_, _) => _windows[windowType] = null;
|
||||
if (_windows[windowType].DataContext == null || !(_windows[windowType].DataContext is TViewModel))
|
||||
Windows[windowType] = new TView();
|
||||
Windows[windowType].Closed += WindowClosed;
|
||||
Windows[windowType].Closed += (_, _) => Windows[windowType] = null;
|
||||
if (Windows[windowType].DataContext == null || !(Windows[windowType].DataContext is TViewModel))
|
||||
{
|
||||
if (viewModelParams.Length == 0)
|
||||
{
|
||||
_windows[windowType].DataContext = Activator.CreateInstance(typeof(TViewModel));
|
||||
}
|
||||
else
|
||||
{
|
||||
_windows[windowType].DataContext = Activator.CreateInstance(typeof(TViewModel), viewModelParams);
|
||||
}
|
||||
Windows[windowType].DataContext = viewModelParams.Length == 0 ? Activator.CreateInstance(typeof(TViewModel)) : Activator.CreateInstance(typeof(TViewModel), viewModelParams);
|
||||
}
|
||||
_ = new WindowInteropHelper(_windows[windowType]) { Owner = Process.GetCurrentProcess().MainWindowHandle };
|
||||
_windows[windowType].Show();
|
||||
_ = new WindowInteropHelper(Windows[windowType]) { Owner = Process.GetCurrentProcess().MainWindowHandle };
|
||||
Windows[windowType].Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
_windows[windowType].Activate();
|
||||
Windows[windowType].Activate();
|
||||
}
|
||||
}
|
||||
private static void WindowClosed(object sender, EventArgs e)
|
||||
@@ -242,16 +185,11 @@ public static class WinDialogAssist
|
||||
where TWindow : Window, new()
|
||||
where TViewModel : class
|
||||
{
|
||||
var window = new TWindow();
|
||||
if (viewModelParams.Length == 0)
|
||||
var window = new TWindow
|
||||
{
|
||||
window.DataContext = Activator.CreateInstance(typeof(TViewModel));
|
||||
}
|
||||
else
|
||||
{
|
||||
window.DataContext = Activator.CreateInstance(typeof(TViewModel), viewModelParams);
|
||||
}
|
||||
_ = new WindowInteropHelper(window) { Owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle };
|
||||
DataContext = viewModelParams.Length == 0 ? Activator.CreateInstance(typeof(TViewModel)) : Activator.CreateInstance(typeof(TViewModel), viewModelParams)
|
||||
};
|
||||
_ = new WindowInteropHelper(window) { Owner = Process.GetCurrentProcess().MainWindowHandle };
|
||||
window.ShowDialog();
|
||||
}
|
||||
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
|
||||
@@ -264,9 +202,9 @@ public static class WinDialogAssist
|
||||
|
||||
string name = new AssemblyName(args.Name).Name;
|
||||
List<string> list = new List<string>();
|
||||
for (int i = 0; i < frames.Length; i++)
|
||||
foreach (var t in frames)
|
||||
{
|
||||
MethodBase method = frames[i].GetMethod();
|
||||
MethodBase method = t.GetMethod();
|
||||
if ((object)method.DeclaringType == null)
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -3,10 +3,6 @@ using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
|
||||
/// <summary>
|
||||
@@ -20,7 +16,7 @@ public class WindowsThumbnailProvider
|
||||
{
|
||||
var result = new Bitmap(srcBitmap.Width, srcBitmap.Height, targetPixelFormat);
|
||||
|
||||
var bmpBounds = new System.Drawing.Rectangle(0, 0, srcBitmap.Width, srcBitmap.Height);
|
||||
var bmpBounds = new Rectangle(0, 0, srcBitmap.Width, srcBitmap.Height);
|
||||
|
||||
var srcData = srcBitmap.LockBits(bmpBounds, ImageLockMode.ReadOnly, srcBitmap.PixelFormat);
|
||||
|
||||
@@ -32,7 +28,7 @@ public class WindowsThumbnailProvider
|
||||
{
|
||||
for (var x = 0; x <= srcData.Width - 1; x++)
|
||||
{
|
||||
var pixelColor = System.Drawing.Color.FromArgb(Marshal.ReadInt32(srcData.Scan0, (srcData.Stride * y) + (4 * x)));
|
||||
var pixelColor = Color.FromArgb(Marshal.ReadInt32(srcData.Scan0, (srcData.Stride * y) + (4 * x)));
|
||||
|
||||
if ((pixelColor.A > 0) & (pixelColor.A < 255))
|
||||
{
|
||||
@@ -58,7 +54,7 @@ public class WindowsThumbnailProvider
|
||||
return Image.GetPixelFormatSize(bmp.PixelFormat) < 32 ? bmp : CreateAlphaBitmap(bmp, PixelFormat.Format32bppArgb);
|
||||
}
|
||||
|
||||
public static Bitmap GetThumbnail(string fileName, int width, int height, Assists.ThumbnailOptions options)
|
||||
public static Bitmap GetThumbnail(string fileName, int width, int height, ThumbnailOptions options)
|
||||
{
|
||||
var hBitmap = GetHBitmap(Path.GetFullPath(fileName), width, height, options);
|
||||
|
||||
@@ -84,10 +80,10 @@ public class WindowsThumbnailProvider
|
||||
// The following parameter is not used - binding context.
|
||||
IntPtr pbc,
|
||||
ref Guid riid,
|
||||
[MarshalAs(UnmanagedType.Interface)] out Assists.WindowsThumbnailProvider.IShellItem shellItem
|
||||
[MarshalAs(UnmanagedType.Interface)] out IShellItem shellItem
|
||||
);
|
||||
|
||||
private static IntPtr GetHBitmap(string fileName, int width, int height, Assists.ThumbnailOptions options)
|
||||
private static IntPtr GetHBitmap(string fileName, int width, int height, ThumbnailOptions options)
|
||||
{
|
||||
var shellItem2Guid = new Guid(ShellItem2Guid);
|
||||
var retCode = SHCreateItemFromParsingName(fileName, IntPtr.Zero, ref shellItem2Guid, out var nativeShellItem);
|
||||
@@ -97,13 +93,13 @@ public class WindowsThumbnailProvider
|
||||
throw Marshal.GetExceptionForHR(retCode);
|
||||
}
|
||||
|
||||
var nativeSize = new Assists.WindowsThumbnailProvider.NativeSize { Width = width, Height = height };
|
||||
var nativeSize = new NativeSize { Width = width, Height = height };
|
||||
|
||||
var hr = ((Assists.WindowsThumbnailProvider.IShellItemImageFactory)nativeShellItem).GetImage(nativeSize, options, out var hBitmap);
|
||||
var hr = ((IShellItemImageFactory)nativeShellItem).GetImage(nativeSize, options, out var hBitmap);
|
||||
|
||||
Marshal.ReleaseComObject(nativeShellItem);
|
||||
|
||||
return hr == Assists.WindowsThumbnailProvider.HResult.Ok ? hBitmap : throw Marshal.GetExceptionForHR((int)hr);
|
||||
return hr == HResult.Ok ? hBitmap : throw Marshal.GetExceptionForHR((int)hr);
|
||||
}
|
||||
|
||||
internal enum HResult
|
||||
@@ -130,13 +126,13 @@ public class WindowsThumbnailProvider
|
||||
{
|
||||
void BindToHandler(IntPtr pbc, [MarshalAs(UnmanagedType.LPStruct)] Guid bhid, [MarshalAs(UnmanagedType.LPStruct)] Guid riid, out IntPtr ppv);
|
||||
|
||||
void Compare(Assists.WindowsThumbnailProvider.IShellItem psi, uint hint, out int piOrder);
|
||||
void Compare(IShellItem psi, uint hint, out int piOrder);
|
||||
|
||||
void GetAttributes(uint sfgaoMask, out uint psfgaoAttribs);
|
||||
|
||||
void GetDisplayName(Assists.WindowsThumbnailProvider.SIGDN sigdnName, out IntPtr ppszName);
|
||||
void GetDisplayName(SIGDN sigdnName, out IntPtr ppszName);
|
||||
|
||||
void GetParent(out Assists.WindowsThumbnailProvider.IShellItem ppsi);
|
||||
void GetParent(out IShellItem ppsi);
|
||||
}
|
||||
|
||||
[ComImport]
|
||||
@@ -145,7 +141,7 @@ public class WindowsThumbnailProvider
|
||||
internal interface IShellItemImageFactory
|
||||
{
|
||||
[PreserveSig]
|
||||
Assists.WindowsThumbnailProvider.HResult GetImage([In] [MarshalAs(UnmanagedType.Struct)] Assists.WindowsThumbnailProvider.NativeSize size, [In] Assists.ThumbnailOptions flags, [Out] out IntPtr phbm);
|
||||
HResult GetImage([In] [MarshalAs(UnmanagedType.Struct)] NativeSize size, [In] ThumbnailOptions flags, [Out] out IntPtr phbm);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Attributes;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Threading;
|
||||
using System.Windows.Threading;
|
||||
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Controls
|
||||
@@ -53,7 +48,7 @@ namespace ShrlAlgoToolkit.RevitAddins.Common.Controls
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Autodesk.Revit.UI.TaskDialog.Show("Task Error", ex.Message);
|
||||
TaskDialog.Show("Task Error", ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -1,13 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Controls
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Controls
|
||||
{
|
||||
// 用于给外界调用的报告器
|
||||
public class ProgressReporter
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Controls
|
||||
@@ -36,7 +25,7 @@ namespace ShrlAlgoToolkit.RevitAddins.Common.Controls
|
||||
private void BtnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_viewModel.Cancel();
|
||||
(sender as System.Windows.Controls.Button).IsEnabled = false;
|
||||
(sender as Button).IsEnabled = false;
|
||||
}
|
||||
|
||||
// 屏蔽系统的 Alt+F4 关闭,强制必须等主线程任务结束
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using System.Windows;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
public class ColorToBrushConverter : IValueConverter
|
||||
@@ -14,7 +9,7 @@ public class ColorToBrushConverter : IValueConverter
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
//var color = (SelectedColor)value;
|
||||
if (value is System.Windows.Media.Color color)
|
||||
if (value is Color color)
|
||||
{
|
||||
return new SolidColorBrush(color);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
public class ComparisonConverter : IValueConverter
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Markup;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters
|
||||
{
|
||||
public class EnumDescriptionExtension : MarkupExtension
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -4,11 +4,6 @@ using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Windows.Data;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
public class InvertBooleanConverter : IValueConverter
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using System.Windows;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
|
||||
@@ -3,11 +3,6 @@ using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters
|
||||
{
|
||||
[ValueConversion(typeof(bool), typeof(Visibility))]
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
using Color = System.Windows.Media.Color;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters
|
||||
{
|
||||
public class SearchFamilyValueConverter : IMultiValueConverter
|
||||
{
|
||||
public static Converters.SearchFamilyValueConverter Instance { get; } = new Converters.SearchFamilyValueConverter();
|
||||
public static SearchFamilyValueConverter Instance { get; } = new SearchFamilyValueConverter();
|
||||
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
var cellText = values[0] == null ? string.Empty : values[0].ToString();
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters
|
||||
{
|
||||
public class SearchTypeValueConverter : IMultiValueConverter
|
||||
{
|
||||
public static Converters.SearchTypeValueConverter Instance { get; } = new Converters.SearchTypeValueConverter();
|
||||
public static SearchTypeValueConverter Instance { get; } = new SearchTypeValueConverter();
|
||||
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
var cellText = values[0] == null ? string.Empty : values[0].ToString();
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
using System.Windows.Data;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
||||
|
||||
public class SearchValueConverter : IMultiValueConverter
|
||||
|
||||
@@ -8,9 +8,9 @@ public static class DistinctExtensions
|
||||
public static IEnumerable<T> Distinct<T>(
|
||||
this IEnumerable<T> source, Func<T, T, bool> comparer)
|
||||
where T : class
|
||||
=> source.Distinct(new Extensions.DistinctExtensions.DynamicEqualityComparer<T>(comparer));
|
||||
=> source.Distinct(new DynamicEqualityComparer<T>(comparer));
|
||||
public static IEnumerable<T> Distinct<T, V>(this IEnumerable<T> source, Func<T, V> keySelector)
|
||||
=> source.Distinct(new Extensions.DistinctExtensions.CommonEqualityComparer<T, V>(keySelector));
|
||||
=> source.Distinct(new CommonEqualityComparer<T, V>(keySelector));
|
||||
private sealed class DynamicEqualityComparer<T> : IEqualityComparer<T>
|
||||
where T : class
|
||||
{
|
||||
|
||||
@@ -69,7 +69,7 @@ public static class ImageExtensions
|
||||
{
|
||||
using (MemoryStream memory = new MemoryStream())
|
||||
{
|
||||
bitmap.Save(memory, System.Drawing.Imaging.ImageFormat.Png);
|
||||
bitmap.Save(memory, ImageFormat.Png);
|
||||
memory.Position = 0;
|
||||
BitmapImage bitmapImage = new BitmapImage();
|
||||
bitmapImage.BeginInit();
|
||||
|
||||
@@ -12,9 +12,9 @@ namespace ShrlAlgoToolkit.RevitAddins.Common.Extensions
|
||||
/// <summary>
|
||||
/// 开始流式配置 Excel 写入
|
||||
/// </summary>
|
||||
public static Extensions.ExcelWriter<T> AsExcel<T>(this IEnumerable<T> data)
|
||||
public static ExcelWriter<T> AsExcel<T>(this IEnumerable<T> data)
|
||||
{
|
||||
return new Extensions.ExcelWriter<T>(data);
|
||||
return new ExcelWriter<T>(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -76,16 +76,16 @@ namespace ShrlAlgoToolkit.RevitAddins.Common.Extensions
|
||||
/// <summary>
|
||||
/// 设置 Sheet 名称
|
||||
/// </summary>
|
||||
public Extensions.ExcelWriter<T> WithSheetName(string name)
|
||||
public ExcelWriter<T> WithSheetName(string name)
|
||||
{
|
||||
sheetName = Extensions.MiniExcelExtensions.SanitizeSheetName(name);
|
||||
sheetName = MiniExcelExtensions.SanitizeSheetName(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置是否覆盖
|
||||
/// </summary>
|
||||
public Extensions.ExcelWriter<T> Overwrite(bool canOverwrite = true)
|
||||
public ExcelWriter<T> Overwrite(bool canOverwrite = true)
|
||||
{
|
||||
overwrite = canOverwrite;
|
||||
return this;
|
||||
|
||||
@@ -9,6 +9,6 @@ public class BricksFinishesCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<BricksFinishesView, BricksFinishesViewModel>();
|
||||
WinDialogAssist.ShowOrActivate<BricksFinishesView, BricksFinishesViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@ public class FloorFinishesCmd : ExternalCommand
|
||||
public override void Execute()
|
||||
{
|
||||
var floorTypes = Document.OfClass<FloorType>().Cast<FloorType>().ToList();
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<FloorFinishesView, FloorFinishesViewModel>(floorTypes);
|
||||
WinDialogAssist.ShowOrActivate<FloorFinishesView, FloorFinishesViewModel>(floorTypes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public partial class FloorFinishesViewModel : ObservableValidator
|
||||
|
||||
[Required]
|
||||
[Range(-6000, 6000, ErrorMessage = "输入偏移量值范围有误")]
|
||||
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvCivil.FloorFinishesViewModel.PlaceFloorCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(PlaceFloorCommand))]
|
||||
[NotifyDataErrorInfo]
|
||||
[ObservableProperty]
|
||||
public partial double FloorOffset { get; set; }
|
||||
@@ -56,7 +56,7 @@ public partial class FloorFinishesViewModel : ObservableValidator
|
||||
public partial bool RbAllRooms { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvCivil.FloorFinishesViewModel.PlaceFloorCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(PlaceFloorCommand))]
|
||||
public partial FloorType SelectedFloorType { get; set; }
|
||||
|
||||
private bool CanPlace => SelectedFloorType != null && !HasErrors;
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
[Transaction(TransactionMode.Manual)]
|
||||
@@ -31,7 +27,7 @@ public class AdaptiveMEPTagCmd : ExternalCommand
|
||||
if (loc.Curve is Line l)
|
||||
{
|
||||
var ra = l.Direction.AngleTo(XYZ.BasisX);
|
||||
if (ra > Math.PI / 4 && ra < Math.PI / 4 * 3)
|
||||
if (ra is > Math.PI / 4 and < Math.PI / 4 * 3)
|
||||
{
|
||||
toRotate.Add(tag);
|
||||
}
|
||||
@@ -53,7 +49,7 @@ public class AdaptiveMEPTagCmd : ExternalCommand
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
@@ -12,6 +9,6 @@ public class AlignTagsCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<DrawSheet.AlignTagsView, AlignTagsViewModel>();
|
||||
WinDialogAssist.ShowOrActivate<AlignTagsView, AlignTagsViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet
|
||||
{
|
||||
/// <summary>
|
||||
/// AlignTagsView.xaml 的交互逻辑
|
||||
|
||||
@@ -3,10 +3,6 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Nice3point.Revit.Toolkit.External.Handlers;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
public partial class AlignTagsViewModel : ObservableObject
|
||||
@@ -78,7 +74,7 @@ public partial class AlignTagsViewModel : ObservableObject
|
||||
}
|
||||
catch (Autodesk.Revit.Exceptions.OperationCanceledException)
|
||||
{
|
||||
return;
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -116,12 +112,12 @@ public partial class AlignTagsViewModel : ObservableObject
|
||||
//ViewDirection 45°~135°
|
||||
if (view.ViewDirection.Y > 0 && view.ViewDirection.Y >= view.ViewDirection.X)
|
||||
{
|
||||
orderedTags = tags.OrderBy(a => a.TagHeadPosition.Z).ThenBy(b => b.TagHeadPosition.X);
|
||||
orderedTags = tags.OrderBy(a => a.TagHeadPosition.Z).ThenBy(b => b.TagHeadPosition.X);
|
||||
}
|
||||
//ViewDirection 135°~225°
|
||||
else if (view.ViewDirection.X < 0 && view.ViewDirection.Y > view.ViewDirection.X)
|
||||
{
|
||||
orderedTags = tags.OrderBy(a => a.TagHeadPosition.Z).ThenBy(b => b.TagHeadPosition.Y);
|
||||
orderedTags = tags.OrderBy(a => a.TagHeadPosition.Z).ThenBy(b => b.TagHeadPosition.Y);
|
||||
}
|
||||
//ViewDirection -45°~45°
|
||||
else if (view.ViewDirection.X > 0 && view.ViewDirection.Y < view.ViewDirection.X)
|
||||
@@ -134,7 +130,13 @@ public partial class AlignTagsViewModel : ObservableObject
|
||||
orderedTags = tags.OrderBy(a => a.TagHeadPosition.Z).ThenByDescending(b => b.TagHeadPosition.X);
|
||||
}
|
||||
|
||||
var baseTag = orderedTags.FirstOrDefault();
|
||||
if (orderedTags==null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var orderedTagList= orderedTags.ToList();
|
||||
var baseTag = orderedTagList.FirstOrDefault();
|
||||
if (baseTag == null)return;
|
||||
if (baseTag.LeaderEndCondition == LeaderEndCondition.Attached)
|
||||
{
|
||||
baseTag.LeaderEndCondition = LeaderEndCondition.Free;
|
||||
@@ -151,9 +153,9 @@ public partial class AlignTagsViewModel : ObservableObject
|
||||
);
|
||||
#endif
|
||||
|
||||
for (var i = 1; i < orderedTags.Count(); i++)
|
||||
for (var i = 1; i < orderedTagList.Count(); i++)
|
||||
{
|
||||
var tag = orderedTags.ElementAt(i);
|
||||
var tag = orderedTagList.ElementAt(i);
|
||||
if (tag.LeaderEndCondition == LeaderEndCondition.Attached)
|
||||
{
|
||||
tag.LeaderEndCondition = LeaderEndCondition.Free;
|
||||
@@ -238,9 +240,10 @@ public partial class AlignTagsViewModel : ObservableObject
|
||||
/// <param name="tags"></param>
|
||||
public static void ArrangePlaneTags(double distance, List<IndependentTag> tags)
|
||||
{
|
||||
var orderedTags = tags.OrderBy(a => a.TagHeadPosition.Y).ThenByDescending(b => b.TagHeadPosition.X);
|
||||
var orderedTags = tags.OrderBy(a => a.TagHeadPosition.Y).ThenByDescending(b => b.TagHeadPosition.X).ToList();
|
||||
|
||||
var baseTag = orderedTags.FirstOrDefault();
|
||||
if (baseTag == null)return;
|
||||
if (baseTag.LeaderEndCondition == LeaderEndCondition.Attached)
|
||||
{
|
||||
baseTag.LeaderEndCondition = LeaderEndCondition.Free;
|
||||
@@ -354,6 +357,10 @@ public partial class AlignTagsViewModel : ObservableObject
|
||||
|
||||
var tagsToRemove = new List<IndependentTag>();
|
||||
var baseTag = independentTags.FirstOrDefault();
|
||||
if (baseTag==null)
|
||||
{
|
||||
return groups;
|
||||
}
|
||||
var loc = baseTag.TagHeadPosition;
|
||||
//tagsToRemove.Add(baseTag);
|
||||
foreach (var t in independentTags)
|
||||
@@ -363,7 +370,7 @@ public partial class AlignTagsViewModel : ObservableObject
|
||||
var pOnElevation = new XYZ(t.TagHeadPosition.X, t.TagHeadPosition.Y, t.TagHeadPosition.Z);
|
||||
//var pOnElevation1 = new XYZ(0, t.TagHeadPosition.Y, t.TagHeadPosition.Z);
|
||||
var view = t.Document.GetElement(t.OwnerViewId) as View;
|
||||
if (view.ViewType is ViewType.FloorPlan or ViewType.CeilingPlan)
|
||||
if (view!.ViewType is ViewType.FloorPlan or ViewType.CeilingPlan)
|
||||
{
|
||||
if (pOnPlane.DistanceTo(new XYZ(loc.X, loc.Y, 0)) < 1500 / 304.8) //距离小于1500合并成组
|
||||
{
|
||||
|
||||
@@ -3,10 +3,6 @@ using Autodesk.Revit.Attributes;
|
||||
using Autodesk.Revit.DB;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
[Transaction(TransactionMode.Manual)]
|
||||
@@ -80,13 +76,13 @@ public class ArrangeTagsCmd : ExternalCommand
|
||||
tx.Start("整理标记");
|
||||
|
||||
//Create two lists of TagLeader
|
||||
List<DrawSheet.TagLeader> leftTagLeaders = [];
|
||||
List<DrawSheet.TagLeader> rightTagLeaders = [];
|
||||
List<TagLeader> leftTagLeaders = [];
|
||||
List<TagLeader> rightTagLeaders = [];
|
||||
|
||||
foreach (var tag in independentTags)
|
||||
{
|
||||
DrawSheet.TagLeader currentTag = new(tag, doc);
|
||||
if (currentTag.Side == DrawSheet.ViewSides.Left)
|
||||
TagLeader currentTag = new(tag, doc);
|
||||
if (currentTag.Side == ViewSides.Left)
|
||||
{
|
||||
leftTagLeaders.Add(currentTag);
|
||||
}
|
||||
@@ -97,8 +93,8 @@ public class ArrangeTagsCmd : ExternalCommand
|
||||
}
|
||||
|
||||
//Create a errorModels of potential location points for tag headers
|
||||
var leftTagHeadPoints = DrawSheet.ArrangeTagsCmd.CreateTagPositionPoints(activeView, leftTagLeaders, DrawSheet.ViewSides.Left);
|
||||
var rightTagHeadPoints = DrawSheet.ArrangeTagsCmd.CreateTagPositionPoints(activeView, rightTagLeaders, DrawSheet.ViewSides.Right);
|
||||
var leftTagHeadPoints = CreateTagPositionPoints(activeView, leftTagLeaders, ViewSides.Left);
|
||||
var rightTagHeadPoints = CreateTagPositionPoints(activeView, rightTagLeaders, ViewSides.Right);
|
||||
|
||||
//按 Y 位置对标签排序 [..]集合解构是一种新的语法,用于表示范围(Range)操作。范围操作用于从集合或数组中选择一个连续的子集。
|
||||
leftTagLeaders = [.. leftTagLeaders.OrderBy(x => x.LeaderEnd.X)];
|
||||
@@ -116,7 +112,7 @@ public class ArrangeTagsCmd : ExternalCommand
|
||||
tx.Commit();
|
||||
}
|
||||
|
||||
private static List<XYZ> CreateTagPositionPoints(View activeView, List<DrawSheet.TagLeader> tagLeaders, DrawSheet.ViewSides side)
|
||||
private static List<XYZ> CreateTagPositionPoints(View activeView, List<TagLeader> tagLeaders, ViewSides side)
|
||||
{
|
||||
List<XYZ> points = [];
|
||||
|
||||
@@ -137,7 +133,7 @@ public class ArrangeTagsCmd : ExternalCommand
|
||||
//create sides points
|
||||
for (var i = max * 2; i > 0; i--)
|
||||
{
|
||||
if (side == DrawSheet.ViewSides.Left)
|
||||
if (side == ViewSides.Left)
|
||||
{
|
||||
//Add left point
|
||||
points.Add(baseLeft + new XYZ(0, step * i, 0));
|
||||
@@ -170,7 +166,7 @@ public class ArrangeTagsCmd : ExternalCommand
|
||||
return nearestPoint;
|
||||
}
|
||||
|
||||
private void PlaceAndSort(List<XYZ> positionPoints, List<DrawSheet.TagLeader> tags)
|
||||
private void PlaceAndSort(List<XYZ> positionPoints, List<TagLeader> tags)
|
||||
{
|
||||
//place TagLeader
|
||||
foreach (var tag in tags)
|
||||
@@ -183,8 +179,8 @@ public class ArrangeTagsCmd : ExternalCommand
|
||||
}
|
||||
|
||||
//unCross leaders (2 times)
|
||||
DrawSheet.ArrangeTagsCmd.UnCross(tags);
|
||||
DrawSheet.ArrangeTagsCmd.UnCross(tags);
|
||||
UnCross(tags);
|
||||
UnCross(tags);
|
||||
|
||||
//update their position
|
||||
foreach (var tag in tags)
|
||||
@@ -193,7 +189,7 @@ public class ArrangeTagsCmd : ExternalCommand
|
||||
}
|
||||
}
|
||||
|
||||
private static void UnCross(List<DrawSheet.TagLeader> tags)
|
||||
private static void UnCross(List<TagLeader> tags)
|
||||
{
|
||||
foreach (var tag in tags)
|
||||
{
|
||||
@@ -234,7 +230,7 @@ internal class TagLeader
|
||||
|
||||
//View center
|
||||
var viewCenter = (currentView.CropBox.Max + currentView.CropBox.Min) / 2;
|
||||
Side = viewCenter.X > LeaderEnd.X ? DrawSheet.ViewSides.Left : DrawSheet.ViewSides.Right;
|
||||
Side = viewCenter.X > LeaderEnd.X ? ViewSides.Left : ViewSides.Right;
|
||||
}
|
||||
|
||||
GetTagDimension();
|
||||
@@ -269,7 +265,7 @@ internal class TagLeader
|
||||
|
||||
public Line BaseLine { get; private set; }
|
||||
|
||||
public DrawSheet.ViewSides Side { get; }
|
||||
public ViewSides Side { get; }
|
||||
|
||||
public XYZ ElbowPosition { get; private set; }
|
||||
|
||||
@@ -331,7 +327,7 @@ internal class TagLeader
|
||||
{
|
||||
tag.LeaderEndCondition = LeaderEndCondition.Attached;
|
||||
|
||||
var offsetFromView = Side == DrawSheet.ViewSides.Left ? new XYZ((-Math.Abs(TagWidth) * 0.5) - 0.1, 0, 0) : new XYZ((Math.Abs(TagWidth) * 0.5) + 0.1, 0, 0);
|
||||
var offsetFromView = Side == ViewSides.Left ? new XYZ((-Math.Abs(TagWidth) * 0.5) - 0.1, 0, 0) : new XYZ((Math.Abs(TagWidth) * 0.5) + 0.1, 0, 0);
|
||||
tag.TagHeadPosition = currentView.CropBox.Transform.OfPoint(headOffset + tagCenter + offsetFromView);
|
||||
#if REVIT2018 || REVIT2020
|
||||
tag.LeaderElbow = currentView.CropBox.Transform.OfPoint(ElbowPosition);
|
||||
|
||||
@@ -4,9 +4,6 @@ using Autodesk.Revit.DB;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
@@ -72,7 +69,7 @@ public class CivilViewFilterCmd : ExternalCommand
|
||||
catch (Exception e)
|
||||
{
|
||||
ErrorMessage = e.Message;
|
||||
Common.Assists.LogAssist.ToLog(e.StackTrace);
|
||||
LogAssist.ToLog(e.StackTrace);
|
||||
Result = Result.Failed;
|
||||
return;
|
||||
}
|
||||
@@ -116,7 +113,7 @@ public class CivilViewFilterCmd : ExternalCommand
|
||||
catch (Exception e)
|
||||
{
|
||||
ErrorMessage = e.Message;
|
||||
Common.Assists.LogAssist.ToLog(e.StackTrace);
|
||||
LogAssist.ToLog(e.StackTrace);
|
||||
Result = Result.Failed;
|
||||
return;
|
||||
}
|
||||
@@ -169,7 +166,7 @@ public class CivilViewFilterCmd : ExternalCommand
|
||||
catch (Exception e)
|
||||
{
|
||||
ErrorMessage = e.Message;
|
||||
Common.Assists.LogAssist.ToLog(e.StackTrace);
|
||||
LogAssist.ToLog(e.StackTrace);
|
||||
Result = Result.Failed;
|
||||
return;
|
||||
}
|
||||
@@ -199,7 +196,7 @@ public class CivilViewFilterCmd : ExternalCommand
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(e.Message);
|
||||
Common.Assists.LogAssist.ToLog(e.StackTrace);
|
||||
LogAssist.ToLog(e.StackTrace);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -255,7 +252,7 @@ public class CivilViewFilterCmd : ExternalCommand
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(e.Message);
|
||||
Common.Assists.LogAssist.ToLog(e.StackTrace);
|
||||
LogAssist.ToLog(e.StackTrace);
|
||||
}
|
||||
|
||||
#elif REVIT2020 || REVIT2019
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
using Autodesk.Revit.UI.Selection;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
|
||||
@@ -4,10 +4,6 @@ using System.Windows.Controls;
|
||||
using Autodesk.Revit.DB;
|
||||
using Nice3point.Revit.Toolkit.External.Handlers;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
public partial class ElementsControlDock : IDockablePaneProvider
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
|
||||
using Autodesk.Revit.DB;
|
||||
|
||||
using Melskin.Controls;
|
||||
@@ -11,9 +9,6 @@ using MiniExcelLibs;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
@@ -43,7 +38,7 @@ public class ExportSchedulesCmd : ExternalCommand
|
||||
|
||||
var path = $"{selectedPath}\\导出的明细表.xlsx";
|
||||
ExportScheduleToExcel(list, path);
|
||||
Common.Assists.WinDialogAssist.OpenFolderAndSelectFile(path);
|
||||
WinDialogAssist.OpenFolderAndSelectFile(path);
|
||||
}
|
||||
|
||||
public void ExportScheduleToExcel(List<ViewSchedule> list,string path)
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Autodesk.Revit.DB;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet
|
||||
{
|
||||
[Transaction(TransactionMode.Manual)]
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
/// <summary>
|
||||
@@ -16,6 +13,6 @@ public class QuickViewSectionCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<QuickViewSectionView, QuickViewSectionViewModel>();
|
||||
WinDialogAssist.ShowOrActivate<QuickViewSectionView, QuickViewSectionViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
/// <summary>
|
||||
/// QuickViewSectionView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
|
||||
@@ -5,10 +5,6 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Nice3point.Revit.Toolkit.External.Handlers;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet
|
||||
{
|
||||
public partial class QuickViewSectionViewModel : ObservableObject
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
@@ -19,7 +17,7 @@ public class SectionBoxControllerCmd : ExternalCommand
|
||||
//}
|
||||
try
|
||||
{
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<SectionBoxControllerView, SectionBoxControllerViewModel>(UiApplication);
|
||||
WinDialogAssist.ShowOrActivate<SectionBoxControllerView, SectionBoxControllerViewModel>(UiApplication);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using Melskin.Controls;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -44,7 +44,7 @@ public partial class SectionBoxControllerViewModel : ObservableObject
|
||||
}
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvView.SectionBoxControllerViewModel.RecordSectionBoxCommand), nameof(RevitAddins.RvView.SectionBoxControllerViewModel.UpdateSectionBoxCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(RecordSectionBoxCommand), nameof(UpdateSectionBoxCommand))]
|
||||
public partial bool CanModify { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
@@ -62,7 +62,7 @@ public partial class SectionBoxControllerViewModel : ObservableObject
|
||||
private readonly UIApplication uiapp;
|
||||
private int index = 1;
|
||||
|
||||
[RelayCommand(CanExecute = nameof(RevitAddins.RvView.SectionBoxControllerViewModel.CanModify))]
|
||||
[RelayCommand(CanExecute = nameof(CanModify))]
|
||||
private void RecordSectionBox()
|
||||
{
|
||||
if (uiapp.ActiveUIDocument.Document.ActiveView is View3D { IsSectionBoxActive: true } view3D)
|
||||
@@ -279,7 +279,7 @@ public partial class SectionBoxControllerViewModel : ObservableObject
|
||||
"重设(剖面)剖面框");
|
||||
}
|
||||
}
|
||||
[RelayCommand(CanExecute = nameof(RevitAddins.RvView.SectionBoxControllerViewModel.CanModify))]
|
||||
[RelayCommand(CanExecute = nameof(CanModify))]
|
||||
private void UpdateSectionBox(object obj)
|
||||
{
|
||||
if (obj is BoundingBoxXYZ boundingBoxXyz)
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet
|
||||
{
|
||||
/// <summary>
|
||||
/// SystemDisplayView.xaml 的交互逻辑
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvMEP;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Controls;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
@@ -15,6 +12,6 @@ public class ViewManagerCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<DrawSheet.ViewManagerView, DrawSheet.ViewManagerViewModel>(UiApplication);
|
||||
WinDialogAssist.ShowOrActivate<ViewManagerView, ViewManagerViewModel>(UiApplication);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet
|
||||
{
|
||||
/// <summary>
|
||||
/// ViewManagerView.xaml 的交互逻辑
|
||||
|
||||
@@ -8,24 +8,21 @@ using CommunityToolkit.Mvvm.Input;
|
||||
using Nice3point.Revit.Toolkit.External.Handlers;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Extensions;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
public partial class ViewManagerViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(DrawSheet.ViewManagerViewModel.CopyAsDependentCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(CopyAsDependentCommand))]
|
||||
public partial bool CanCopyAsDependent { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(DrawSheet.ViewManagerViewModel.CopyOnlyCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(CopyOnlyCommand))]
|
||||
public partial bool CanCopyOnly { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(DrawSheet.ViewManagerViewModel.CopyWithDetailCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(CopyWithDetailCommand))]
|
||||
public partial bool CanCopyWidthDetail { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
@@ -121,13 +118,13 @@ public partial class ViewManagerViewModel : ObservableObject
|
||||
view.ViewTemplateId = ElementId.InvalidElementId;
|
||||
if (model.IsDisplayStyleEditable)
|
||||
{
|
||||
view.DisplayStyle = (Autodesk.Revit.DB.DisplayStyle)model.DisplayStyle;
|
||||
view.DisplayStyle = (DisplayStyle)model.DisplayStyle;
|
||||
}
|
||||
|
||||
if (view.HasViewDiscipline())
|
||||
{
|
||||
Debug.Assert(model.Discipline != null, "model.Discipline != null");
|
||||
view.Discipline = (Autodesk.Revit.DB.ViewDiscipline)model.Discipline;
|
||||
view.Discipline = (ViewDiscipline)model.Discipline;
|
||||
}
|
||||
|
||||
if (model.IsScaleEditable)
|
||||
@@ -138,7 +135,7 @@ public partial class ViewManagerViewModel : ObservableObject
|
||||
if (model.IsDetailLevelEditable)
|
||||
{
|
||||
Debug.Assert(model.DetailLevel != null, "model.DetailLevel != null");
|
||||
view.DetailLevel = (Autodesk.Revit.DB.ViewDetailLevel)model.DetailLevel;
|
||||
view.DetailLevel = (ViewDetailLevel)model.DetailLevel;
|
||||
}
|
||||
|
||||
if (model.ViewTemplate != null && view.IsValidViewTemplate(model.ViewTemplate.Id))
|
||||
@@ -162,7 +159,7 @@ public partial class ViewManagerViewModel : ObservableObject
|
||||
});
|
||||
}
|
||||
|
||||
[RelayCommand(CanExecute = nameof(DrawSheet.ViewManagerViewModel.CanCopyAsDependent))]
|
||||
[RelayCommand(CanExecute = nameof(CanCopyAsDependent))]
|
||||
private void CopyAsDependent(System.Collections.IList items)
|
||||
{
|
||||
if (items == null || items.Count == 0)
|
||||
@@ -187,7 +184,7 @@ public partial class ViewManagerViewModel : ObservableObject
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Common.Assists.LogAssist.ToLog(e.Message);
|
||||
LogAssist.ToLog(e.Message);
|
||||
}
|
||||
},
|
||||
"复制视图"
|
||||
@@ -195,7 +192,7 @@ public partial class ViewManagerViewModel : ObservableObject
|
||||
});
|
||||
}
|
||||
|
||||
[RelayCommand(CanExecute = nameof(DrawSheet.ViewManagerViewModel.CanCopyOnly))]
|
||||
[RelayCommand(CanExecute = nameof(CanCopyOnly))]
|
||||
private void CopyOnly(System.Collections.IList items)
|
||||
{
|
||||
if (items == null || items.Count == 0)
|
||||
@@ -220,7 +217,7 @@ public partial class ViewManagerViewModel : ObservableObject
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Common.Assists.LogAssist.ToLog(e.Message);
|
||||
LogAssist.ToLog(e.Message);
|
||||
}
|
||||
},
|
||||
"复制视图"
|
||||
@@ -228,7 +225,7 @@ public partial class ViewManagerViewModel : ObservableObject
|
||||
});
|
||||
}
|
||||
|
||||
[RelayCommand(CanExecute = nameof(DrawSheet.ViewManagerViewModel.CanCopyWidthDetail))]
|
||||
[RelayCommand(CanExecute = nameof(CanCopyWidthDetail))]
|
||||
private void CopyWithDetail(System.Collections.IList items)
|
||||
{
|
||||
if (items == null || items.Count == 0)
|
||||
@@ -253,7 +250,7 @@ public partial class ViewManagerViewModel : ObservableObject
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Common.Assists.LogAssist.ToLog(e.Message);
|
||||
LogAssist.ToLog(e.Message);
|
||||
}
|
||||
},
|
||||
"复制视图"
|
||||
@@ -393,13 +390,13 @@ public partial class ViewManagerViewModel : ObservableObject
|
||||
view.ViewTemplateId = ElementId.InvalidElementId;
|
||||
if (model.IsDisplayStyleEditable)
|
||||
{
|
||||
view.DisplayStyle = (Autodesk.Revit.DB.DisplayStyle)model.DisplayStyle;
|
||||
view.DisplayStyle = (DisplayStyle)model.DisplayStyle;
|
||||
}
|
||||
|
||||
if (view.HasViewDiscipline())
|
||||
{
|
||||
Debug.Assert(model.Discipline != null, "model.Discipline != null");
|
||||
view.Discipline = (Autodesk.Revit.DB.ViewDiscipline)model.Discipline;
|
||||
view.Discipline = (ViewDiscipline)model.Discipline;
|
||||
}
|
||||
|
||||
if (model.IsScaleEditable)
|
||||
@@ -410,7 +407,7 @@ public partial class ViewManagerViewModel : ObservableObject
|
||||
if (model.IsDetailLevelEditable)
|
||||
{
|
||||
Debug.Assert(model.DetailLevel != null, "model.DetailLevel != null");
|
||||
view.DetailLevel = (Autodesk.Revit.DB.ViewDetailLevel)model.DetailLevel;
|
||||
view.DetailLevel = (ViewDetailLevel)model.DetailLevel;
|
||||
}
|
||||
|
||||
if (model.ViewTemplate != null && view.IsValidViewTemplate(model.ViewTemplate.Id))
|
||||
|
||||
@@ -3,9 +3,6 @@ using Autodesk.Revit.Attributes;
|
||||
using Autodesk.Revit.DB;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
@@ -19,7 +16,7 @@ public class VisibilityControlCmd : ExternalCommand
|
||||
{
|
||||
if (Document.ActiveView.ViewTemplateId == ElementId.InvalidElementId)
|
||||
{
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<DrawSheet.VisibilityView, DrawSheet.VisibilityViewModel>(UiApplication);
|
||||
WinDialogAssist.ShowOrActivate<VisibilityView, VisibilityViewModel>(UiApplication);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using Melskin.Controls;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -4,10 +4,6 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Nice3point.Revit.Toolkit.External.Handlers;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
|
||||
|
||||
public partial class VisibilityViewModel : ObservableObject
|
||||
|
||||
@@ -4,13 +4,12 @@ using Nice3point.Revit.Toolkit.External.Handlers;
|
||||
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Properties;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvView;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Entry;
|
||||
|
||||
public class DrawingViewApp
|
||||
{
|
||||
private static readonly string TabName = RevitAddins.Properties.Settings.Default.TabName;
|
||||
private static readonly string TabName = Settings.Default.TabName;
|
||||
|
||||
public DrawingViewApp(UIControlledApplication application)
|
||||
{
|
||||
@@ -116,7 +115,7 @@ public class DrawingViewApp
|
||||
//ribbonPanel.AddPushButton<ViewManagerCmd>("视图管理", Resources.view_manager_32px, "视图管理");
|
||||
}
|
||||
|
||||
private void CreateToggleButton(Autodesk.Windows.RibbonTab rt, string panelName)
|
||||
private void CreateToggleButton(RibbonTab rt, string panelName)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Windows;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Windows;
|
||||
using ShrlAlgoToolkit.RevitAddins.Properties;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvFamily;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Extensions;
|
||||
|
||||
@@ -54,7 +53,7 @@ public class FamilyApp
|
||||
private const string VbRecentPanelName = "最近使用";
|
||||
|
||||
//获取Ribbon类所在的通用类库目录
|
||||
private static readonly string TabName = RevitAddins.Properties.Settings.Default.TabName;
|
||||
private static readonly string TabName = Properties.Settings.Default.TabName;
|
||||
private readonly UIApplication uiapp;
|
||||
|
||||
public ObservableCollection<FamilyModel> Items { get; set; }
|
||||
|
||||
@@ -364,7 +364,7 @@ public class ModifyTabApp
|
||||
alignSource.Items.Add(ribbonRowPanel);
|
||||
alignSource.Items.Add(ribbonRowPanel1);
|
||||
//新建面板
|
||||
Autodesk.Windows.RibbonPanel alignElemsPanel = new() { FloatingOrientation = System.Windows.Controls.Orientation.Vertical };
|
||||
Autodesk.Windows.RibbonPanel alignElemsPanel = new() { FloatingOrientation = Orientation.Vertical };
|
||||
alignElemsPanel.Source = alignSource;
|
||||
tab.Panels.Add(alignElemsPanel);
|
||||
}
|
||||
@@ -375,7 +375,7 @@ public class ModifyTabApp
|
||||
private void SelectionPanel(RibbonTab tab)
|
||||
{
|
||||
//新建面板
|
||||
Autodesk.Windows.RibbonPanel ribbonPanel = new() { FloatingOrientation = System.Windows.Controls.Orientation.Vertical };
|
||||
Autodesk.Windows.RibbonPanel ribbonPanel = new() { FloatingOrientation = Orientation.Vertical };
|
||||
|
||||
//面板资源
|
||||
RibbonPanelSource selSource = new() { Id = "ID_SSI_Panel", Title = "选择元素" };
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace ShrlAlgoToolkit.RevitAddins.Entry;
|
||||
//[Obfuscation(Exclude = true, ApplyToMembers = true)]
|
||||
public class RvApp : ExternalApplication
|
||||
{
|
||||
private static readonly string TabName = Properties.Settings.Default.TabName;
|
||||
private static readonly string TabName = Settings.Default.TabName;
|
||||
private AsyncEventHandler saveHandler;
|
||||
readonly System.Timers.Timer saveTimer = Variables.AutoSaveTimer;
|
||||
private void OnTimedEvent(object source, System.Timers.ElapsedEventArgs e)
|
||||
@@ -46,7 +46,7 @@ public class RvApp : ExternalApplication
|
||||
public override void OnStartup()
|
||||
{
|
||||
saveHandler = new();
|
||||
UiApplication.CreateRibbonTab(Properties.Settings.Default.TabName);
|
||||
UiApplication.CreateRibbonTab(Settings.Default.TabName);
|
||||
|
||||
var versionNumber = UiApplication.Application.VersionNumber;
|
||||
var subVersionNumber = UiApplication.Application.SubVersionNumber;
|
||||
@@ -59,7 +59,7 @@ public class RvApp : ExternalApplication
|
||||
|
||||
var ribbon = Autodesk.Windows.ComponentManager.Ribbon;
|
||||
|
||||
var rt = ribbon.Tabs.FirstOrDefault(tab => tab.Name == Properties.Settings.Default.TabName);
|
||||
var rt = ribbon.Tabs.FirstOrDefault(tab => tab.Name == Settings.Default.TabName);
|
||||
ribbon.Tabs.Remove(rt);
|
||||
//foreach (var tab in ribbon.Tabs)
|
||||
//{
|
||||
@@ -74,11 +74,11 @@ public class RvApp : ExternalApplication
|
||||
|
||||
CivilApp(Application);
|
||||
MEPApp(Application);
|
||||
_ = new Entry.ModifyTabApp(UiApplication);
|
||||
_ = new ModifyTabApp(UiApplication);
|
||||
_ = new DrawingViewApp(Application);
|
||||
CreateCommonTools(Application);
|
||||
_ = new TabManagerApp(Application);
|
||||
_ = new Entry.FamilyApp(Application, UiApplication);
|
||||
_ = new FamilyApp(Application, UiApplication);
|
||||
|
||||
if (Settings.Default.IsActiveAutoSave)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ public class TabManagerApp
|
||||
{
|
||||
public TabManagerApp(UIControlledApplication application)
|
||||
{
|
||||
var tab = RibbonControl.Tabs.First(t => t.Name == RevitAddins.Properties.Settings.Default.TabName);
|
||||
var tab = RibbonControl.Tabs.First(t => t.Name == Settings.Default.TabName);
|
||||
|
||||
SetTabControl(tab);
|
||||
application.ViewActivating += Application_ViewActivating;
|
||||
@@ -20,7 +20,7 @@ public class TabManagerApp
|
||||
|
||||
private void InsertQuickAccessAndHidePanel()
|
||||
{
|
||||
var tab = RibbonControl.FindTab(RevitAddins.Properties.Settings.Default.TabName);
|
||||
var tab = RibbonControl.FindTab(Settings.Default.TabName);
|
||||
|
||||
if (tab != null && addInManagerPanel != null)
|
||||
{
|
||||
@@ -63,7 +63,7 @@ public class TabManagerApp
|
||||
var ribbon = ComponentManager.Ribbon;
|
||||
foreach (var tab in ribbon.Tabs)
|
||||
{
|
||||
if (tab.GetType() == typeof(RibbonTab) && tab.Title != RevitAddins.Properties.Settings.Default.TabName)
|
||||
if (tab.GetType() == typeof(RibbonTab) && tab.Title != Settings.Default.TabName)
|
||||
{
|
||||
RibbonToggleButton ribbonToggleButton =
|
||||
new()
|
||||
@@ -132,7 +132,7 @@ public class TabManagerApp
|
||||
//如果是族文档,在激活视图时,隐藏面板
|
||||
private void Application_ViewActivating(object sender, Autodesk.Revit.UI.Events.ViewActivatingEventArgs e)
|
||||
{
|
||||
SetTabEnabled(RevitAddins.Properties.Settings.Default.TabName, !e.NewActiveView.Document.IsFamilyDocument);
|
||||
SetTabEnabled(Settings.Default.TabName, !e.NewActiveView.Document.IsFamilyDocument);
|
||||
}
|
||||
|
||||
private void ControlledApplication_ApplicationInitialized(object sender, Autodesk.Revit.DB.Events.ApplicationInitializedEventArgs e)
|
||||
@@ -145,7 +145,7 @@ public class TabManagerApp
|
||||
if (sender is RibbonToggleButton toggleButton)
|
||||
{
|
||||
var tabName = toggleButton.Name;
|
||||
var tab = Entry.TabManagerApp.RibbonControl.FindTab(tabName);
|
||||
var tab = RibbonControl.FindTab(tabName);
|
||||
tab.IsVisible = toggleButton.IsChecked;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,6 @@ using Autodesk.Revit.Attributes;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI.Selection;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvFamily;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.FamMaster;
|
||||
/// <summary>
|
||||
/// 炸开族中的dwg或嵌套族图元
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvFamily;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.FamMaster;
|
||||
|
||||
@@ -13,6 +9,6 @@ public class FamilyLibraryCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
Common.Assists.WinDialogAssist.ShowOrActivate<FamilyLibraryView, FamilyLibraryViewModel>();
|
||||
WinDialogAssist.ShowOrActivate<FamilyLibraryView, FamilyLibraryViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvFamily;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.FamMaster
|
||||
namespace ShrlAlgoToolkit.RevitAddins.FamMaster
|
||||
{
|
||||
/// <summary>
|
||||
/// LocalFamily.xaml 的交互逻辑.
|
||||
|
||||
@@ -11,9 +11,6 @@ using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using static ShrlAlgoToolkit.RevitCore.Assists.RevitFileAssist;
|
||||
using Settings = ShrlAlgoToolkit.RevitAddins.Properties.Settings;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvFamily;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.FamMaster;
|
||||
|
||||
@@ -314,7 +311,7 @@ public partial class FamilyLibraryViewModel : ObservableObject
|
||||
{
|
||||
if (obj is FamilyModel familyInfo)
|
||||
{
|
||||
Common.Assists.WinDialogAssist.OpenFolderAndSelectFile(familyInfo.Path);
|
||||
WinDialogAssist.OpenFolderAndSelectFile(familyInfo.Path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public partial class FamilyModel : ObservableObject
|
||||
/// <summary>
|
||||
/// 族库缩略图
|
||||
/// </summary>
|
||||
public BitmapSource ImageData => Common.Assists.ImageAssist.LoadFileImage(Path, 128, 128);
|
||||
public BitmapSource ImageData => ImageAssist.LoadFileImage(Path, 128, 128);
|
||||
|
||||
/// <summary>
|
||||
/// 最近使用面板
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvFamily;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.FamMaster;
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using ShrlAlgoToolkit.RevitAddins.RvFamily;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.FamMaster
|
||||
namespace ShrlAlgoToolkit.RevitAddins.FamMaster
|
||||
{
|
||||
/// <summary>
|
||||
/// WpfMassSaveFamilies.xaml 的交互逻辑
|
||||
|
||||
@@ -7,9 +7,6 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Nice3point.Revit.Toolkit.External.Handlers;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvFamily;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.FamMaster;
|
||||
|
||||
@@ -38,7 +35,7 @@ public partial class FamilyProcessorViewModel : ObservableObject
|
||||
public partial int ModifyNameIndex { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(FamMaster.FamilyProcessorViewModel.SaveFamiliesCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(SaveFamiliesCommand))]
|
||||
public partial string PathToSaveFamily { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
@@ -48,14 +45,14 @@ public partial class FamilyProcessorViewModel : ObservableObject
|
||||
public partial string ReplaceStr { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(FamMaster.FamilyProcessorViewModel.TransmitFamilyCommand), nameof(FamMaster.FamilyProcessorViewModel.SaveFamiliesCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(TransmitFamilyCommand), nameof(SaveFamiliesCommand))]
|
||||
public partial Document SourceDoc { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial string Suffix { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(FamMaster.FamilyProcessorViewModel.TransmitFamilyCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(TransmitFamilyCommand))]
|
||||
public partial Document TargetDoc { get; set; }
|
||||
|
||||
//private readonly ExternalEvent saveEvent;
|
||||
@@ -284,7 +281,7 @@ public partial class FamilyProcessorViewModel : ObservableObject
|
||||
[RelayCommand]
|
||||
private static void Cancel(object obj)
|
||||
{
|
||||
if (obj is System.Windows.Window window)
|
||||
if (obj is Window window)
|
||||
{
|
||||
window.DialogResult = false;
|
||||
}
|
||||
@@ -324,7 +321,7 @@ public partial class FamilyProcessorViewModel : ObservableObject
|
||||
[RelayCommand(CanExecute = nameof(CanSaveFamilies))]
|
||||
private void SaveFamilies(object obj)
|
||||
{
|
||||
var items = (System.Collections.IList)obj;
|
||||
var items = (IList)obj;
|
||||
var collection = items.Cast<Family>();
|
||||
var selectedItems = collection.ToList();
|
||||
if (!selectedItems.Any())
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
using Autodesk.Revit.DB;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvFamily;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.General
|
||||
{
|
||||
public class LoadedFamilyDropHandler : IDropHandler
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using ShrlAlgoToolkit.RevitAddins.RvCommon;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.FamMaster
|
||||
namespace ShrlAlgoToolkit.RevitAddins.FamMaster
|
||||
{
|
||||
/// <summary>
|
||||
/// ModelByCurveCreatorView.xaml 的交互逻辑
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace ShrlAlgoToolkit.RevitAddins.RvCommon
|
||||
public partial double InstanceOffsetY { get; set; } = 0;
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvCommon.ModelByCurveCreatorViewModel.CreateTrackCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(CreateTrackCommand))]
|
||||
public partial bool IsRunning { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
@@ -62,14 +62,14 @@ namespace ShrlAlgoToolkit.RevitAddins.RvCommon
|
||||
public partial List<FamilySymbol> ProfileFamilyTypes { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvCommon.ModelByCurveCreatorViewModel.CreateTrackCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(CreateTrackCommand))]
|
||||
public partial FamilySymbol SelectedFamilyType { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Material SelectedMaterial { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvCommon.ModelByCurveCreatorViewModel.CreateTrackCommand))]
|
||||
[NotifyCanExecuteChangedFor(nameof(CreateTrackCommand))]
|
||||
public partial FamilySymbol SelectedProfileFamilyType { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "不可为空")]
|
||||
|
||||
@@ -3,10 +3,6 @@ using Autodesk.Revit.DB;
|
||||
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvCommon;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.General;
|
||||
/// <summary>
|
||||
/// 相对移动
|
||||
|
||||
@@ -4,10 +4,6 @@ using Autodesk.Revit.UI.Selection;
|
||||
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvCommon;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Modeling;
|
||||
[Transaction(TransactionMode.Manual)]
|
||||
public class PlaceInstanceByCircleCmd : ExternalCommand
|
||||
|
||||
@@ -3,10 +3,6 @@ using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.DB.Structure;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvFamily;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Modeling;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -3,10 +3,6 @@ using Autodesk.Revit.DB;
|
||||
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvCommon;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.General;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -9,14 +9,7 @@ using Melskin.Controls;
|
||||
using Microsoft.Win32;
|
||||
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgo.Addin.Test;
|
||||
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.Common.Controls;
|
||||
using ShrlAlgoToolkit.RevitAddins.RvFamily;
|
||||
|
||||
using TaskDialog = Autodesk.Revit.UI.TaskDialog;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.General;
|
||||
@@ -136,7 +129,7 @@ public class UpgradeFamilyCmd : ExternalCommand
|
||||
|
||||
private void UpdateFile(UIDocument uidoc, string filename)
|
||||
{
|
||||
System.Threading.Thread.Sleep(50);
|
||||
Thread.Sleep(50);
|
||||
|
||||
if (File.GetAttributes(filename).ToString().IndexOf("ReadOnly", StringComparison.Ordinal) != -1)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using Autodesk.Revit.DB;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvCommon;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.General;
|
||||
|
||||
internal class AlignModelElement
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvCommon;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.General;
|
||||
|
||||
public enum AlignType
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvCommon;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.General;
|
||||
|
||||
@@ -20,18 +18,18 @@ public class AutoSaveCmd : ExternalCommand
|
||||
return;
|
||||
}
|
||||
AutoSaveViewModel viewModel = new();
|
||||
General.AutoSaveView view = new()
|
||||
AutoSaveView view = new()
|
||||
{
|
||||
DataContext = viewModel
|
||||
};
|
||||
view.ShowDialog();
|
||||
|
||||
if (RevitAddins.Properties.Settings.Default.IsActiveAutoSave)
|
||||
if (Properties.Settings.Default.IsActiveAutoSave)
|
||||
{
|
||||
if (RevitAddins.Properties.Settings.Default.AutoSaveIntervalTime >= 1)
|
||||
if (Properties.Settings.Default.AutoSaveIntervalTime >= 1)
|
||||
{
|
||||
timer.Interval = RevitAddins.Properties.Settings.Default.AutoSaveIntervalTime * 60 * 1000;
|
||||
RevitAddins.Properties.Settings.Default.Save();
|
||||
timer.Interval = Properties.Settings.Default.AutoSaveIntervalTime * 60 * 1000;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
//timer.Enabled = Properties.Settings.Default.AutoSave;
|
||||
timer.Start();
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using Melskin.Controls;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvCommon;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.General;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -9,8 +9,8 @@ public partial class AutoSaveViewModel : ObservableValidator
|
||||
{
|
||||
public AutoSaveViewModel()
|
||||
{
|
||||
IsActiveAutoSave = RevitAddins.Properties.Settings.Default.IsActiveAutoSave;
|
||||
IntervalTime = RevitAddins.Properties.Settings.Default.AutoSaveIntervalTime;
|
||||
IsActiveAutoSave = Properties.Settings.Default.IsActiveAutoSave;
|
||||
IntervalTime = Properties.Settings.Default.AutoSaveIntervalTime;
|
||||
}
|
||||
[ObservableProperty]
|
||||
public partial bool IsActiveAutoSave { get; set; }
|
||||
@@ -30,9 +30,9 @@ public partial class AutoSaveViewModel : ObservableValidator
|
||||
[RelayCommand]
|
||||
private void Closing()
|
||||
{
|
||||
RevitAddins.Properties.Settings.Default.IsActiveAutoSave = IsActiveAutoSave;
|
||||
RevitAddins.Properties.Settings.Default.AutoSaveIntervalTime = IntervalTime;
|
||||
RevitAddins.Properties.Settings.Default.Save();
|
||||
Properties.Settings.Default.IsActiveAutoSave = IsActiveAutoSave;
|
||||
Properties.Settings.Default.AutoSaveIntervalTime = IntervalTime;
|
||||
Properties.Settings.Default.Save();
|
||||
Variables.AutoSaveTimer.Interval = IntervalTime * 60 * 1000;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,5 @@
|
||||
using Melskin.Controls;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvCommon;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.General
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -5,10 +5,6 @@ using Autodesk.Revit.DB;
|
||||
using eTransmitForRevitDB;
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.RvCommon;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.General;
|
||||
|
||||
/// <summary>
|
||||
@@ -21,7 +17,7 @@ public class PureModelCmd : ExternalCommand
|
||||
{
|
||||
if (string.IsNullOrEmpty(Document.PathName))
|
||||
{
|
||||
System.Windows.MessageBox.Show("请先保存文件");
|
||||
MessageBox.Show("请先保存文件");
|
||||
return;
|
||||
}
|
||||
var result = MessageBox.Show("是否清理项目中的所有未使用项", "询问", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
@@ -39,7 +35,7 @@ public class PureModelCmd : ExternalCommand
|
||||
{
|
||||
Purge(Document);
|
||||
Document.SaveAs(Document.PathName, options);
|
||||
System.Windows.MessageBox.Show("清理完成", "提示");
|
||||
MessageBox.Show("清理完成", "提示");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user