Browse Source

其他-补充文案相关文件

ZhouJieSheng 2 years ago
parent
commit
89737a47ef

+ 27 - 0
PDF Office/App.xaml.cs

@@ -58,6 +58,9 @@ using PDF_Office.Views.Scan;
 using PDF_Office.Views.TipContent;
 using System.Windows.Threading;
 using PDF_Office.Views.Dialog.ServiceDialog;
+using System.Diagnostics;
+using System.Resources;
+using System.Reflection;
 
 namespace PDF_Office
 {
@@ -68,6 +71,15 @@ namespace PDF_Office
     {
         public static string CurrentPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "PDF Office");
 
+        /// <summary>
+        /// 产品名称
+        /// </summary>
+        public static string Name = "PDF Office";
+        /// <summary>
+        /// 当前app版本号
+        /// </summary>
+        public static string Version = FileVersionInfo.GetVersionInfo(Process.GetCurrentProcess().MainModule.FileName).ProductVersion;
+
         public static MainWindowViewModel mainWindowViewModel;
 
         /// <summary>
@@ -89,6 +101,21 @@ namespace PDF_Office
         //app第一次启动时需要弹出注册弹窗
         public static bool IsShowRegist = false;
 
+        /// <summary>
+        /// 文案资源管理器  首页
+        /// </summary>
+        public static ResourceManager HomePageLoader = new ResourceManager("PDF Office.String.HomePage.HomePage", Assembly.GetExecutingAssembly());
+
+        /// <summary>
+        /// 文案资源管理器  阅读页
+        /// </summary>
+        public static ResourceManager MainPageLoader = new ResourceManager("PDF Office.String.MainPage.MainPage", Assembly.GetExecutingAssembly());
+
+        /// <summary>
+        /// 文案资源管理器  注册相关
+        /// </summary>
+        public static ResourceManager ServiceLoader = new ResourceManager("PDF Office.String.Service.Service", Assembly.GetExecutingAssembly());
+
         public App()
         {
 #if !DEBUG

+ 77 - 0
PDF Office/Helper/ServiceHelper.cs

@@ -5,6 +5,7 @@ using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
+using System.Management;
 using System.Net;
 using System.Text;
 using System.Threading.Tasks;
@@ -59,6 +60,82 @@ namespace PDF_Office.Helper
         //获取用户信息
         public static string GetUserUrl = "/pdf-office-sso/user/me";
 
+        private static string computerInfo;
+        /// <summary>
+        /// 电脑品牌信息
+        /// </summary>
+        public static string ComputerInfo
+        {
+            get {
+                if (computerInfo == null)
+                {
+                    computerInfo = GetComputerInfo();
+                }
+                return computerInfo; 
+            
+            }
+            set { computerInfo = value; }
+        }
+
+        private static string systemInfo;
+
+        /// <summary>
+        /// 系统信息
+        /// </summary>
+        public static string SystemInfo
+        {
+            get
+            {
+
+                if (systemInfo == null)
+                {
+                    systemInfo = GetSystemInfo();
+                }
+                return systemInfo;
+            }
+
+            set { systemInfo = value; }
+        }
+
+
+        private static string GetSystemInfo()
+        {
+            try
+            {
+                string s = "";
+                SelectQuery sq = new SelectQuery("Win32_OperatingSystem");
+                ManagementObjectSearcher mos = new ManagementObjectSearcher(sq);
+                ManagementObjectCollection moc = mos.Get();
+                foreach (ManagementObject mo in moc)
+                {
+                    s = mo.Properties["Version"].Value.ToString();
+                }
+                moc.Dispose();
+                sq = null;
+                return s;
+            }
+            catch { return ""; }
+        }
+
+        private static string GetComputerInfo()
+        {
+            try
+            {
+                string s = "";
+                System.Windows.Controls.TextBox text = new System.Windows.Controls.TextBox();
+                SelectQuery sq = new SelectQuery("Win32_ComputerSystem");
+                ManagementObjectSearcher mos = new ManagementObjectSearcher(sq);
+                ManagementObjectCollection moc = mos.Get();
+                foreach (ManagementObject mo in moc)
+                {
+                    s = mo.Properties["Manufacturer"].Value + " " + mo.Properties["Model"].Value;
+                }
+                moc.Dispose();
+                sq = null;
+                return s;
+            }
+            catch { return ""; }
+        }
 
 
         public static String GetUser()

+ 12 - 4
PDF Office/PDF Office.csproj

@@ -15,8 +15,7 @@
     <WarningLevel>4</WarningLevel>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
     <Deterministic>true</Deterministic>
-    <NuGetPackageImportStamp>
-    </NuGetPackageImportStamp>
+    <NuGetPackageImportStamp></NuGetPackageImportStamp>
     <IsWebBootstrapper>false</IsWebBootstrapper>
     <PublishUrl>publish\</PublishUrl>
     <Install>true</Install>
@@ -44,8 +43,7 @@
     <WarningLevel>4</WarningLevel>
     <Prefer32Bit>false</Prefer32Bit>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-    <DocumentationFile>
-    </DocumentationFile>
+    <DocumentationFile></DocumentationFile>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -58,6 +56,12 @@
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
+  <PropertyGroup Label="MultilingualAppToolkit">
+    <MultilingualAppToolkitVersion>4.0</MultilingualAppToolkitVersion>
+    <MultilingualFallbackLanguage>en-US</MultilingualFallbackLanguage>
+    <TranslationReport Condition="'$(Configuration)' == 'Release'">true</TranslationReport>
+    <SuppressPseudoWarning Condition="'$(Configuration)' == 'Debug'">true</SuppressPseudoWarning>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="ComDocumentAIKit, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
@@ -2486,4 +2490,8 @@
   </Target>
   <Import Project="packages\SQLitePCLRaw.lib.e_sqlite3.2.0.2\build\net461\SQLitePCLRaw.lib.e_sqlite3.targets" Condition="Exists('packages\SQLitePCLRaw.lib.e_sqlite3.2.0.2\build\net461\SQLitePCLRaw.lib.e_sqlite3.targets')" />
   <Import Project="packages\Magick.NET-Q16-AnyCPU.12.2.2\build\netstandard20\Magick.NET-Q16-AnyCPU.targets" Condition="Exists('packages\Magick.NET-Q16-AnyCPU.12.2.2\build\netstandard20\Magick.NET-Q16-AnyCPU.targets')" />
+  <Import Project="$(MSBuildExtensionsPath)\Microsoft\Multilingual App Toolkit\Microsoft.Multilingual.ResxResources.targets" Label="MultilingualAppToolkit" Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\Multilingual App Toolkit\v$(MultilingualAppToolkitVersion)\Microsoft.Multilingual.ResxResources.targets')" />
+  <Target Name="MATPrerequisite" BeforeTargets="PrepareForBuild" Condition="!Exists('$(MSBuildExtensionsPath)\Microsoft\Multilingual App Toolkit\Microsoft.Multilingual.ResxResources.targets')" Label="MultilingualAppToolkit">
+    <Warning Text="$(MSBuildProjectFile) is Multilingual build enabled, but the Multilingual App Toolkit is unavailable during the build. If building with Visual Studio, please check to ensure that toolkit is properly installed." />
+  </Target>
 </Project>

+ 1 - 0
PDF Office/Properties/AssemblyInfo.cs

@@ -15,6 +15,7 @@ using System.Windows;
 [assembly: AssemblyCopyright("Copyright ©  2022")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en-US")]
 
 // 将 ComVisible 设置为 false 会使此程序集中的类型
 //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型

+ 61 - 0
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -27,6 +27,7 @@ using PDF_Office.Model.Dialog.ConverterDialogs;
 using static PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs.DeleteSafetySettintgsModel;
 using PDF_Office.Views.PropertyPanel.AnnotPanel;
 using System.Linq;
+using System.Text;
 
 namespace PDF_Office.ViewModels
 {
@@ -529,6 +530,10 @@ namespace PDF_Office.ViewModels
 
         public DelegateCommand OpenFileCommand { get; set; }
 
+        public DelegateCommand<string> HelpCommand { get; set; }
+
+
+        public DelegateCommand CreateBlankFileCommand { get; set; }
         #endregion 命令
 
         public ViewContentViewModel(IRegionManager regionManager, IDialogService dialogService, IEventAggregator eventAggregator)
@@ -555,6 +560,8 @@ namespace PDF_Office.ViewModels
             ConvertCommand = new DelegateCommand<string>(convert);
             CloseWindowCommand = new DelegateCommand(closeWindow);
             OpenFileCommand = new DelegateCommand(openfile);
+            HelpCommand = new DelegateCommand<string>(help);
+            CreateBlankFileCommand = new DelegateCommand(createBlankFile);
 
             ViwerRegionName = RegionNames.ViwerRegionName;
             SplitViewerRegionName = RegionNames.Viewer_SplitRegionName;
@@ -599,6 +606,60 @@ namespace PDF_Office.ViewModels
             EnterSelectedBar("TabItemAnnotation");
         }
 
+        /// <summary>
+        ///创建空白文档
+        /// </summary>
+        private async void createBlankFile()
+        {
+            App.mainWindowViewModel.AddTab.Execute();
+            await Task.Delay(30);
+            (App.mainWindowViewModel.SelectedItem.DataContext as MainContentViewModel).CreateFile();
+        }
+
+        private void help(string args)
+        {
+            string url = "";
+            switch (args)
+            {
+                case "Guid":
+                    //TODO 打开内嵌文档
+                    break;
+                case "Online":
+                    url = @"https://www.pdfreaderpro.com/windows/help";
+                    break;
+                case "More":
+                    url = @"https://www.pdfreaderpro.com/product?utm_source=MacApp&utm_campaign=ProductLink&utm_medium=PdfProduct";
+                    break;
+                case "Template":
+                    url = @"https://www.pdfreaderpro.com/templates?utm_source=MacApp&utm_campaign=TemplatesLink&utm_medium=PdfTemplates";
+                    break;
+                case "Blog":
+                    //TODO:显示订阅电子报弹窗
+                    break;
+                case "ComPDF":
+                    url = @"https://www.compdf.com/?utm_source=macapp&utm_medium=pdfmac&utm_campaign=compdfkit-promp";
+                    break;
+                case "FeedBack":
+                    //调用邮箱 发送邮件
+                    StringBuilder sr = new StringBuilder();
+                    sr.AppendFormat("{0} - {1};{2};{3} - {4}", App.Name, App.Version, "Propose a New Feature", ServiceHelper.ComputerInfo, ServiceHelper.SystemInfo);
+
+                    System.Diagnostics.Process.Start(string.Format("mailto:support@pdfreaderpro.com?subject={0}", sr));
+                    break;
+                default:
+                    break;
+            }
+
+            if(!string.IsNullOrEmpty(url))
+            {
+                //需要跳转网页的情况
+                System.Diagnostics.Process.Start(url);
+            }
+        }
+
+        /// <summary>
+        /// 打开文件,跟首页的打开文件有区别,需要新开一个页签
+        /// </summary>
         private void openfile()
         {
             OpenFileDialog openFileDialog = new OpenFileDialog();

+ 30 - 9
PDF Office/Views/ViewContent.xaml

@@ -76,7 +76,7 @@
                             </MenuItem>
                             <Separator Margin="8,0" Style="{StaticResource HorizontalSeparatorStyle}" />
                             <MenuItem Header="Create Files">
-                                <MenuItem Command="{Binding mainViewModel.homeContentViewModel.CreateBlackPDFCommand}" Header="Create Blank" />
+                                <MenuItem Command="{Binding CreateBlankFileCommand}" Header="Create Blank" />
                                 <MenuItem Command="{Binding mainViewModel.homeContentViewModel.CreateFromScanner}" Header="Create Form Scanner" />
                             </MenuItem>
                             <MenuItem
@@ -156,14 +156,35 @@
                                 Header="Settings"
                                 InputGestureText="Ctrl+P" />
                             <MenuItem Header="Help">
-                                <MenuItem Header="快速教学" />
-                                <MenuItem Header="在线帮助" />
-                                <MenuItem Header="更多产品" />
-                                <MenuItem Header="免费PDF模板" />
-                                <MenuItem Header="订阅电子报" />
-                                <MenuItem Header="Powered by ComPDFKit" />
-                                <Separator Style="{StaticResource HorizontalSeparatorStyle}"/>
-                                <MenuItem Header="意见反馈" />
+                                <MenuItem
+                                    Command="{Binding HelpCommand}"
+                                    CommandParameter="Guid"
+                                    Header="快速教学" />
+                                <MenuItem
+                                    Command="{Binding HelpCommand}"
+                                    CommandParameter="Online"
+                                    Header="在线帮助" />
+                                <MenuItem
+                                    Command="{Binding HelpCommand}"
+                                    CommandParameter="More"
+                                    Header="更多产品" />
+                                <MenuItem
+                                    Command="{Binding HelpCommand}"
+                                    CommandParameter="Template"
+                                    Header="免费PDF模板" />
+                                <MenuItem
+                                    Command="{Binding HelpCommand}"
+                                    CommandParameter="Blog"
+                                    Header="订阅电子报" />
+                                <MenuItem
+                                    Command="{Binding HelpCommand}"
+                                    CommandParameter="ComPDF"
+                                    Header="Powered by ComPDFKit" />
+                                <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
+                                <MenuItem
+                                    Command="{Binding HelpCommand}"
+                                    CommandParameter="FeedBack"
+                                    Header="意见反馈" />
                             </MenuItem>
                         </ContextMenu>
                     </Button.ContextMenu>