浏览代码

mxg:添加系统名称重命名命令

mengxiangge 6 年之前
父节点
当前提交
24dcd461a1

+ 12 - 1
MBI/Menu/MBITool.xml

@@ -198,7 +198,18 @@
       <MenuTab>MBITool_W</MenuTab>
       <Modules>MBITool</Modules>
     </Button>
-    
+    <Button ButtonStyles="Stacked">
+      <ButtonName>SAGA.MBI.RenameSystemNameCommand</ButtonName>
+      <ButtonText>重命名系统名称</ButtonText>
+      <ImageName>1、打开楼层模型</ImageName>
+      <DllName>..\OutputDll\SAGA.MBI.exe</DllName>
+      <ClassName>SAGA.MBI.RenameSystemNameCommand</ClassName>
+      <ToolTip>根据excel规则重命名风管和水管系统名称</ToolTip>
+      <LongDescription>重命名系统名称</LongDescription>
+      <ToolTipImage></ToolTipImage>
+      <MenuTab>MBITool_W</MenuTab>
+      <Modules>MBITool</Modules>
+    </Button>
   </Panel>
  <Panel PanelName="功能扩展" GroupFlag="True" GroupImage="" RevitVer="R14,R15,R16,R17"  ButtonStyles="Large">   
     <Button ButtonStyles="Large">

+ 1 - 1
MBI/SAGA.DotNetUtils/NPOI/NPOIHelper.cs

@@ -326,7 +326,7 @@ namespace SAGA.DotNetUtils.NPOI
                 IRow row;
                 // List<int> showIndex = new List<int> { 1, 2, 3, 4 };
 
-                for (int i = sheetInfo.RowStartIndex; i < sheet.LastRowNum; i++)
+                for (int i = sheetInfo.RowStartIndex; i <= sheet.LastRowNum; i++)
                 {
                     row = sheet.GetRow(i);
                     if (row != null)

+ 3 - 3
MBI/SAGA.DotNetUtils/SAGA.DotNetUtils.csproj

@@ -504,8 +504,8 @@
     <Compile Include="WPF\UserControl\SelectFile_Hyperlink.xaml.cs">
       <DependentUpon>SelectFile_Hyperlink.xaml</DependentUpon>
     </Compile>
-    <Compile Include="WPF\UserControl\SelectPath_Start.xaml.cs">
-      <DependentUpon>SelectPath_Start.xaml</DependentUpon>
+    <Compile Include="WPF\UserControl\SelectPath.xaml.cs">
+      <DependentUpon>SelectPath.xaml</DependentUpon>
     </Compile>
     <Compile Include="WPF\UserControl\SliderCheckBox.xaml.cs">
       <DependentUpon>SliderCheckBox.xaml</DependentUpon>
@@ -567,7 +567,7 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
-    <Page Include="WPF\UserControl\SelectPath_Start.xaml">
+    <Page Include="WPF\UserControl\SelectPath.xaml">
       <SubType>Designer</SubType>
       <Generator>XamlIntelliSenseFileGenerator</Generator>
     </Page>

+ 15 - 3
MBI/SAGA.DotNetUtils/WPF/UserControl/SelectFile_Hyperlink.xaml.cs

@@ -16,7 +16,7 @@ using SAGA.DotNetUtils.Extend;
 namespace SAGA.DotNetUtils.WPF.UserControl
 {
     /// <summary>
-    /// SelectPath_Start.xaml 的交互逻辑
+    /// SelectPath.xaml 的交互逻辑
     /// </summary>
     public partial class SelectFile_Hyperlink
     {
@@ -30,6 +30,18 @@ namespace SAGA.DotNetUtils.WPF.UserControl
             get { return (string)GetValue(TextProperty); }
             set { SetValue(TextProperty, value); }
         }
+        public static readonly DependencyProperty FullPathProperty = DependencyProperty.Register("FullPath", typeof(string), typeof(SelectFile_Hyperlink));
+        public string FullPath
+        {
+            get { return (string)GetValue(FullPathProperty); }
+            set { SetValue(FullPathProperty, value); }
+        }
+        public static readonly DependencyProperty IsDisplayFullPathProperty = DependencyProperty.Register("IsDisplayFullPath", typeof(bool), typeof(SelectFile_Hyperlink));
+        public bool IsDisplayFullPath
+        {
+            get { return (bool)GetValue(IsDisplayFullPathProperty); }
+            set { SetValue(IsDisplayFullPathProperty, value); }
+        }
 
 
         public static readonly DependencyProperty BtnImageProperty = DependencyProperty.Register("BtnImage", typeof(BitmapImage), typeof(SelectFile_Hyperlink));
@@ -57,9 +69,9 @@ namespace SAGA.DotNetUtils.WPF.UserControl
 
                 if (dialog.ShowDialog() == true)
                 {
-                    this.Tag = dialog.FileName;
+                    FullPath = dialog.FileName;
                     string foldPath = Path.GetFileName(dialog.FileName);
-                    Text = foldPath;
+                    Text = IsDisplayFullPath?FullPath:foldPath;
                     AttachAction?.Invoke();
                 }
             }

+ 56 - 0
MBI/SAGA.DotNetUtils/WPF/UserControl/SelectPath.xaml

@@ -0,0 +1,56 @@
+<UserControl x:Class="SAGA.DotNetUtils.WPF.UserControl.SelectPath"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:userControl="clr-namespace:SAGA.DotNetUtils.WPF.UserControl"
+             mc:Ignorable="d" x:Name="Uc"
+             d:DesignHeight="25" d:DesignWidth="300">
+    <UserControl.Resources>
+        <userControl:ButtonWidthConverter x:Key="startWidthConverter" IsInverce="False"></userControl:ButtonWidthConverter>
+        <userControl:ButtonWidthConverter x:Key="endWidthConverter" IsInverce="True"></userControl:ButtonWidthConverter>
+    </UserControl.Resources>
+    <Grid>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="Auto" >
+                <!--<ColumnDefinition.Width>
+                    <MultiBinding Converter="{StaticResource startWidthConverter}">
+                        <Binding Path="Height"  RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType=UserControl}" UpdateSourceTrigger="PropertyChanged"></Binding>
+                        <Binding Path="ButtonPosition"  RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType=UserControl}" UpdateSourceTrigger="PropertyChanged"></Binding>
+                    </MultiBinding>
+                </ColumnDefinition.Width>-->
+            </ColumnDefinition>
+            <ColumnDefinition Width="*"/>
+            <ColumnDefinition Width="Auto">
+                <!--<ColumnDefinition.Width>
+                    <MultiBinding Converter="{StaticResource endWidthConverter}"  >
+                        <Binding Path="Height"  RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType=UserControl}"  UpdateSourceTrigger="PropertyChanged"></Binding>
+                        <Binding Path="ButtonPosition"  RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType=UserControl}" UpdateSourceTrigger="PropertyChanged"></Binding>
+                    </MultiBinding>
+                </ColumnDefinition.Width>-->
+            </ColumnDefinition>
+        </Grid.ColumnDefinitions>
+        <Button Grid.Column="0" Click="Button_Click" >
+            <Button.Width>
+                <MultiBinding Converter="{StaticResource startWidthConverter}">
+                    <Binding Path="Height"  RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType=UserControl}" UpdateSourceTrigger="PropertyChanged"></Binding>
+                    <Binding Path="ButtonPosition"  RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType=UserControl}" UpdateSourceTrigger="PropertyChanged"></Binding>
+                </MultiBinding>
+            </Button.Width>
+            <Image Source="{Binding Path=BtnImage, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}"></Image>
+        </Button>
+        <TextBox Grid.Column="1" x:Name="TextBox"
+                 VerticalContentAlignment="Center"
+HorizontalContentAlignment="Left"
+                 Text="{Binding Path=Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}"></TextBox>
+        <Button Grid.Column="2" Click="Button_Click">
+            <Button.Width>
+                <MultiBinding Converter="{StaticResource endWidthConverter}">
+                    <Binding Path="Height"  RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType=UserControl}" UpdateSourceTrigger="PropertyChanged"></Binding>
+                    <Binding Path="ButtonPosition"  RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType=UserControl}" UpdateSourceTrigger="PropertyChanged"></Binding>
+                </MultiBinding>
+            </Button.Width>
+            <Image Source="{Binding Path=BtnImage, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}"></Image>
+        </Button>
+    </Grid>
+</UserControl>

+ 46 - 7
MBI/SAGA.DotNetUtils/WPF/UserControl/SelectPath_Start.xaml.cs

@@ -7,7 +7,9 @@
 
 
 using System;
+using System.Globalization;
 using System.Windows;
+using System.Windows.Data;
 using System.Windows.Forms;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
@@ -15,29 +17,35 @@ using System.Windows.Media.Imaging;
 namespace SAGA.DotNetUtils.WPF.UserControl
 {
     /// <summary>
-    /// SelectPath_Start.xaml 的交互逻辑
+    /// SelectPath.xaml 的交互逻辑
     /// </summary>
-    public partial class SelectPath_Start
+    public partial class SelectPath
     {
-        public SelectPath_Start()
+        public SelectPath()
         {
             InitializeComponent();
         }
-        public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(SelectPath_Start));
+        public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(SelectPath));
         public string Text
         {
             get { return (string)GetValue(TextProperty); }
             set { SetValue(TextProperty, value); }
         }
+        public static readonly DependencyProperty ButtonPositionProperty = DependencyProperty.Register("ButtonPosition", typeof(ButtonPosition), typeof(SelectPath));
+        public ButtonPosition ButtonPosition
+        {
+            get { return (ButtonPosition)GetValue(ButtonPositionProperty); }
+            set { SetValue(ButtonPositionProperty, value); }
+        }
 
-        public static readonly DependencyProperty BtnImageProperty = DependencyProperty.Register("BtnImage", typeof(ImageSource), typeof(SelectPath_Start));
+        public static readonly DependencyProperty BtnImageProperty = DependencyProperty.Register("BtnImage", typeof(ImageSource), typeof(SelectPath));
         public ImageSource BtnImage
         {
             get { return (ImageSource)GetValue(BtnImageProperty); }
             set { SetValue(BtnImageProperty, value); }
         }
 
-        public Action<System.Windows.Controls.UserControl,string> AttachAction;
+        public Action<System.Windows.Controls.UserControl, string> AttachAction;
 
         private void Button_Click(object sender, RoutedEventArgs e)
         {
@@ -48,9 +56,40 @@ namespace SAGA.DotNetUtils.WPF.UserControl
             {
                 string foldPath = dialog.SelectedPath;
                 Text = foldPath;
-                AttachAction?.Invoke(this,foldPath);
+                AttachAction?.Invoke(this, foldPath);
             }
         }
 
+
+    }
+    public enum ButtonPosition
+    {
+        Start,
+        End,
     }
+
+    public class ButtonWidthConverter : IMultiValueConverter
+    {
+        public bool IsInverce { get; set; }
+
+        
+
+        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+        {
+            var buttonPosition = (ButtonPosition)values[1];
+            double width = 0;
+            if (buttonPosition != ButtonPosition.Start)
+            {
+                width = 0;
+            }
+
+            return IsInverce ? values[0] : width;
+        }
+
+        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+
 }

+ 0 - 20
MBI/SAGA.DotNetUtils/WPF/UserControl/SelectPath_Start.xaml

@@ -1,20 +0,0 @@
-<UserControl x:Class="SAGA.DotNetUtils.WPF.UserControl.SelectPath_Start"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-             mc:Ignorable="d" x:Name="Uc"
-             d:DesignHeight="25" d:DesignWidth="300">
-    <Grid>
-        <Grid.ColumnDefinitions>
-            <ColumnDefinition  Width="{Binding Path=Height, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}"/>
-            <ColumnDefinition Width="*"/>
-        </Grid.ColumnDefinitions>
-        <Button Grid.Column="0" Click="Button_Click">
-            <Image Source="{Binding Path=BtnImage, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}"></Image>
-        </Button>
-        <TextBox Grid.Column="1"
-                 VerticalContentAlignment="Center"
-                 Text="{Binding Path=Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}"></TextBox>
-    </Grid>
-</UserControl>

+ 8 - 0
MBI/SAGA.MBI/SAGA.MBI.csproj

@@ -330,6 +330,10 @@
     <Compile Include="Service\InputService.cs" />
     <Compile Include="Test\CopyParameterValue.cs" />
     <Compile Include="Test\CopyWallLocalName.cs" />
+    <Compile Include="Test\RenameSystemName.cs" />
+    <Compile Include="Test\WinRenameConfig.xaml.cs">
+      <DependentUpon>WinRenameConfig.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Test\WinParameterDic.xaml.cs">
       <DependentUpon>WinParameterDic.xaml</DependentUpon>
     </Compile>
@@ -757,6 +761,10 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="Test\WinRenameConfig.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="Test\WinParameterDic.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 141 - 0
MBI/SAGA.MBI/Test/RenameSystemName.cs

@@ -0,0 +1,141 @@
+/* ==============================================================================
+ * 功能描述:RenameSystemName  
+ * 创 建 者:Garrett
+ * 创建日期:2019/6/20 9:11:31
+ * ==============================================================================*/
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Autodesk.Revit.DB;
+using Autodesk.Revit.DB.Electrical;
+using Autodesk.Revit.DB.Plumbing;
+using SAGA.DotNetUtils.Extend;
+using SAGA.DotNetUtils.NPOI;
+using SAGA.DotNetUtils.Others;
+using SAGA.MBI.Model;
+using SAGA.MBI.Tools;
+using SAGA.MBI.ToolsData;
+using SAGA.RevitUtils.Extends;
+
+namespace SAGA.MBI.Test
+{
+    /// <summary>
+    /// RenameSystemName
+    /// </summary>
+    class RenameSystemName : IDataCorrect
+    {
+        public string Execute(MFloor floor)
+        {
+            try
+            {
+                string fullPah = floor.FullPath;
+                Document doc = ExternalDataWrapper.Current.UiApp.Application.OpenDocumentFile(fullPah);
+                //OperateFloor(doc);
+                doc.Save();
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+            return null;
+        }
+
+        public string ExecuteAll()
+        {
+            throw new NotImplementedException();
+        }
+
+        private static void OperateFloor(string fullPah, List<Ref_RenameSystem> refRenameSystems)
+        {
+            var doc= ExternalDataWrapper.Current.UiApp.Application.OpenDocumentFile(fullPah);
+            using (Transaction trans = new Transaction(doc, "重命名系统名称"))
+            {
+                trans.Start();
+
+                try
+                {
+                    var types = doc.GetElements(typeof(MEPSystemType));
+                    types.AddRange(doc.GetElements(typeof(CableTrayType)));
+                    foreach (ElementType type in types)
+                    {
+                        string typeName = type.Name;
+                        var refPair=refRenameSystems.FirstOrDefault(t => t.OldName == typeName);
+                        if (refPair != null)
+                        {
+                            type.Name = refPair.NewName;
+                        }
+                    }
+
+                    trans.Commit();
+                }
+                catch (Exception e)
+                {
+                    Console.WriteLine(e);
+                    trans.RollBack();
+                }
+            }
+
+            doc.CloseDoc();
+        }
+
+        public void Operate(string referPath,string revitDir)
+        {
+            var refPairs = GetReferencePairs(referPath);
+            if (!refPairs.Any()) return;
+            var list = GetRevitFiles(revitDir);
+            if (!list.Any()) return;
+            foreach (string fullPath in list)
+            {
+                OperateFloor(fullPath, refPairs);
+            }
+        }
+        /// <summary>
+        /// 获取需要修改的Revit文件
+        /// </summary>
+        /// <param name="revitDir"></param>
+        /// <returns></returns>
+        private static List<string> GetRevitFiles(string revitDir)
+        {
+            DirectoryInfo directory=new DirectoryInfo(revitDir);
+            List<string> list=new List<string>();
+            try
+            {
+                list=directory.GetFiles("*.rvt").Where(t=>!t.FullName.Is000File()).Select(t=>t.FullName).ToList();
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine(e);
+                
+            }
+
+            return list;
+        }
+
+        /// <summary>
+        /// 参考-表
+        /// </summary>Sheet1
+        [SheetInfo(SheetName = "Sheet1", RowStartIndex = 3)]
+        public class Ref_RenameSystem
+        {
+            [CellIndex(2)]
+            public string OldName { get; set; }
+
+            [CellIndex(3)]
+            public string NewName { get; set; }
+        }
+
+        /// <summary>
+        /// 获取可识别的管道系统名称
+        /// </summary>
+        /// <returns></returns>
+        private static List<Ref_RenameSystem> GetReferencePairs(string path)
+        {
+            var list = NPOIHelper
+                .ConvertExcelSheetToModel<Ref_RenameSystem>(path);
+            return list;
+        }
+    }
+}

+ 3 - 2
MBI/SAGA.MBI/Test/WinParameterDic.xaml

@@ -1,9 +1,10 @@
-<Window x:Class="SAGA.MBI.Test.WinParameterDic"
+<windows:WinBase x:Class="SAGA.MBI.Test.WinParameterDic"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:SAGA.MBI.Test"
+             xmlns:windows="clr-namespace:SAGA.RevitUtils.Windows;assembly=SAGA.RevitUtils"
              mc:Ignorable="d" Title="配置参数" WindowStartupLocation="CenterScreen"
                   Height="300" Width="400">
     <Window.Resources>
@@ -89,5 +90,5 @@
             <Button Height="24" Width="100" Content="取消" Margin="10,0" IsCancel="True"></Button>
         </WrapPanel>
     </Grid>
-</Window>
+</windows:WinBase>
 

+ 56 - 0
MBI/SAGA.MBI/Test/WinRenameConfig.xaml

@@ -0,0 +1,56 @@
+<windows:WinBase x:Class="SAGA.MBI.Test.WinRenameConfig"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:SAGA.MBI.Test"
+        xmlns:wpf="clr-namespace:SAGA.DotNetUtils.WPF.UserControl;assembly=SAGA.DotNetUtils"
+        xmlns:windows="clr-namespace:SAGA.RevitUtils.Windows;assembly=SAGA.RevitUtils"
+        mc:Ignorable="d" Title="系统重命名参数设置" WindowStartupLocation="CenterScreen"
+                  Height="200" Width="400">
+    <Window.Resources>
+        <Style  TargetType="TextBox">
+            <Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
+            <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
+            <Setter Property="Height" Value="24"></Setter>
+        </Style>
+        <Style TargetType="DataGridColumnHeader">
+            <Setter Property="Height" Value="25"></Setter>
+            <Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
+            <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
+        </Style>
+        <Style x:Key="dgtextblock">
+            <Setter Property="TextBlock.Height" Value="25"></Setter>
+            <Setter Property="TextBlock.HorizontalAlignment" Value="Center"></Setter>
+        </Style>
+        <Style x:Key="dgtextbox">
+            <Setter Property="TextBox.Height" Value="25"></Setter>
+            <Setter Property="TextBox.HorizontalContentAlignment" Value="Center"></Setter>
+        </Style>
+    </Window.Resources>
+    <Grid Margin="5">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="50"></RowDefinition>
+            <RowDefinition></RowDefinition>
+            <RowDefinition Height="50"></RowDefinition>
+        </Grid.RowDefinitions>
+        <Grid Grid.Row="0">
+            <StackPanel>
+                <Label Content="请选择重命名系统的参考表:"></Label>
+                <wpf:SelectFile_Hyperlink Height="25" Text="{Binding Path=ReferenceFilePath,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" IsDisplayFullPath="True"></wpf:SelectFile_Hyperlink>
+            </StackPanel>
+        </Grid>
+        <Grid Grid.Row="1">
+            <StackPanel>
+                <Label Content="请选择需要修改的Revit文件夹:"></Label>
+                <wpf:SelectPath Height="25" Text="{Binding Path=RevitDirs,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" ButtonPosition="End"></wpf:SelectPath>
+            </StackPanel>
+        </Grid>
+
+        <WrapPanel Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center">
+            <Button Height="24" Width="100" Content="执行" Margin="10,0" IsDefault="True" Click="ButtonBase_OnClick"></Button>
+            <Button Height="24" Width="100" Content="取消" Margin="10,0" IsCancel="True"></Button>
+        </WrapPanel>
+    </Grid>
+</windows:WinBase>
+

+ 82 - 0
MBI/SAGA.MBI/Test/WinRenameConfig.xaml.cs

@@ -0,0 +1,82 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+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.Navigation;
+using System.Windows.Shapes;
+using Exception = System.Exception;
+
+namespace SAGA.MBI.Test
+{
+    /// <summary>
+    /// WinParameterDic.xaml 的交互逻辑
+    /// </summary>
+    public partial class WinRenameConfig : INotifyPropertyChanged
+    {
+        public WinRenameConfig()
+        {
+            InitializeComponent();
+            this.DataContext = this;
+        }
+
+        #region Binding
+        
+
+        private string m_ReferenceFilePath;
+
+        public string ReferenceFilePath
+        {
+            get { return m_ReferenceFilePath; }
+            set
+            {
+                m_ReferenceFilePath = value;
+                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ReferenceFilePath)));
+            }
+        }
+
+        private string m_RevitDirs;
+
+        public string RevitDirs
+        {
+            get { return m_RevitDirs; }
+            set
+            {
+                m_RevitDirs = value;
+                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(RevitDirs)));
+            }
+        }
+
+
+        #endregion
+
+
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
+        {
+            try
+            {
+
+            }
+            catch (Exception exception)
+            {
+                Console.WriteLine(exception);
+
+            }
+
+            this.DialogResult = true;
+        }
+
+        
+    }
+}

+ 38 - 0
MBI/SAGA.MBI/ToolCommand.cs

@@ -315,6 +315,44 @@ namespace SAGA.MBI
             return true;
         }
     }
+
+    /// <summary>
+    /// 重命名系统名称
+    /// </summary>
+    [Transaction(TransactionMode.Manual)]
+    [Regeneration(RegenerationOption.Manual)]
+    public class RenameSystemNameCommand : ExternalCommand
+    {
+        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
+        {
+            try
+            {
+                var iDataCorrect = SingleInstance<RenameSystemName>.Instance;
+                if (true)
+                {
+                    WinRenameConfig win = new WinRenameConfig();
+                    if (win.ShowDialog() == true)
+                    {
+                        iDataCorrect.Operate(win.ReferenceFilePath, win.RevitDirs);
+                        MessageShowBase.Infomation("系统名称已修改,请检查");
+                    }
+                }
+
+
+            }
+            catch (Exception e)
+            {
+                MessageShow.Show(e);
+                return Result.Cancelled;
+            }
+            return Result.Succeeded;
+        }
+
+        public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
+        {
+            return true;
+        }
+    }
     #endregion
 
     #region 数据修正

+ 2 - 2
MBI/SAGA.MBI/WinView/Login/WinSelectProjectPath.xaml

@@ -19,9 +19,9 @@
             Canvas.Left="30"
             Canvas.Top="20"
             Content="请选择本项目对应的工作区文件夹"></Label>
-        <wpf:SelectPath_Start x:Name="btnSelectPath" Canvas.Top="70" Canvas.Left="30" Width="190" Height="24"
+        <wpf:SelectPath x:Name="btnSelectPath" Canvas.Top="70" Canvas.Left="30" Width="190" Height="24"
                               Text="{Binding Path=ProjectPath,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
-                              BtnImage="{Binding Path=OFImage,Converter={StaticResource StringToImageConverter}}"></wpf:SelectPath_Start>
+                              BtnImage="{Binding Path=OFImage,Converter={StaticResource StringToImageConverter}}"></wpf:SelectPath>
         <Label Canvas.Left="221" Canvas.Top="69" 
                Content="\"></Label>
         <Label Canvas.Left="228" Canvas.Top="69" 

+ 4 - 4
MBI/SAGA.RevitUtils/Windows/WinBase.cs

@@ -70,8 +70,8 @@ namespace SAGA.RevitUtils.Windows
             this.CurWindowHandle = winHelper.Handle;
 
             //由于窗体经常跑到屏幕外面,取消保存历史记录 mxg 20181030
-            //var datas = new List<SaveData>();
-            //if (IsLoadHistroyData) this.SetControlData(out datas);
+            var datas = new List<SaveData>();
+            if (IsLoadHistroyData) this.SetControlData(out datas);
             //SetWindowPosition(datas);
 
             if (Resources != null)
@@ -173,8 +173,8 @@ namespace SAGA.RevitUtils.Windows
         {
             StopTimer();
             base.OnClosed(e);
-            //var datas = new List<SaveData>() { GetLocationSaveData() };
-            //this.SaveControlData(datas);
+            var datas = new List<SaveData>() { GetLocationSaveData() };
+            this.SaveControlData(datas);
         }
 
         /// <summary>

+ 1 - 1
MBI/WPG/UserControls/UcHyperlink.xaml.cs

@@ -15,7 +15,7 @@ using WPG.Data;
 namespace WPG.UserControls
 {
     /// <summary>
-    /// SelectPath_Start.xaml 的交互逻辑
+    /// SelectPath.xaml 的交互逻辑
     /// </summary>
     public partial class UcHyperlink
     {

+ 1 - 1
MBI/WPG/UserControls/UcPopups_Nameplate.xaml.cs

@@ -15,7 +15,7 @@ using WPG.Data;
 namespace WPG.UserControls
 {
     /// <summary>
-    /// SelectPath_Start.xaml 的交互逻辑
+    /// SelectPath.xaml 的交互逻辑
     /// </summary>
     public partial class UcPopups_Nameplate
     {