Przeglądaj źródła

xls:型号选择等容错处理

xulisong 6 lat temu
rodzic
commit
5a4b83e58b

+ 69 - 0
MBI/SAGA.MBI/Common/TryCatchWrapper.cs

@@ -0,0 +1,69 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:TryCatchWrapper
+ * 作者:xulisong
+ * 创建时间: 2019/8/12 11:09:47
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SAGA.RevitUtils;
+namespace SAGA.MBI.Common
+{
+    /// <summary>
+    /// 捕获异常包裹器
+    /// </summary>
+    public class TryCatchWrapper
+    {
+        private Action<Exception> m_ExceptionHandle;
+        public TryCatchWrapper()
+        {
+
+        }
+        public TryCatchWrapper(Action<Exception> exceptionHandle)
+        {
+            m_ExceptionHandle = exceptionHandle;
+        }
+        public virtual void ExceptionHandle(Exception e)
+        {
+            m_ExceptionHandle?.Invoke(e);
+        }
+        /// <summary>
+        /// 处理信息
+        /// </summary>
+        /// <param name="action"></param>
+        public  void Handled(Action action)
+        {
+            try
+            {
+                action?.Invoke();
+            }
+            catch (Exception e)
+            {
+                ExceptionHandle(e);
+            }
+        }
+        #region 静态相关函数
+
+        public static void SetUIWrapper(Action<Exception> exceptionHandle)
+        {
+            UIWrapper = new TryCatchWrapper(exceptionHandle);
+        }
+        /// <summary>
+        /// UI处理Wrapper
+        /// </summary>
+        public static TryCatchWrapper UIWrapper { get; private set; } = new TryCatchWrapper((e) => MessageShow.Show(e));
+        /// <summary>
+        /// 处理UI封装函数
+        /// </summary>
+        /// <param name="action"></param>
+        public static void HandleUI(Action action)
+        {
+            UIWrapper?.Handled(action);
+        } 
+        #endregion
+    }
+}

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

@@ -282,6 +282,7 @@
     <Compile Include="Common\PhaseUtil.cs" />
     <Compile Include="Common\RegexConstPattern.cs" />
     <Compile Include="Common\RevitBuiltInParameter.cs" />
+    <Compile Include="Common\TryCatchWrapper.cs" />
     <Compile Include="Common\WaitingView.cs" />
     <Compile Include="DataArrange\DalInfoCode.cs" />
     <Compile Include="Gplot\GplotFileItem.cs" />

+ 3 - 3
MBI/SAGA.MBI/WinView/ModeInfoMaintenance/WinInsuer.xaml

@@ -22,9 +22,9 @@
             <DataGrid  x:Name="pivotGridControl1" ItemsSource="{Binding Path=Venders}" SelectedItem="{Binding Path=CurrentVender}"
                        dgx:DataGridFilter.IsAutoFilterEnabled="True" Style="{StaticResource ResourceKey={x:Static wpf:DataGridResource.DataGridStyle}}">
                 <DataGrid.Columns>
-                <DataGridTextColumn Width="*" Header="厂商名称"  Binding="{Binding Path=Name}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
-                <DataGridTextColumn Width="150" Header="联系人" Binding="{Binding Path=Negotiator }"   ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
-                <DataGridTextColumn Width="120" Header="联系电话" Binding="{Binding Path=PhoneNumber}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
+                    <DataGridTextColumn IsReadOnly="True" Width="*" Header="厂商名称"  Binding="{Binding Path=Name}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
+                    <DataGridTextColumn IsReadOnly="True" Width="150" Header="联系人" Binding="{Binding Path=Negotiator }"   ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
+                    <DataGridTextColumn IsReadOnly="True" Width="120" Header="联系电话" Binding="{Binding Path=PhoneNumber}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
                 </DataGrid.Columns>
 
             </DataGrid>

+ 56 - 43
MBI/SAGA.MBI/WinView/ModeInfoMaintenance/WinInsuer.xaml.cs

@@ -18,6 +18,7 @@ using System.Linq;
 using System.Windows;
 using SAGA.MBI.RequestData;
 using WPG.Data;
+using TryCatchWrapper = SAGA.MBI.Common.TryCatchWrapper;
 
 namespace SAGA.MBI.WinView.ModeInfoMaintenance
 {
@@ -41,8 +42,11 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
 
         private void WinManufacturer_Loaded(object sender, RoutedEventArgs e)
         {
-            InitData();
-            this.DataContext = this;
+            TryCatchWrapper.HandleUI(() =>
+            {
+                InitData();
+                this.DataContext = this;
+            });
         }
         /// <summary>
         /// 重新初始化界面
@@ -51,7 +55,6 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
         {
             BaseVenders = DalManufacturerLibrary.GetInsuer(MBIControl.ProjectCur.Id);
             Venders = new ObservableCollection<MInsuer>(BaseVenders);
-            //CurrentVender = Venders.FirstOrDefault();
             GotoMatchInfo(m_MEquipment);
 
         }
@@ -112,60 +115,70 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
 
         private void Add_Mode(object sender, RoutedEventArgs e)
         {
-            WinFirmMain main = new WinFirmMain(new WinInsuerBaseInfo());
-            main.Title += "--保险商管理";
-            main.ShowDialog();
-            InitData();
+            TryCatchWrapper.HandleUI(() =>
+            {
+                WinFirmMain main = new WinFirmMain(new WinInsuerBaseInfo());
+                main.Title += "--保险商管理";
+                main.ShowDialog();
+                InitData();
+            });
+          
         }
         private void Update_Mode(object sender, RoutedEventArgs e)
         {
-            // new WinFirmMain(new WinInsuerBaseInfo());
-            Window main = null;
-          
-            if (CurrentVender != null)
-            {
-                var dic = new Dictionary<string, object>();
-                dic.Add("InsuerId", CurrentVender.Id);
-                main=FirmLibPost.StartWindow(@"WinInsuerBaseInfo\WinInsuerInfo\WinInsurancePolicyEditor", dic);
-            }
-            else
+            TryCatchWrapper.HandleUI(() =>
             {
-                main = new WinFirmMain(new WinInsuerBaseInfo());
-            }
-            main.Title += "--保险商管理";
-            main.ShowDialog();
-            InitData();
+                Window main = null;
+
+                if (CurrentVender != null)
+                {
+                    var dic = new Dictionary<string, object>();
+                    dic.Add("InsuerId", CurrentVender.Id);
+                    main = FirmLibPost.StartWindow(@"WinInsuerBaseInfo\WinInsuerInfo\WinInsurancePolicyEditor", dic);
+                }
+                else
+                {
+                    main = new WinFirmMain(new WinInsuerBaseInfo());
+                }
+                main.Title += "--保险商管理";
+                main.ShowDialog();
+                InitData();
+            });          
         }
 
 
         private void BtnSaveChange_OnClick(object sender, RoutedEventArgs e)
         {
-            if (CurrentVender == null)
+            TryCatchWrapper.HandleUI(() =>
             {
-                MessageShow.Infomation("没有选中任何供应商信息");
-                return;
-            }
-            bool isSave = true;
-            if (IsChange)
-            {
-                WinRealityUpdateTime win = new WinRealityUpdateTime();
-                win.Host = "保险公司";
-                win.Owner = this;
-                isSave = win.ShowDialog() == true;
-                if (isSave)
+                if (CurrentVender == null)
+                {
+                    MessageShow.Infomation("没有选中任何供应商信息");
+                    return;
+                }
+                bool isSave = true;
+                if (IsChange)
                 {
-                    if (win.DateTime == null)
+                    WinRealityUpdateTime win = new WinRealityUpdateTime();
+                    win.Host = "保险公司";
+                    win.Owner = this;
+                    isSave = win.ShowDialog() == true;
+                    if (isSave)
                     {
-                        MessageShow.Infomation("更换时间不能为空");
-                        return;
+                        if (win.DateTime == null)
+                        {
+                            MessageShow.Infomation("更换时间不能为空");
+                            return;
+                        }
+                        ChangeRealTime = win.DateTime?.ToString("yyyyMMddHHmmss");
                     }
-                    ChangeRealTime = win.DateTime?.ToString("yyyyMMddHHmmss");
                 }
-            }
-            if(isSave)
-            {
-                this.DialogResult = true;
-            }
+                if (isSave)
+                {
+                    this.DialogResult = true;
+                }
+            });
+           
             
         }
 

+ 7 - 3
MBI/SAGA.MBI/WinView/ModeInfoMaintenance/WinInsuerContractInfo.xaml.cs

@@ -46,9 +46,13 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
   
         public WinInsuerContractInfo(MEquipment equipment) : this()
         {
-            m_MEquipment = equipment;
-            this.m_Vm = new VMInsuerContractInfo(m_MEquipment);
-            this.DataContext = this.m_Vm;
+            TryCatchWrapper.HandleUI(() =>
+            {
+                m_MEquipment = equipment;
+                this.m_Vm = new VMInsuerContractInfo(m_MEquipment);
+                this.DataContext = this.m_Vm;
+            });
+           
         }
         public void UpdateWPG(object obj)
         {

+ 3 - 3
MBI/SAGA.MBI/WinView/ModeInfoMaintenance/WinMaintenanceDealer.xaml

@@ -22,9 +22,9 @@
             <DataGrid  x:Name="pivotGridControl1" ItemsSource="{Binding Path=Venders}" SelectedItem="{Binding Path=CurrentVender}"
                        dgx:DataGridFilter.IsAutoFilterEnabled="True" Style="{StaticResource ResourceKey={x:Static wpf:DataGridResource.DataGridStyle}}" >
                 <DataGrid.Columns>
-                    <DataGridTextColumn Width="*" Header="厂商名称"  Binding="{Binding Path=Name}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
-                    <DataGridTextColumn Width="150" Header="联系人" Binding="{Binding Path=Negotiator}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
-                    <DataGridTextColumn Width="120" Header="联系电话" Binding="{Binding Path=PhoneNumber}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
+                    <DataGridTextColumn IsReadOnly="True" Width="*" Header="厂商名称"  Binding="{Binding Path=Name}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
+                    <DataGridTextColumn IsReadOnly="True" Width="150" Header="联系人" Binding="{Binding Path=Negotiator}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
+                    <DataGridTextColumn IsReadOnly="True" Width="120" Header="联系电话" Binding="{Binding Path=PhoneNumber}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
                 </DataGrid.Columns>
              
             </DataGrid>

+ 67 - 50
MBI/SAGA.MBI/WinView/ModeInfoMaintenance/WinMaintenanceDealer.xaml.cs

@@ -28,6 +28,7 @@ using SAGA.MBI.Model;
 using SAGA.MBI.RequestData;
 using SAGA.RevitUtils;
 using WPG.Data;
+using TryCatchWrapper = SAGA.MBI.Common.TryCatchWrapper;
 
 namespace SAGA.MBI.WinView.ModeInfoMaintenance
 {
@@ -54,8 +55,12 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
 
         private void WinManufacturer_Loaded(object sender, RoutedEventArgs e)
         {
-            InitData();
-            this.DataContext = this;
+
+            TryCatchWrapper.HandleUI(() =>
+            {
+                InitData();
+                this.DataContext = this;
+            });
         }
         public void InitData()
         {
@@ -109,68 +114,80 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
         }
         private void Update_Mode(object sender, RoutedEventArgs e)
         {
-            Window main = null;
-            if (CurrentVender != null)
-            {
-                var dic = new Dictionary<string, object>();
-                dic.Add("MaintainerId",CurrentVender.Id);
-                main=FirmLibPost.StartWindow(@"WinMaintainerBaseInfo\WinMaintainerInfo\WinMaintainerProjectAsset", dic);
-            }
-            else
+            TryCatchWrapper.HandleUI(() =>
             {
-                main = new WinFirmMain(new WinMaintainerBaseInfo());
-            }
-            main.Title += "--维修商管理";
-            main.ShowDialog();
-            InitData();
+                Window main = null;
+                if (CurrentVender != null)
+                {
+                    var dic = new Dictionary<string, object>();
+                    dic.Add("MaintainerId", CurrentVender.Id);
+                    main = FirmLibPost.StartWindow(@"WinMaintainerBaseInfo\WinMaintainerInfo\WinMaintainerProjectAsset", dic);
+                }
+                else
+                {
+                    main = new WinFirmMain(new WinMaintainerBaseInfo());
+                }
+                main.Title += "--维修商管理";
+                main.ShowDialog();
+                InitData();
+            });
+          
         }
         private void SearchInputEditor_Click(object sender, RoutedEventArgs e)
         {
-            SearchInputEditor editor = sender as SearchInputEditor;
-            if (editor == null) return;
-            var inputText = editor.Text;
-            List<MMaintenanceDealer> newList = null;
-            if (string.IsNullOrEmpty(inputText))
+            TryCatchWrapper.HandleUI(() =>
             {
-                newList = new List<MMaintenanceDealer>(BaseVenders);
+                SearchInputEditor editor = sender as SearchInputEditor;
+                if (editor == null) return;
+                var inputText = editor.Text;
+                List<MMaintenanceDealer> newList = null;
+                if (string.IsNullOrEmpty(inputText))
+                {
+                    newList = new List<MMaintenanceDealer>(BaseVenders);
 
-            }
-            else
-            {
-                var newInput = inputText.ToUpper();
-                newList = BaseVenders.Where(c => c.Name.ToUpper().Contains(newInput) || c.Pinyin.Contains(newInput)).ToList();
-            }
-            Venders = new ObservableCollection<MMaintenanceDealer>(newList);
-            //CurrentVender = Venders.FirstOrDefault();
+                }
+                else
+                {
+                    var newInput = inputText.ToUpper();
+                    newList = BaseVenders.Where(c => c.Name.ToUpper().Contains(newInput) || c.Pinyin.Contains(newInput)).ToList();
+                }
+                Venders = new ObservableCollection<MMaintenanceDealer>(newList);
+                //CurrentVender = Venders.FirstOrDefault();
+            });
+         
         }
         private void BtnSaveChange_OnClick(object sender, RoutedEventArgs e)
         {
-            if (CurrentVender == null)
+            TryCatchWrapper.HandleUI(() =>
             {
-                MessageShow.Infomation("没有选中任何供应商信息");
-                return;
-            }
-            bool isSave = true;
-            if (IsChange)
-            {
-                WinRealityUpdateTime win = new WinRealityUpdateTime();
-                win.Host = "维修商";
-                win.Owner = this;
-                isSave = win.ShowDialog() == true;
-                if (isSave)
+                if (CurrentVender == null)
                 {
-                    if (win.DateTime == null)
+                    MessageShow.Infomation("没有选中任何供应商信息");
+                    return;
+                }
+                bool isSave = true;
+                if (IsChange)
+                {
+                    WinRealityUpdateTime win = new WinRealityUpdateTime();
+                    win.Host = "维修商";
+                    win.Owner = this;
+                    isSave = win.ShowDialog() == true;
+                    if (isSave)
                     {
-                        MessageShow.Infomation("更换时间不能为空");
-                        return;
+                        if (win.DateTime == null)
+                        {
+                            MessageShow.Infomation("更换时间不能为空");
+                            return;
+                        }
+                        ChangeRealTime = win.DateTime?.ToString("yyyyMMddHHmmss");
                     }
-                    ChangeRealTime = win.DateTime?.ToString("yyyyMMddHHmmss");
                 }
-            }
-            if (isSave)
-            {
-                this.DialogResult = true;
-            }
+                if (isSave)
+                {
+                    this.DialogResult = true;
+                }
+            });
+           
         }
 
         private void BtnCancel_OnClick(object sender, RoutedEventArgs e)

+ 5 - 5
MBI/SAGA.MBI/WinView/ModeInfoMaintenance/WinManufacturer.xaml

@@ -22,11 +22,11 @@
             <DataGrid  x:Name="pivotGridControl1" ItemsSource="{Binding Path=Venders}"  SelectedItem="{Binding Path=CurrentVender}"
                        dgx:DataGridFilter.IsAutoFilterEnabled="True" Style="{StaticResource ResourceKey={x:Static wpf:DataGridResource.DataGridStyle}}">
                 <DataGrid.Columns>
-                <DataGridTextColumn Width="*" MinWidth="150" Header="生产厂家"  Binding="{Binding Path=Name}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
-                <DataGridTextColumn Width="120" Header="品牌" Binding="{Binding Path=Brand}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
-                <DataGridTextColumn Width="130" Header="型号" Binding="{Binding Path=ModeNumber}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
-                <DataGridTextColumn Width="100" Header="保养周期(天)" Binding="{Binding Path=MaintainPeriod}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
-                <DataGridTextColumn Width="100" Header="使用寿命(年)" Binding="{Binding Path=ServiceLife}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
+                    <DataGridTextColumn IsReadOnly="True" Width="*" MinWidth="150" Header="生产厂家"  Binding="{Binding Path=Name}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
+                    <DataGridTextColumn IsReadOnly="True" Width="120" Header="品牌" Binding="{Binding Path=Brand}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
+                    <DataGridTextColumn  IsReadOnly="True" Width="130" Header="型号" Binding="{Binding Path=ModeNumber}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
+                    <DataGridTextColumn IsReadOnly="True" Width="100" Header="保养周期(天)" Binding="{Binding Path=MaintainPeriod}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
+                    <DataGridTextColumn IsReadOnly="True" Width="100" Header="使用寿命(年)" Binding="{Binding Path=ServiceLife}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
                 </DataGrid.Columns>
             </DataGrid>
         </Grid>

+ 65 - 46
MBI/SAGA.MBI/WinView/ModeInfoMaintenance/WinManufacturer.xaml.cs

@@ -18,6 +18,7 @@ using SAGA.MBI.Model;
 using SAGA.MBI.RequestData;
 using SAGA.RevitUtils;
 using WPG.Data;
+using TryCatchWrapper = SAGA.MBI.Common.TryCatchWrapper;
 
 namespace SAGA.MBI.WinView.ModeInfoMaintenance
 {
@@ -41,8 +42,11 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
 
         private void WinManufacturer_Loaded(object sender, RoutedEventArgs e)
         {
-            InitData();
-            this.DataContext = this;
+            TryCatchWrapper.HandleUI(() =>
+            {
+                InitData();
+                this.DataContext = this;
+            });
         }
         public void InitData()
         {
@@ -85,22 +89,25 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
         /// <param name="e"></param>
         private void Add_Mode(object sender, RoutedEventArgs e)
         {
-            //MessageBox.Show("添加型号");
-            Window main = null;
-            if (CurrentVender != null)
+            TryCatchWrapper.HandleUI(() =>
             {
-                var dic = new Dictionary<string, object>();
-                dic.Add("ManufactureId", CurrentVender.VenderId);
-                main = FirmLibPost.StartWindow(@"WinManufactureBaseInfo\WinManufactureInfo", dic);
-            }
+                Window main = null;
+                if (CurrentVender != null)
+                {
+                    var dic = new Dictionary<string, object>();
+                    dic.Add("ManufactureId", CurrentVender.VenderId);
+                    main = FirmLibPost.StartWindow(@"WinManufactureBaseInfo\WinManufactureInfo", dic);
+                }
 
-            else
-            {
-                main = new WinFirmMain(new WinManufactureBaseInfo());
-            }
-            main.Title += "--生产商管理";
-            main.ShowDialog();
-            InitData();
+                else
+                {
+                    main = new WinFirmMain(new WinManufactureBaseInfo());
+                }
+                main.Title += "--生产商管理";
+                main.ShowDialog();
+                InitData();
+            });
+          
         }
         /// <summary>
         /// 修改型号
@@ -109,43 +116,52 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
         /// <param name="e"></param>
         private void Update_Type(object sender, RoutedEventArgs e)
         {
-            Window main = null;
-            if (CurrentVender != null)
-            {
-                var dic = new Dictionary<string, object>();
-                dic.Add("ManufactureId", CurrentVender.VenderId);
-                dic.Add("BrandId", CurrentVender.BrandId);
-                dic.Add("ProductId", CurrentVender.ProductId);
-                main = FirmLibPost.StartWindow(@"WinManufactureBaseInfo\WinManufactureInfo\WinProductType", dic);
-            }
 
-            else
+            TryCatchWrapper.HandleUI(() =>
             {
+                Window main = null;
+                if (CurrentVender != null)
+                {
+                    var dic = new Dictionary<string, object>();
+                    dic.Add("ManufactureId", CurrentVender.VenderId);
+                    dic.Add("BrandId", CurrentVender.BrandId);
+                    dic.Add("ProductId", CurrentVender.ProductId);
+                    main = FirmLibPost.StartWindow(@"WinManufactureBaseInfo\WinManufactureInfo\WinProductType", dic);
+                }
 
-                main = new WinFirmMain(new WinManufactureBaseInfo());
-            }
-            main.Title += "--生产商管理";
-            main.ShowDialog();
-            InitData();
+                else
+                {
+
+                    main = new WinFirmMain(new WinManufactureBaseInfo());
+                }
+                main.Title += "--生产商管理";
+                main.ShowDialog();
+                InitData();
+            });
+         
         }
         private void SearchInputEditor_Click(object sender, RoutedEventArgs e)
         {
-            SearchInputEditor editor = sender as SearchInputEditor;
-            if (editor == null) return;
-            var inputText = editor.Text;
-            List<MManufacturer> newList = null;
-            if (string.IsNullOrEmpty(inputText))
+            TryCatchWrapper.HandleUI(() =>
             {
-                newList = new List<MManufacturer>(BaseVenders);
+                SearchInputEditor editor = sender as SearchInputEditor;
+                if (editor == null) return;
+                var inputText = editor.Text;
+                List<MManufacturer> newList = null;
+                if (string.IsNullOrEmpty(inputText))
+                {
+                    newList = new List<MManufacturer>(BaseVenders);
 
-            }
-            else
-            {
-                var newInput = inputText;//.ToUpper();
-                newList = BaseVenders.Where(c => c.Name.Contains(newInput)||c.Brand.Contains(newInput) || c.ModeNumber.Contains(newInput)).ToList();
-            }
-            Venders = new ObservableCollection<MManufacturer>(newList);
-            //CurrentVender = Venders.FirstOrDefault();
+                }
+                else
+                {
+                    var newInput = inputText;//.ToUpper();
+                    newList = BaseVenders.Where(c => c.Name.Contains(newInput) || c.Brand.Contains(newInput) || c.ModeNumber.Contains(newInput)).ToList();
+                }
+                Venders = new ObservableCollection<MManufacturer>(newList);
+
+            });
+           
         }
         private void BtnSaveChange_OnClick(object sender, RoutedEventArgs e)
         {
@@ -251,7 +267,10 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
         }
         public static string GetValueDisplay(ManufacturerUpdateItem updateItem)
         {
-            return $"{updateItem.BrandName}+{updateItem.ProductTypeName}+{updateItem.VenderName}";
+            List<string> displays = new List<string>() { updateItem.BrandName, updateItem.ProductTypeName, updateItem.VenderName };
+            displays = displays.Where(s => !string.IsNullOrWhiteSpace(s)).ToList();
+            return string.Join("+", displays);
+           // return $"{updateItem.BrandName}+{updateItem.ProductTypeName}+{updateItem.VenderName}";
         }
         public static string GetValueDisplay(MRevitEquipBase equipment)
         {

+ 3 - 3
MBI/SAGA.MBI/WinView/ModeInfoMaintenance/WinSupply.xaml

@@ -22,9 +22,9 @@
             <DataGrid  x:Name="pivotGridControl1"  ItemsSource="{Binding Path=Venders}" SelectedItem="{Binding Path=CurrentVender}" 
                        dgx:DataGridFilter.IsAutoFilterEnabled="True" Style="{StaticResource ResourceKey={x:Static wpf:DataGridResource.DataGridStyle}}">
                 <DataGrid.Columns>
-                <DataGridTextColumn Width="*" Header="供应商名称"  Binding="{Binding Path=Name}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
-                <DataGridTextColumn Width="150" Header="联系人" Binding="{Binding Path=Negotiator}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
-                <DataGridTextColumn Width="120" Header="联系电话" Binding="{Binding Path=PhoneNumber}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
+                    <DataGridTextColumn  IsReadOnly="True" Width="*" Header="供应商名称"  Binding="{Binding Path=Name}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
+                    <DataGridTextColumn IsReadOnly="True"  Width="150" Header="联系人" Binding="{Binding Path=Negotiator}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
+                    <DataGridTextColumn IsReadOnly="True" Width="120" Header="联系电话" Binding="{Binding Path=PhoneNumber}"  ElementStyle="{StaticResource ResourceKey={x:Static wpf:DataGridResource.ElementStyle}}"></DataGridTextColumn>
                 </DataGrid.Columns>
             </DataGrid>
         </Grid>

+ 50 - 36
MBI/SAGA.MBI/WinView/ModeInfoMaintenance/WinSupply.xaml.cs

@@ -31,6 +31,7 @@ using SAGA.MBI.RequestData;
 using SAGA.MBI.Tools;
 using SAGA.RevitUtils;
 using WPG.Data;
+using TryCatchWrapper = SAGA.MBI.Common.TryCatchWrapper;
 
 namespace SAGA.MBI.WinView.ModeInfoMaintenance
 {
@@ -54,10 +55,11 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
 
         private void WinManufacturer_Loaded(object sender, RoutedEventArgs e)
         {
-
-            InitData();
-            this.DataContext = this;
-
+            TryCatchWrapper.HandleUI(() =>
+            {
+                InitData();
+                this.DataContext = this;
+            });
         }
         /// <summary>
         /// 重新初始化界面
@@ -98,48 +100,60 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
         }
         private void Add_Mode(object sender, RoutedEventArgs e)
         {
-            WinFirmMain main = new WinFirmMain(new WinSellerBaseInfo());
-            main.Title += "--供应商管理";
-            main.ShowDialog();
-            InitData();
+          
+            TryCatchWrapper.HandleUI(() =>
+            {
+                WinFirmMain main = new WinFirmMain(new WinSellerBaseInfo());
+                main.Title += "--供应商管理";
+                main.ShowDialog();
+                InitData();
+            });
         }
         private void Update_Mode(object sender, RoutedEventArgs e)
         {
-            Window main = null;
-
-            if (CurrentVender != null)
-            {
-                var dic = new Dictionary<string, object>();
-                dic.Add("SellerId", CurrentVender.Id);
-                main = FirmLibPost.StartWindow(@"WinSellerBaseInfo\WinSellerInfo\WinSellerProjectContract", dic);
-            }
-            else
+            TryCatchWrapper.HandleUI(() =>
             {
-                main = new WinFirmMain(new WinSellerBaseInfo());
-            }
-            main.Title += "--供应商管理";
-            main.ShowDialog();
-            InitData();
+                Window main = null;
+
+                if (CurrentVender != null)
+                {
+                    var dic = new Dictionary<string, object>();
+                    dic.Add("SellerId", CurrentVender.Id);
+                    main = FirmLibPost.StartWindow(@"WinSellerBaseInfo\WinSellerInfo\WinSellerProjectContract", dic);
+                }
+                else
+                {
+                    main = new WinFirmMain(new WinSellerBaseInfo());
+                }
+                main.Title += "--供应商管理";
+                main.ShowDialog();
+                InitData();
+            });
+           
         }
         
         private void SearchInputEditor_Click(object sender, RoutedEventArgs e)
         {
-            SearchInputEditor editor = sender as SearchInputEditor;
-            if (editor == null) return;
-            var inputText = editor.Text;
-            List<MSupply> newList = null;
-            if (string.IsNullOrEmpty(inputText))
+            TryCatchWrapper.HandleUI(() =>
             {
-                newList = new List<MSupply>(BaseVenders);
+                SearchInputEditor editor = sender as SearchInputEditor;
+                if (editor == null) return;
+                var inputText = editor.Text;
+                List<MSupply> newList = null;
+                if (string.IsNullOrEmpty(inputText))
+                {
+                    newList = new List<MSupply>(BaseVenders);
 
-            }
-            else
-            {
-                var newInput = inputText.ToUpper();
-                newList = BaseVenders.Where(c => c.Name.ToUpper().Contains(newInput) || c.Pinyin.Contains(newInput)).ToList();
-            }
-            Venders = new ObservableCollection<MSupply>(newList);
-            //CurrentVender = Venders.FirstOrDefault();
+                }
+                else
+                {
+                    var newInput = inputText.ToUpper();
+                    newList = BaseVenders.Where(c => c.Name.ToUpper().Contains(newInput) || c.Pinyin.Contains(newInput)).ToList();
+                }
+                Venders = new ObservableCollection<MSupply>(newList);
+                //CurrentVender = Venders.FirstOrDefault();
+            });
+           
         }
 
         private void BtnSaveChange_OnClick(object sender, RoutedEventArgs e)

+ 7 - 3
MBI/SAGA.MBI/WinView/ModeInfoMaintenance/WinSupplyContractInfo.xaml.cs

@@ -39,9 +39,13 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
         }    
         public WinSupplyContractInfo(MEquipment equipment) : this()
         {
-            m_MEquipment = equipment;
-            this.m_Vm = new VMSupplyContractInfo(m_MEquipment);
-            this.DataContext = this.m_Vm;
+          
+            TryCatchWrapper.HandleUI(() =>
+            {
+                m_MEquipment = equipment;
+                this.m_Vm = new VMSupplyContractInfo(m_MEquipment);
+                this.DataContext = this.m_Vm;
+            });
         }
         public void UpdateWPG(object obj)
         {