From b5234c5ab1e9e6826b8d8fc1e95fa752aaa40b74 Mon Sep 17 00:00:00 2001
From: chr <chr@mailcom>
Date: 星期六, 02 十一月 2024 10:56:50 +0800
Subject: [PATCH] 优化程序

---
 PdmSwPlugin.DrawApprove/DrawApprove.xaml.cs |   50 +++++++++++++++++++++++++++++++++-----------------
 1 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/PdmSwPlugin.DrawApprove/DrawApprove.xaml.cs b/PdmSwPlugin.DrawApprove/DrawApprove.xaml.cs
index 620746a..32b593d 100644
--- a/PdmSwPlugin.DrawApprove/DrawApprove.xaml.cs
+++ b/PdmSwPlugin.DrawApprove/DrawApprove.xaml.cs
@@ -260,16 +260,24 @@
 
         private void OpenDrw_Click(object sender, RoutedEventArgs e)
         {
-            Button btn = sender as Button;
-            DrawAudit da = btn.DataContext as DrawAudit;
-            string filePath = GetRealFilePath(da.d2RelativePath);
-            if (!File.Exists(filePath))
+            try
             {
-                this.Error($"鏈嶅姟鍣ㄤ腑鏈壘鍒板伐绋嬪浘鏂囦欢锛岃矾寰�:{filePath}");
-                return;
+                Button btn = sender as Button;
+                DrawAudit da = btn.DataContext as DrawAudit;
+                string filePath = GetRealFilePath(da.d2RelativePath);
+                if (!File.Exists(filePath))
+                {
+                    this.Error($"鏈嶅姟鍣ㄤ腑鏈壘鍒板伐绋嬪浘鏂囦欢锛岃矾寰�:{filePath}");
+                    return;
+                }
+                OpenDocMayError(filePath, (int)swDocumentTypes_e.swDocDRAWING, (int)swOpenDocOptions_e.swOpenDocOptions_ReadOnly,
+                    "");
             }
-            OpenDocMayError(filePath, (int)swDocumentTypes_e.swDocDRAWING, (int)swOpenDocOptions_e.swOpenDocOptions_ReadOnly,
-                "");
+            catch (Exception ex)
+            {
+                this.Error($"鎵撳紑宸ョ▼鍥惧紓甯革紒{ex}");
+                Logger.Error("Open Drw Error!", ex);
+            }
         }
 
         private string GetRealFilePath(string relativePath)
@@ -282,17 +290,25 @@
 
         private void OpenDoc_Click(object sender, RoutedEventArgs e)
         {
-            Button btn = sender as Button;
-            DrawAudit da = btn.DataContext as DrawAudit;
-            string filePath = GetRealFilePath(da.d3RelativePath);
-            if (!File.Exists(filePath))
+            try
             {
-                this.Error($"鏈嶅姟鍣ㄤ腑鏈壘鍒板浘绾告枃浠讹紝璺緞:{filePath}");
-                return;
-            }
+                Button btn = sender as Button;
+                DrawAudit da = btn.DataContext as DrawAudit;
+                string filePath = GetRealFilePath(da.d3RelativePath);
+                if (!File.Exists(filePath))
+                {
+                    this.Error($"鏈嶅姟鍣ㄤ腑鏈壘鍒板浘绾告枃浠讹紝璺緞:{filePath}");
+                    return;
+                }
 
-            OpenDocMayError(filePath, (int)FileExtentionChecker.Check(filePath, out _), (int)swOpenDocOptions_e.swOpenDocOptions_ReadOnly,
-                 "");
+                OpenDocMayError(filePath, (int)FileExtentionChecker.Check(filePath, out _), (int)swOpenDocOptions_e.swOpenDocOptions_ReadOnly,
+                     "");
+            }
+            catch (Exception ex)
+            {
+                this.Error($"鎵撳紑鍥剧焊寮傚父锛亄ex}");
+                Logger.Error("Open 3D Doc Error!", ex);
+            }
         }
 
         public List<DrawAudit> RefreshList()

--
Gitblit v1.9.1