Browse Source

Merge branch 'master' of https://git.dev.tencent.com/xuhuo1234/saga

xulisong 5 years ago
parent
commit
2c4463e65d

+ 6 - 0
MBI/SAGA.MBI/DataArrange/DalUploadFloor.cs

@@ -25,6 +25,7 @@ using System.IO;
 using System.Linq;
 using System.Reflection;
 using SAGA.MBI.FileStream;
+using SAGA.MBI.WinView.TraceView;
 using SAGA.RevitUtils.MEP;
 
 namespace SAGA.MBI.DataArrange
@@ -664,10 +665,15 @@ namespace SAGA.MBI.DataArrange
         /// <param name="floor"></param>
         public static void UploadDataOperate(MFloor floor)
         {
+            LoadingOperation.Update();
             CalcContext serviceContext = DalCommon.DownLoadCouldData(floor);
+            LoadingOperation.Update();
             CalcContext localContext = ObjectCalc.Calc(floor);
+            LoadingOperation.Update();
             WrapperContext(serviceContext, localContext);
+            LoadingOperation.Update();
             serviceContext.Upload();
+            LoadingOperation.Update();
             localContext.Upload();
         }
 

+ 4 - 1
MBI/SAGA.MBI/Interaction/MBIModelInfoUpload.cs

@@ -13,6 +13,7 @@ using SAGA.MBI.DataArrange;
 using SAGA.MBI.JsonConvert;
 using SAGA.MBI.RequestData;
 using SAGA.MBI.RevitExport;
+using SAGA.MBI.WinView.TraceView;
 using SAGA.Models;
 
 namespace SAGA.MBI.Interaction
@@ -83,7 +84,9 @@ namespace SAGA.MBI.Interaction
             {
                 if(context==null)continue;
                 try
-                {                 
+                {
+                    //loading完成的进度
+                    LoadingOperation.Update();
                     context.OpenDocument();
                     Document doc = context.RevitDoc;
                     MbiElementManager.ExecuteExport(doc);

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

@@ -727,7 +727,7 @@
       <DependentUpon>WinTraceView.xaml</DependentUpon>
     </Compile>
     <Compile Include="WinView\Upload\MTopologyGriph.cs" />
-    <Compile Include="WinView\Upload\ProgressOperation.cs" />
+    <Compile Include="WinView\Upload\LoadingOperation.cs" />
     <Compile Include="WinView\Upload\UploadFilesSelectConverter.cs" />
     <Compile Include="WinView\Upload\UploadFloor.cs" />
     <Compile Include="WinView\Upload\VMUploadModeManage.cs" />

+ 14 - 4
MBI/SAGA.MBI/WinView/Upload/ProgressOperation.cs

@@ -1,5 +1,5 @@
 /* ==============================================================================
- * 功能描述:Tracelog  
+ * 功能描述:
  * 创 建 者:Garrett
  * 创建日期:2018/7/17 13:57:00
  * ==============================================================================*/
@@ -16,17 +16,21 @@ namespace SAGA.MBI.WinView.TraceView
     /// <summary>
     /// Tracelog
     /// </summary>
-    public class ProgressOperation
+    public class LoadingOperation
     {
         private static WinLoading m_TraceView=null;
+        private static int Count = 0;
 
-        public static void Show(string str)
+        public static void Show(string str,int count)
         {
             if (m_TraceView == null)
             {
                 TaskUtil.StartSTATask(()=> {
                     m_TraceView = new WinLoading();
                     m_TraceView.OperationStr = str;
+                    Index = 0;
+                    Count = count;
+                    m_TraceView.ProgressStr = $"(1/{count})";
                     m_TraceView.ShowDialog();
                 });
               
@@ -37,10 +41,16 @@ namespace SAGA.MBI.WinView.TraceView
         {
             m_TraceView?.Dispatcher.InvokeShutdown();
             m_TraceView = null;
+            Index = 0;
         }
 
-        public static void Update(string txt)
+        private static int Index = 0;
+        public static void Update()
         {
+            Index++;
+            if (Index >= Count)
+                Index = Count;
+            string txt = $"({Index}/{Count})";
             if (m_TraceView != null)
             {
                 m_TraceView.ProgressStr = txt;

+ 5 - 5
MBI/SAGA.MBI/WinView/Upload/VMUploadModeManage.cs

@@ -124,8 +124,9 @@ namespace SAGA.MBI.WinView.Upload
                         {
                             try
                             {
-                                ProgressOperation.Show("模型文件检查");
+                                LoadingOperation.Show("模型文件检查",6);
 
+                                LoadingOperation.Update();
                                 MFloor floor = ufloor.MFloor;
                                 if (floor == null) continue;
                                 i++;
@@ -138,11 +139,10 @@ namespace SAGA.MBI.WinView.Upload
                                 MBIModelInfoManager.SyncPlatformToRevit(document);
                                 #endregion
 
-
                                 #region 上传数据
                                 DalUploadFloor.UploadDataOperate(floor);
                                 #endregion
-                                ProgressOperation.Close();
+                                LoadingOperation.Close();
                                 #region 上传文件及上传完成后续动作
 
                                 if (FloorFileOperate.UploadFile(floor.ToString(), floor.FullPath, count, i))
@@ -162,13 +162,13 @@ namespace SAGA.MBI.WinView.Upload
                             }
 
                         }
-                        ProgressOperation.Show("数据处理");
+                        LoadingOperation.Show("数据处理", useCalcContexts.Count);
                         #region 上传底图文件
                         Log4Net.Debug($"开始楼层底图上传");
                         MBIModelInfoUpload.UpdateMbiInfo(useCalcContexts);
                         Log4Net.Debug($"结束楼层底图上传");
                         #endregion
-                        ProgressOperation.Close();
+                        LoadingOperation.Close();
                         #region 上传完成添加提示信息
                         //添加提示窗口
                         UpLoadFileRequest.CloseUploadWindow(failList.Count == 0, false);

+ 15 - 12
MBI/SAGA.MBI/WinView/Upload/WinLoading.xaml

@@ -12,18 +12,21 @@
         <Grid.RowDefinitions>
             <RowDefinition Height="*"></RowDefinition>
             <RowDefinition Height="*"></RowDefinition>
-            <RowDefinition Height="*"></RowDefinition>
+
+            <RowDefinition Height="0.5*"></RowDefinition>
         </Grid.RowDefinitions>
-        <Label Grid.Row="0" Content="{Binding Path=OperationStr}" FontSize="18" 
-               HorizontalAlignment="Center"
-               VerticalAlignment="Center"
-               HorizontalContentAlignment="Center"
-               VerticalContentAlignment="Center"></Label>
-        <Image Grid.Row="1" gif:AnimationBehavior.SourceUri="../../Image/loading.gif" />
-        <Label Grid.Row="2" Content="{Binding Path=ProgressStr}" FontSize="16" 
-               HorizontalAlignment="Center"
-               VerticalAlignment="Center"
-               HorizontalContentAlignment="Center"
-               VerticalContentAlignment="Center"></Label>
+        <StackPanel 
+            HorizontalAlignment="Center"
+            VerticalAlignment="Center">
+            <Label  Content="{Binding Path=OperationStr}" FontSize="18" 
+                   HorizontalContentAlignment="Center"
+                   VerticalContentAlignment="Center"></Label>
+            <Label  Content="{Binding Path=ProgressStr}" FontSize="16" 
+                   HorizontalContentAlignment="Center"
+                   VerticalContentAlignment="Center"></Label>
+        </StackPanel>
+      
+        <Image Height="15" Width="214" Grid.Row="1" gif:AnimationBehavior.SourceUri="../../Image/loading.gif" />
+      
     </Grid>
 </Window>