|
@@ -87,6 +87,8 @@ namespace PDF_Master
|
|
|
|
|
|
public static string CurrentPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), Name);
|
|
|
|
|
|
+ public static List<string> NeedOpenFilePathList = new List<string>();
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 项目内嵌文档路径 实际打开文档时,会将改文档复制到Document 文件夹下,避免C盘文件无法写入的情况
|
|
|
/// </summary>
|
|
@@ -199,7 +201,7 @@ namespace PDF_Master
|
|
|
Settings.Default.UserDate = new PDFSettings.UserDate();
|
|
|
}
|
|
|
|
|
|
- if(Settings.Default.AppProperties==null)
|
|
|
+ if (Settings.Default.AppProperties == null)
|
|
|
{
|
|
|
Settings.Default.AppProperties = new PDFSettings.APPSettingProperties();
|
|
|
}
|
|
@@ -235,7 +237,7 @@ namespace PDF_Master
|
|
|
{
|
|
|
foreach (var filePath in e.Args)
|
|
|
{
|
|
|
- if (filePath.ToLower().Contains(".pdf")&&Path.GetExtension(filePath).ToLower()==".pdf")
|
|
|
+ if (filePath.ToLower().Contains(".pdf") && Path.GetExtension(filePath).ToLower() == ".pdf")
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -332,10 +334,10 @@ namespace PDF_Master
|
|
|
|
|
|
//复制项目的新手引导文档到Document 目录
|
|
|
string guidfilePath = Path.Combine(CachePath.GuidPDFPath, "Quick Start Guide.pdf");
|
|
|
- if(!File.Exists(guidfilePath)||App.IsGuidPDFUpdated)
|
|
|
+ if (!File.Exists(guidfilePath) || App.IsGuidPDFUpdated)
|
|
|
{
|
|
|
//Document 路径下没有内嵌文档或者内嵌文档版本更新时
|
|
|
- File.Copy(Path.Combine(Environment.CurrentDirectory, "Resources\\GuidPDF\\Quick Start Guide.pdf"), guidfilePath,true);
|
|
|
+ File.Copy(Path.Combine(Environment.CurrentDirectory, "Resources\\GuidPDF\\Quick Start Guide.pdf"), guidfilePath, true);
|
|
|
GuidPDFPath = guidfilePath;
|
|
|
}
|
|
|
|
|
@@ -350,33 +352,52 @@ namespace PDF_Master
|
|
|
{
|
|
|
}
|
|
|
|
|
|
+ //启动循环检查更新线程
|
|
|
CheckUpdate();
|
|
|
|
|
|
+ //双击文件 打开软件时
|
|
|
+ foreach (var filePath in e.Args)
|
|
|
+ {
|
|
|
+ if (filePath.ToLower().Contains(".pdf"))
|
|
|
+ {
|
|
|
+ if (filePath.Substring(filePath.LastIndexOf(".")).ToLower() == ".pdf")
|
|
|
+ {
|
|
|
+ NeedOpenFilePathList.Add(filePath);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
base.OnStartup(e);
|
|
|
}
|
|
|
|
|
|
private void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
|
|
|
{
|
|
|
+#if DEBUG
|
|
|
var ex = e.Exception as Exception;
|
|
|
if (ex != null)
|
|
|
{
|
|
|
MessageBox.Show("发生Task未处理异常:" + ex.Message + "\n" + ex.StackTrace, "系统错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
|
}
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
|
|
{
|
|
|
+#if DEBUG
|
|
|
if (e.ExceptionObject is System.Exception)
|
|
|
{
|
|
|
Exception ex = (System.Exception)e.ExceptionObject;
|
|
|
MessageBox.Show("发生非UI线程异常:" + ex.Message + "\n" + ex.StackTrace, "系统错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
|
}
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
|
|
{
|
|
|
+#if DEBUG
|
|
|
e.Handled = true;
|
|
|
MessageBox.Show("发生UI线程异常:" + e.Exception.Message + "\n" + e.Exception.StackTrace, "系统错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -640,10 +661,10 @@ namespace PDF_Master
|
|
|
try
|
|
|
{
|
|
|
LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(devKey, devSecret);
|
|
|
- Trace.WriteLine("CPDFSDK License Code."+ verifyResult+"\n");
|
|
|
+ Trace.WriteLine("CPDFSDK License Code." + verifyResult + "\n");
|
|
|
if (verifyResult != LicenseErrorCode.LICENSE_ERR_SUCCESS)
|
|
|
return false;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
catch { Trace.WriteLine("CPDFSDK License Code Error \n"); }
|
|
|
|