Forráskód Böngészése

PageEdit(windows) - 项目搭建

liuaoran 1 éve
szülő
commit
c65305eec4

+ 17 - 0
compdfkit_demo_windows/compdfkit/compdfkit-tools/Common/BarControl/CPDFPageEditBarControl.xaml

@@ -0,0 +1,17 @@
+<UserControl x:Class="compdfkit_tools.Common.BarControl.CPDFPageEditBarControl"
+             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:compdfkit_tools.Common.BarControl"
+             mc:Ignorable="d" 
+             d:DesignHeight="40" d:DesignWidth="1280">
+    <UserControl.Resources>
+        <ResourceDictionary Source="../../Asset/Theme/LightMode.xaml"></ResourceDictionary>
+    </UserControl.Resources>
+    <Grid>
+        <StackPanel Orientation="Horizontal">
+            
+        </StackPanel>
+    </Grid>
+</UserControl>

+ 28 - 0
compdfkit_demo_windows/compdfkit/compdfkit-tools/Common/BarControl/CPDFPageEditBarControl.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+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 compdfkit_tools.Common.BarControl
+{
+    /// <summary>
+    /// CPDFPageEditBarControl.xaml 的交互逻辑
+    /// </summary>
+    public partial class CPDFPageEditBarControl : UserControl
+    {
+        public CPDFPageEditBarControl()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 7 - 0
compdfkit_demo_windows/compdfkit/compdfkit-tools/compdfkit-tools.csproj

@@ -100,6 +100,9 @@
     <Compile Include="Annotation\PDFAnnotationPanel\PDFAnnotationUI\CPDFDeleteDialog.xaml.cs">
       <DependentUpon>CPDFDeleteDialog.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Common\BarControl\CPDFPageEditBarControl.xaml.cs">
+      <DependentUpon>CPDFPageEditBarControl.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Common\BaseControl\PageNumberControl.xaml.cs">
       <DependentUpon>PageNumberControl.xaml</DependentUpon>
     </Compile>
@@ -402,6 +405,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Common\BarControl\CPDFPageEditBarControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Common\BaseControl\PageNumberControl.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>

+ 52 - 1
compdfkit_demo_windows/compdfkit/pageedit-ctrl-demo/App.xaml.cs

@@ -1,17 +1,68 @@
-using System;
+using ComPDFKit.NativeMethod;
+using System;
 using System.Collections.Generic;
 using System.Configuration;
 using System.Data;
 using System.Linq;
+using System.Reflection;
 using System.Threading.Tasks;
 using System.Windows;
+using System.Xml;
 
 namespace pageedit_ctrl_demo
 {
+    public class SDKLicenseHelper
+    {
+        public string key = string.Empty;
+        public string secret = string.Empty;
+        public SDKLicenseHelper()
+        {
+
+            string sdkLicensePath = "SDKLicense.xml";
+            Assembly assembly = Assembly.GetExecutingAssembly();
+            XmlDocument xmlDocument = new XmlDocument();
+            xmlDocument.Load(sdkLicensePath);
+            var node = xmlDocument.SelectSingleNode("License");
+            if (node != null)
+            {
+                key = node.Attributes["key"].Value;
+                secret = node.Attributes["secret"].Value;
+            }
+        }
+
+    }
     /// <summary>
     /// App.xaml 的交互逻辑
     /// </summary>
     public partial class App : Application
     {
+        protected override void OnStartup(StartupEventArgs e)
+        {
+            string str = this.GetType().Assembly.Location;
+            base.OnStartup(e);
+            LicenseVerify();
+        }
+
+        private static bool LicenseVerify()
+        {
+            bool result = false;
+            try
+            {
+                result = CPDFSDKVerifier.LoadNativeLibrary();
+                if (!result)
+                    return false;
+            }
+            catch
+            { }
+            SDKLicenseHelper sdkLicenseHelper = new SDKLicenseHelper();
+            try
+            {
+                LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(sdkLicenseHelper.key, sdkLicenseHelper.secret);
+                if (verifyResult != LicenseErrorCode.LICENSE_ERR_SUCCESS)
+                    return false;
+            }
+            catch { }
+            return result;
+        }
     }
 }

BIN
compdfkit_demo_windows/compdfkit/pageedit-ctrl-demo/ComPDFKit.Desk.dll


BIN
compdfkit_demo_windows/compdfkit/pageedit-ctrl-demo/ComPDFKit.Viewer.dll


+ 86 - 0
compdfkit_demo_windows/compdfkit/pageedit-ctrl-demo/MainWindow.xaml

@@ -6,6 +6,92 @@
         xmlns:local="clr-namespace:pageedit_ctrl_demo"
         mc:Ignorable="d"
         Title="MainWindow" Height="450" Width="800">
+    <Window.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="pack://application:,,,/compdfkit-assets;component/Styles/ToggleButtonStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="pack://application:,,,/compdfkit-assets;component/Styles/ButtonStyle.xaml"></ResourceDictionary>
+            </ResourceDictionary.MergedDictionaries>
+        </ResourceDictionary>
+    </Window.Resources>
     <Grid>
+        <Grid>
+            <Grid.RowDefinitions>
+                <RowDefinition Height="40"></RowDefinition>
+                <RowDefinition Height="*"></RowDefinition>
+            </Grid.RowDefinitions>
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="auto"></ColumnDefinition>
+                    <ColumnDefinition Width="*"></ColumnDefinition>
+                    <ColumnDefinition Width="auto"></ColumnDefinition>
+                </Grid.ColumnDefinitions>
+                <Grid>
+                    <StackPanel Orientation="Horizontal">
+
+                        <!--打开文件-->
+                        <Button BorderThickness="0" VerticalContentAlignment="Center" Width="30" Height="30" Style="{StaticResource LightButtonStyle}" Background="Transparent" Click="OpenFile_Click">
+                            <Button.Content>
+                                <Viewbox Width="20" Height="20">
+                                    <Path Fill="#43474D" >
+                                        <Path.Data>
+                                            M3.75,2 L3.91967773,2.00463867 C4.08325195,2.01391602 4.22851562,2.03710938 4.35546875,2.07421875 C4.52473958,2.12369792 
+                                    4.67578125,2.18489583 4.80859375,2.2578125 C4.94140625,2.33072917 5.05989583,2.41145833 5.1640625,2.5 C5.26822917,2.58854167 
+                                    5.37369792,2.66927083 5.48046875,2.7421875 C5.58723958,2.81510417 5.70182292,2.87630208 5.82421875,2.92578125 C5.94661458,2.97526042 
+                                    6.08854167,3 6.25,3 L6.25,3 L12,3 L12.1371528,3.00868056 C12.2262731,3.02025463 12.3107639,3.04340278 12.390625,3.078125 
+                                    C12.5104167,3.13020833 12.6158854,3.20182292 12.7070312,3.29296875 C12.7981771,3.38411458 12.8697917,3.48958333 12.921875,3.609375 
+                                    C12.9739583,3.72916667 13,3.859375 13,4 L13,4 L13,6 L15,6 L15.1332465,6.00868056 C15.2206308,6.02025463 15.3051215,6.04340278 
+                                    15.3867188,6.078125 C15.5091146,6.13020833 15.6158854,6.20182292 15.7070312,6.29296875 C15.7981771,6.38411458 15.8697917,6.48958333 
+                                    15.921875,6.609375 C15.9739583,6.72916667 16,6.85677083 16,6.9921875 C16,7.1484375 15.9635417,7.29947917 15.890625,7.4453125 
+                                    L15.890625,7.4453125 L12.6171875,14 L0,14 L0,3 L0.00868055556,2.86284722 C0.0202546296,2.77372685 0.0434027778,2.68923611 0.078125,2.609375 
+                                    C0.130208333,2.48958333 0.201822917,2.38411458 0.29296875,2.29296875 C0.384114583,2.20182292 0.489583333,2.13020833 0.609375,2.078125 
+                                    C0.729166667,2.02604167 0.859375,2 1,2 L1,2 L3.75,2 Z M15,7 L4.3125,7 L1.3125,13 L12,13 L15,7 Z M3.75,3 L1,3 L1,11.3828125 L3.4140625,6.5546875 
+                                    L3.48706055,6.43261719 C3.56665039,6.31738281 3.66601562,6.22265625 3.78515625,6.1484375 C3.94401042,6.04947917 4.11979167,6 4.3125,6 
+                                    L4.3125,6 L12,6 L12,4 L6.25,4 L6.08032227,3.99536133 C5.91674805,3.98608398 5.77148438,3.96289062 5.64453125,3.92578125 C5.47526042,3.87630208 
+                                    5.32421875,3.81510417 5.19140625,3.7421875 C5.05859375,3.66927083 4.94010417,3.58854167 4.8359375,3.5 C4.73177083,3.41145833 4.62630208,3.33072917 
+                                    4.51953125,3.2578125 C4.41276042,3.18489583 4.29817708,3.12369792 4.17578125,3.07421875 C4.05338542,3.02473958 3.91145833,3 3.75,3 L3.75,3 Z
+                                        </Path.Data>
+                                    </Path>
+                                </Viewbox>
+                            </Button.Content>
+                        </Button>
+
+                        <!--保存文件-->
+                        <Button BorderThickness="0" VerticalContentAlignment="Center" Margin="10,0,0,0" Width="30" Height="30" Style="{StaticResource LightButtonStyle}" Background="Transparent" 
+                            Click="SaveFileBtn_Click" IsEnabled="{Binding CanSave,Mode=OneWay}">
+                            <Button.Content>
+                                <Viewbox Width="20" Height="20">
+                                    <Path IsEnabled="{Binding CanSave,Mode=OneWay}">
+                                        <Path.Style>
+                                            <Style TargetType="Path">
+                                                <Style.Triggers>
+                                                    <Trigger Property="IsEnabled" Value="False">
+                                                        <Setter Property="Fill" Value="LightGray"/>
+                                                    </Trigger>
+                                                    <Trigger Property="IsEnabled" Value="True">
+                                                        <Setter Property="Fill" Value="#43474D"/>
+                                                    </Trigger>
+                                                </Style.Triggers>
+                                            </Style>
+                                        </Path.Style>
+                                        <Path.Data>
+                                            M11.707107,1 L15,4.29289322 L15,15 L1,15 L1,1 L11.707107,1 Z M11.293,2 L2,2 L2,14 L4,14 L4,8 L12,8 L12,14 L14,14 L14,4.707 L11.293,2 Z 
+                                        M11,9 L5,9 L5,14 L11,14 L11,9 Z M7,5 L7,6 L4,6 L4,5 L7,5 Z
+                                        </Path.Data>
+                                    </Path>
+                                </Viewbox>
+                            </Button.Content>
+                        </Button>
+
+                        <!--工具栏展开收缩-->
+                        <ToggleButton Name="ToolExpandBtn" Margin="13,0,0,0" BorderThickness="0" Width="30" Height="30" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Click="ToolExpandBtn_Click"/>
+
+                    </StackPanel>
+
+                </Grid>
+
+            </Grid>
+        </Grid>
     </Grid>
+
 </Window>

+ 17 - 0
compdfkit_demo_windows/compdfkit/pageedit-ctrl-demo/MainWindow.xaml.cs

@@ -24,5 +24,22 @@ namespace pageedit_ctrl_demo
         {
             InitializeComponent();
         }
+
+        private void OpenFile_Click(object sender, RoutedEventArgs e)
+        {
+
+        }
+
+        private void SaveFileBtn_Click(object sender, RoutedEventArgs e)
+        {
+
+        }
+
+        private void ToolExpandBtn_Click(object sender, RoutedEventArgs e)
+        {
+
+        }
+
+
     }
 }

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 4 - 0
compdfkit_demo_windows/compdfkit/pageedit-ctrl-demo/SDKLicense.xml


+ 27 - 0
compdfkit_demo_windows/compdfkit/pageedit-ctrl-demo/pageedit-ctrl-demo.csproj

@@ -35,6 +35,14 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="ComPDFKit.Desk, Version=1.8.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>.\ComPDFKit.Desk.dll</HintPath>
+    </Reference>
+    <Reference Include="ComPDFKit.Viewer, Version=1.8.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>.\ComPDFKit.Viewer.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Data" />
     <Reference Include="System.Xml" />
@@ -94,5 +102,24 @@
   <ItemGroup>
     <None Include="App.config" />
   </ItemGroup>
+  <ItemGroup>
+    <Content Include="ComPDFKit.Desk.dll" />
+    <Content Include="ComPDFKit.Viewer.dll" />
+    <None Include="SDKLicense.xml">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <Content Include="x64\ComPDFKit.dll">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="x86\ComPDFKit.dll">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\compdfkit-assets\compdfkit-assets.csproj">
+      <Project>{9b25b167-4896-40e3-a423-7a02cef3005e}</Project>
+      <Name>compdfkit-assets</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

BIN
compdfkit_demo_windows/compdfkit/pageedit-ctrl-demo/x64/ComPDFKit.dll


BIN
compdfkit_demo_windows/compdfkit/pageedit-ctrl-demo/x86/ComPDFKit.dll