Pārlūkot izejas kodu

compdfkit(windows) - change license name

liuaoran 1 gadu atpakaļ
vecāks
revīzija
6b47a8bd1b

+ 1 - 1
Demo/Examples/Annotations/Annotations.csproj

@@ -119,7 +119,7 @@
   </ItemGroup>
   <ItemGroup>
     <Resource Include="ComPDFKit_Logo.ico" />
-    <Content Include="..\SDKLicense.xml">
+    <Content Include="..\license_key_win.xml">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
   </ItemGroup>

+ 1 - 1
Demo/Examples/Annotations/App.xaml.cs

@@ -19,7 +19,7 @@ namespace annotation_ctrl_demo
         public SDKLicenseHelper()
         {
 
-            string sdkLicensePath = "SDKLicense.xml";
+            string sdkLicensePath = "license_key_win.xml";
             Assembly assembly = Assembly.GetExecutingAssembly();
             XmlDocument xmlDocument = new XmlDocument();
             xmlDocument.Load(sdkLicensePath);

+ 1 - 1
Demo/Examples/ContentEditor/App.xaml.cs

@@ -18,7 +18,7 @@ namespace ContentEditor
         public string secret = string.Empty;
         public SDKLicenseHelper()
         {
-            string sdkLicensePath = "SDKLicense.xml";
+            string sdkLicensePath = "license_key_win.xml";
             Assembly assembly = Assembly.GetExecutingAssembly();
             XmlDocument xmlDocument = new XmlDocument();
             xmlDocument.Load(sdkLicensePath);

+ 1 - 1
Demo/Examples/ContentEditor/ContentEditor.csproj

@@ -121,7 +121,7 @@
   </ItemGroup>
   <ItemGroup>
     <Resource Include="ComPDFKit_Logo.ico" />
-    <Content Include="..\SDKLicense.xml">
+    <Content Include="..\license_key_win.xml">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
   </ItemGroup>

+ 1 - 1
Demo/Examples/DocsEditor/App.xaml.cs

@@ -18,7 +18,7 @@ namespace DocsEditor
         public SDKLicenseHelper()
         {
 
-            string sdkLicensePath = "SDKLicense.xml";
+            string sdkLicensePath = "license_key_win.xml";
             Assembly assembly = Assembly.GetExecutingAssembly();
             XmlDocument xmlDocument = new XmlDocument();
             xmlDocument.Load(sdkLicensePath);

+ 2 - 2
Demo/Examples/DocsEditor/DocsEditor.csproj

@@ -115,9 +115,9 @@
     <None Include="App.config" />
   </ItemGroup>
   <ItemGroup>
-    <None Include="..\SDKLicense.xml">
+    <Content Include="..\license_key_win.xml">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
+    </Content>
     <Resource Include="ComPDFKit_Logo.ico" />
   </ItemGroup>
   <ItemGroup>

Demo/Examples/SDKLicense.xml → Demo/Examples/DocsEditor/license_key_win.xml


+ 1 - 1
Demo/Examples/Examlpes.sln

@@ -5,7 +5,7 @@ VisualStudioVersion = 17.5.33516.290
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SDKLicense", "SDKLicense", "{43ED4BF9-5941-4F32-A9DC-016E94A0E74E}"
 	ProjectSection(SolutionItems) = preProject
-		SDKLicense.xml = SDKLicense.xml
+		license_key_win.xml = license_key_win.xml
 	EndProjectSection
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Viewer", "Viewer\Viewer.csproj", "{A25DD47F-1FDF-48A1-8D0E-8CFF2C066A74}"

+ 1 - 1
Demo/Examples/Forms/App.xaml.cs

@@ -18,7 +18,7 @@ namespace Forms
         public SDKLicenseHelper()
         {
 
-            string sdkLicensePath = "SDKLicense.xml";
+            string sdkLicensePath = "license_key_win.xml";
             Assembly assembly = Assembly.GetExecutingAssembly();
             XmlDocument xmlDocument = new XmlDocument();
             xmlDocument.Load(sdkLicensePath);

+ 1 - 1
Demo/Examples/Forms/Forms.csproj

@@ -120,7 +120,7 @@
   </ItemGroup>
   <ItemGroup>
     <Resource Include="ComPDFKit_Logo.ico" />
-    <None Include="..\SDKLicense.xml">
+    <None Include="..\license_key_win.xml">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
   </ItemGroup>

+ 1 - 1
Demo/Examples/PDFViewer/App.xaml.cs

@@ -17,7 +17,7 @@ namespace PDFViewer
         public string secret = string.Empty;
         public SDKLicenseHelper()
         { 
-            string sdkLicensePath = "SDKLicense.xml";
+            string sdkLicensePath = "license_key_win.xml";
             Assembly assembly = Assembly.GetExecutingAssembly();
             XmlDocument xmlDocument = new XmlDocument();
             xmlDocument.Load(sdkLicensePath);

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 476 - 464
Demo/Examples/PDFViewer/MainPage.xaml.cs


+ 1 - 1
Demo/Examples/PDFViewer/MainWindow.xaml

@@ -117,7 +117,7 @@
                                     </Thumb>
                                     <TextBlock  x:Name="ChangeIcon"  Grid.Column="1" Width="5" Margin="3,4,2,0" HorizontalAlignment="Left" VerticalAlignment="Top" IsHitTestVisible="False"  Text="*" Visibility="{Binding FileChanged}" />
 
-                                    <Button  Grid.Column="2"  Width="16" Height="16"  Margin="0,4,8,4" Background="Transparent"  BorderThickness="0" Template="{StaticResource CloseFileButton}"  Click="Button_Click"></Button>
+                                    <Button x:Name="CloseFileButton" Grid.Column="2"  Width="16" Height="16"  Margin="0,4,8,4" Background="Transparent"  BorderThickness="0" Template="{StaticResource CloseFileButton}"  Click="CloseFileButton_Click"></Button>
                                 </Grid>
                             </Border>
                         </Grid>

+ 89 - 85
Demo/Examples/PDFViewer/MainWindow.xaml.cs

@@ -32,26 +32,20 @@ using Path = System.IO.Path;
 
 namespace PDFViewer
 {
-    /// <summary>
-    /// MainWindow.xaml 的交互逻辑
-    /// </summary>
     public partial class MainWindow : Window
     {
+        #region Property
         private PDFViewControl passwordViewer;
         private PDFViewControl pdfViewControl = new PDFViewControl();
         private string[] oldAndNewFilePath;
+        #endregion
+
         public MainWindow()
         {
             InitializeComponent();
             Loaded += MainWindow_Loaded;
         }
 
-
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
         private void MainWindow_Loaded(object sender, RoutedEventArgs e)
         {
             PasswordUI.Closed -= PasswordUI_Closed;
@@ -68,21 +62,14 @@ namespace PDFViewer
             }
         }
 
+        #region Load document
+
         private void LoadDefaultDocument()
         {
             string defaultFilePath = "PDF32000_2008.pdf";
             TabControlLoadDocument(defaultFilePath);
         }
 
-        private void DefaultAddButton_Click(object sender, RoutedEventArgs e)
-        {
-            string filePath = CommonHelper.GetFilePathOrEmpty();
-            if (filePath != string.Empty)
-            {
-                TabControlLoadDocument(filePath);
-            }
-        }
-
         private void TabControlLoadDocument(string filePath)
         {
             if (App.OpenedFilePathList.Contains(filePath))
@@ -111,7 +98,7 @@ namespace PDFViewer
             MainPage viewPage = new MainPage();
 
             viewPage.CheckExistBeforeOpenFileEvent -= ViewPage_CheckExistBeforeOpenFileEvent;
-            viewPage.FileChangeEvent -= ViewPage_FileChangeEvent; 
+            viewPage.FileChangeEvent -= ViewPage_FileChangeEvent;
             viewPage.CheckExistBeforeOpenFileEvent += ViewPage_CheckExistBeforeOpenFileEvent;
             viewPage.FileChangeEvent += ViewPage_FileChangeEvent;
 
@@ -203,54 +190,65 @@ namespace PDFViewer
             return false;
         }
 
-        public class TabItemExt : TabItem, INotifyPropertyChanged
+        #endregion
+
+        #region password
+
+        private void PasswordUI_Closed(object sender, EventArgs e)
         {
-            public event PropertyChangedEventHandler PropertyChanged;
-            private string _fileName;
-            public string FileName
-            {
-                get
-                {
-                    return _fileName;
-                }
-                set
-                {
-                    if (_fileName != value)
-                    {
-                        _fileName = value;
-                        OnPropertyChanged();
-                    }
-                }
-            }
+            PopupBorder.Visibility = Visibility.Collapsed;
+            PasswordUI.Visibility = Visibility.Collapsed;
+        }
 
-            private Visibility _fileChanged = Visibility.Hidden;
-            public Visibility FileChanged
+        private void PasswordUI_Canceled(object sender, EventArgs e)
+        {
+            PopupBorder.Visibility = Visibility.Collapsed;
+            PasswordUI.Visibility = Visibility.Collapsed;
+        }
+
+        private void PasswordUI_Confirmed(object sender, string e)
+        {
+            if (passwordViewer != null && passwordViewer.PDFView != null && passwordViewer.PDFView.Document != null)
             {
-                get
+                passwordViewer.PDFView.Document.UnlockWithPassword(e);
+                if (passwordViewer.PDFView.Document.IsLocked == false)
                 {
-                    return _fileChanged;
+                    PasswordUI.SetShowError("", Visibility.Collapsed);
+                    PasswordUI.ClearPassword();
+                    PasswordUI.Visibility = Visibility.Collapsed;
+                    PopupBorder.Visibility = Visibility.Collapsed;
+                    pdfViewControl = passwordViewer;
+
+                    string filePath = passwordViewer.PDFView.Document.FilePath;
+                    TabItemExt tabItem = new TabItemExt();
+                    MainPage viewPage = new MainPage();
+
+                    tabItem.Content = viewPage;
+                    tabItem.IsSelected = true;
+                    tabItem.FileName = Path.GetFileName(filePath);
+                    tabItem.Tag = filePath;
+
+                    viewPage.SetPDFViewer(pdfViewControl);
+                    App.OpenedFilePathList.Add(filePath);
+
+                    TabControl.Items.Add(tabItem);
                 }
-                set
+                else
                 {
-                    if (_fileChanged != value)
-                    {
-                        _fileChanged = value;
-                        OnPropertyChanged();
-                    }
+                    PasswordUI.SetShowError("error", Visibility.Visible);
                 }
             }
-            public void OnPropertyChanged([CallerMemberName] string name = null)
-            {
-                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
-            }
         }
 
+        #endregion
+
+        #region UI
         private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         {
             DragMove();
         }
 
-        private void Button_Click(object sender, RoutedEventArgs e)
+        private void CloseFileButton_Click(object sender, RoutedEventArgs e)
         {
             var button = sender as Button;
             var dragablzItem = FindParentDragablzItem(button);
@@ -375,50 +373,56 @@ namespace PDFViewer
             }
         }
 
-        private void PasswordUI_Closed(object sender, EventArgs e)
-        {
-            PopupBorder.Visibility = Visibility.Collapsed;
-            PasswordUI.Visibility = Visibility.Collapsed;
-        }
-
-        private void PasswordUI_Canceled(object sender, EventArgs e)
+        private void DefaultAddButton_Click(object sender, RoutedEventArgs e)
         {
-            PopupBorder.Visibility = Visibility.Collapsed;
-            PasswordUI.Visibility = Visibility.Collapsed;
+            string filePath = CommonHelper.GetFilePathOrEmpty();
+            if (filePath != string.Empty)
+            {
+                TabControlLoadDocument(filePath);
+            }
         }
+        #endregion
 
-        private void PasswordUI_Confirmed(object sender, string e)
+        public class TabItemExt : TabItem, INotifyPropertyChanged
         {
-            if (passwordViewer != null && passwordViewer.PDFView != null && passwordViewer.PDFView.Document != null)
+            public event PropertyChangedEventHandler PropertyChanged;
+            private string _fileName;
+            public string FileName
             {
-                passwordViewer.PDFView.Document.UnlockWithPassword(e);
-                if (passwordViewer.PDFView.Document.IsLocked == false)
+                get
                 {
-                    PasswordUI.SetShowError("", Visibility.Collapsed);
-                    PasswordUI.ClearPassword();
-                    PasswordUI.Visibility = Visibility.Collapsed;
-                    PopupBorder.Visibility = Visibility.Collapsed;
-                    pdfViewControl = passwordViewer;
-
-                    string filePath = passwordViewer.PDFView.Document.FilePath;
-                    TabItemExt tabItem = new TabItemExt();
-                    MainPage viewPage = new MainPage();
-
-                    tabItem.Content = viewPage;
-                    tabItem.IsSelected = true;
-                    tabItem.FileName = Path.GetFileName(filePath);
-                    tabItem.Tag = filePath;
-
-                    viewPage.SetPDFViewer(pdfViewControl);
-                    App.OpenedFilePathList.Add(filePath);
+                    return _fileName;
+                }
+                set
+                {
+                    if (_fileName != value)
+                    {
+                        _fileName = value;
+                        OnPropertyChanged();
+                    }
+                }
+            }
 
-                    TabControl.Items.Add(tabItem);
+            private Visibility _fileChanged = Visibility.Hidden;
+            public Visibility FileChanged
+            {
+                get
+                {
+                    return _fileChanged;
                 }
-                else
+                set
                 {
-                    PasswordUI.SetShowError("error", Visibility.Visible);
+                    if (_fileChanged != value)
+                    {
+                        _fileChanged = value;
+                        OnPropertyChanged();
+                    }
                 }
             }
+            public void OnPropertyChanged([CallerMemberName] string name = null)
+            {
+                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
+            }
         }
     }
 }

+ 1 - 2
Demo/Examples/PDFViewer/PDFViewer.csproj

@@ -118,8 +118,7 @@
     <None Include="App.config" />
   </ItemGroup>
   <ItemGroup>
-    <None Include="..\SDKLicense.xml">
-      <Link>SDKLicense.xml</Link>
+    <None Include="..\license_key_win.xml">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
     <Resource Include="ComPDFKit_Logo.ico" />

+ 1 - 1
Demo/Examples/Viewer/App.xaml.cs

@@ -13,7 +13,7 @@ namespace Viewer
         public string secret = string.Empty;
         public SDKLicenseHelper() {
 
-            string sdkLicensePath = "SDKLicense.xml";
+            string sdkLicensePath = "license_key_win.xml";
             Assembly assembly = Assembly.GetExecutingAssembly();
             XmlDocument xmlDocument = new XmlDocument();
             xmlDocument.Load(sdkLicensePath);

+ 29 - 21
Demo/Examples/Viewer/MainWindow.xaml.cs

@@ -27,6 +27,7 @@ namespace Viewer
     /// </summary>
     public partial class MainWindow : Window, INotifyPropertyChanged
     {
+        #region Property
         private PDFViewControl passwordViewer;
         private PDFViewControl pdfViewControl;
         private int[] zoomLevelList = { 10, 25, 50, 100, 150, 200, 300, 400, 500, 1000 };
@@ -44,6 +45,7 @@ namespace Viewer
                 return false;
             }
         }
+        #endregion
 
         public MainWindow()
         {
@@ -99,8 +101,6 @@ namespace Viewer
         }
         #endregion
 
-
-
         #region Password
         private void PasswordUI_Confirmed(object sender, string e)
         {
@@ -136,23 +136,6 @@ namespace Viewer
         }
         #endregion
 
-        private void PdfViewer_InfoChanged(object sender, KeyValuePair<string, object> e)
-        {
-            if (e.Key == "Zoom")
-            {
-                CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)((double)e.Value * 100)));
-            }
-        }
-
-        /// <summary>
-        /// Undo Redo Event Noitfy
-        /// </summary>
-        private void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
-        {
-            OnPropertyChanged(e.PropertyName);
-        }
-
-
         #region Expand or Hide Panel 
 
         private void ExpandLeftPanel(bool isExpand)
@@ -188,7 +171,8 @@ namespace Viewer
         }
 
         #endregion
-         
+
+        #region UI
         private double CheckZoomLevel(double zoom, bool IsGrowth)
         {
             double standardZoom = 100;
@@ -278,6 +262,7 @@ namespace Viewer
         {
             PopupBorder.Visibility = Visibility.Collapsed;
         }
+        #endregion
 
         #region Open and save file
 
@@ -365,7 +350,6 @@ namespace Viewer
 
         #endregion
 
-
         #region Context Menu
 
         private void ExtraImage_Click(object sender, RoutedEventArgs e)
@@ -604,9 +588,33 @@ namespace Viewer
 
         #endregion
 
+        #region PropertyChanged
+
+        /// <summary>
+        /// Zoom
+        /// </summary> 
+        private void PdfViewer_InfoChanged(object sender, KeyValuePair<string, object> e)
+        {
+            if (e.Key == "Zoom")
+            {
+                CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)((double)e.Value * 100)));
+            }
+        }
+
+        /// <summary>
+        /// Undo Redo Event Noitfy
+        /// </summary>
+        private void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
+        {
+            OnPropertyChanged(e.PropertyName);
+        }
+
         protected void OnPropertyChanged([CallerMemberName] string name = null)
         {
             PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
         }
+
+        #endregion
+
     }
 }

+ 3 - 4
Demo/Examples/Viewer/Viewer.csproj

@@ -99,10 +99,6 @@
       <DependentUpon>Settings.settings</DependentUpon>
       <DesignTimeSharedInput>True</DesignTimeSharedInput>
     </Compile>
-    <None Include="..\SDKLicense.xml">
-      <Link>SDKLicense.xml</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -123,6 +119,9 @@
     <None Include="App.config" />
   </ItemGroup>
   <ItemGroup>
+    <None Include="..\license_key_win.xml">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
     <Resource Include="ComPDFKit_Logo.ico" />
   </ItemGroup>
   <ItemGroup>

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 4 - 0
Demo/Examples/license_key_win.xml