Browse Source

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

xulisong 5 years ago
parent
commit
168e2fe2ef

BIN
MBI/SAGA.MBI/Image/loading.gif


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

@@ -260,6 +260,9 @@
     <Reference Include="UIAutomationProvider" />
     <Reference Include="UIAutomationTypes" />
     <Reference Include="WindowsBase" />
+    <Reference Include="XamlAnimatedGif, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\XamlAnimatedGif.1.2.1\lib\net45\XamlAnimatedGif.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="App.xaml.cs" />
@@ -724,9 +727,13 @@
       <DependentUpon>WinTraceView.xaml</DependentUpon>
     </Compile>
     <Compile Include="WinView\Upload\MTopologyGriph.cs" />
+    <Compile Include="WinView\Upload\ProgressOperation.cs" />
     <Compile Include="WinView\Upload\UploadFilesSelectConverter.cs" />
     <Compile Include="WinView\Upload\UploadFloor.cs" />
     <Compile Include="WinView\Upload\VMUploadModeManage.cs" />
+    <Compile Include="WinView\Upload\WinLoading.xaml.cs">
+      <DependentUpon>WinLoading.xaml</DependentUpon>
+    </Compile>
     <Compile Include="WinView\Upload\WinUnlockedFloorList.xaml.cs">
       <DependentUpon>WinUnlockedFloorList.xaml</DependentUpon>
     </Compile>
@@ -974,6 +981,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="WinView\Upload\WinLoading.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="WinView\Upload\WinUnlockedFloorList.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -1097,6 +1108,9 @@
     <Resource Include="Image\delete.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Resource>
+    <Resource Include="Image\loading.gif">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Resource>
     <Content Include="sagacloud.ico" />
     <Resource Include="Image\correlation.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>

+ 50 - 0
MBI/SAGA.MBI/WinView/Upload/ProgressOperation.cs

@@ -0,0 +1,50 @@
+/* ==============================================================================
+ * 功能描述:Tracelog  
+ * 创 建 者:Garrett
+ * 创建日期:2018/7/17 13:57:00
+ * ==============================================================================*/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using FWindSoft.Tools;
+using SAGA.MBI.WinView.Upload;
+
+namespace SAGA.MBI.WinView.TraceView
+{
+    /// <summary>
+    /// Tracelog
+    /// </summary>
+    public class ProgressOperation
+    {
+        private static WinLoading m_TraceView=null;
+
+        public static void Show(string str)
+        {
+            if (m_TraceView == null)
+            {
+                TaskUtil.StartSTATask(()=> {
+                    m_TraceView = new WinLoading();
+                    m_TraceView.OperationStr = str;
+                    m_TraceView.ShowDialog();
+                });
+              
+            }
+        }
+
+        public static void Close()
+        {
+            m_TraceView?.Dispatcher.InvokeShutdown();
+            m_TraceView = null;
+        }
+
+        public static void Update(string txt)
+        {
+            if (m_TraceView != null)
+            {
+                m_TraceView.ProgressStr = txt;
+            }
+        }
+    }
+}

+ 6 - 2
MBI/SAGA.MBI/WinView/Upload/VMUploadModeManage.cs

@@ -22,6 +22,7 @@ using SAGA.MBI.DataArrange;
 using SAGA.MBI.RequestData;
 using SAGA.MBIAssistData.BLL;
 using SAGA.MBI.Interaction;
+using SAGA.MBI.WinView.TraceView;
 using SAGA.RevitUtils;
 using SAGA.RevitUtils.Extends;
 
@@ -123,6 +124,8 @@ namespace SAGA.MBI.WinView.Upload
                         {
                             try
                             {
+                                ProgressOperation.Show("模型文件检查");
+
                                 MFloor floor = ufloor.MFloor;
                                 if (floor == null) continue;
                                 i++;
@@ -139,7 +142,7 @@ namespace SAGA.MBI.WinView.Upload
                                 #region 上传数据
                                 DalUploadFloor.UploadDataOperate(floor);
                                 #endregion
-
+                                ProgressOperation.Close();
                                 #region 上传文件及上传完成后续动作
 
                                 if (FloorFileOperate.UploadFile(floor.ToString(), floor.FullPath, count, i))
@@ -159,12 +162,13 @@ namespace SAGA.MBI.WinView.Upload
                             }
 
                         }
+                        ProgressOperation.Show("数据处理");
                         #region 上传底图文件
                         Log4Net.Debug($"开始楼层底图上传");
                         MBIModelInfoUpload.UpdateMbiInfo(useCalcContexts);
                         Log4Net.Debug($"结束楼层底图上传");
                         #endregion
-
+                        ProgressOperation.Close();
                         #region 上传完成添加提示信息
                         //添加提示窗口
                         UpLoadFileRequest.CloseUploadWindow(failList.Count == 0, false);

+ 29 - 0
MBI/SAGA.MBI/WinView/Upload/WinLoading.xaml

@@ -0,0 +1,29 @@
+<Window x:Class="SAGA.MBI.WinView.Upload.WinLoading"
+             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.WinView.Upload"
+             xmlns:gif="https://github.com/XamlAnimatedGif/XamlAnimatedGif"
+             mc:Ignorable="d" Title="{Binding Path=OperationStr}"
+        WindowStartupLocation="CenterScreen"
+        Height="270" Width="600">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="*"></RowDefinition>
+            <RowDefinition Height="*"></RowDefinition>
+            <RowDefinition Height="*"></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>
+    </Grid>
+</Window>

+ 54 - 0
MBI/SAGA.MBI/WinView/Upload/WinLoading.xaml.cs

@@ -0,0 +1,54 @@
+using System;
+using System.Collections.Generic;
+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;
+
+namespace SAGA.MBI.WinView.Upload
+{
+    /// <summary>
+    /// WinLoading.xaml 的交互逻辑
+    /// </summary>
+    public partial class WinLoading :INotifyPropertyChanged
+    {
+        public WinLoading()
+        {
+            InitializeComponent();
+            this.DataContext = this;
+        }
+
+        public event PropertyChangedEventHandler PropertyChanged;
+        private string m_OperationStr;
+
+        public string OperationStr
+        {
+            get { return m_OperationStr; }
+            set
+            {
+                m_OperationStr = value;
+                PropertyChanged?.Invoke(this,new PropertyChangedEventArgs("OperationStr"));
+            }
+        }
+        private string m_ProgressStr;
+
+        public string ProgressStr
+        {
+            get { return m_ProgressStr; }
+            set
+            {
+                m_ProgressStr = value;
+                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ProgressStr"));
+            }
+        }
+    }
+}

+ 1 - 0
MBI/SAGA.MBI/packages.config

@@ -3,4 +3,5 @@
   <package id="Fody" version="3.1.4" targetFramework="net461" developmentDependency="true" />
   <package id="MrAdvice" version="2.7.2" targetFramework="net461" />
   <package id="PropertyChanged.Fody" version="2.5.9" targetFramework="net461" />
+  <package id="XamlAnimatedGif" version="1.2.1" targetFramework="net461" />
 </packages>