lvle 1 год назад
Родитель
Сommit
eb98b22ab5

+ 7 - 2
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/CreateFromScannerDialogsViewModel.cs

@@ -84,7 +84,7 @@ namespace PDF_Master.ViewModels.Dialog.HomePageToolsDialogs
      
 
         //没有检测到扫描仪
-        private int _SeIndex=0;
+        private int _SeIndex=-1;
         public int SeIndex
         {
             get { return _SeIndex; }
@@ -107,7 +107,12 @@ namespace PDF_Master.ViewModels.Dialog.HomePageToolsDialogs
 
         public void ToScan()
         {
-            imageFile = Scan();
+           
+            if (SeIndex>-1)
+            {
+                imageFile = Scan();
+            }
+          
 
         }
 

+ 51 - 30
PDF Office/Views/Dialog/HomePageToolsDialogs/CreateFromScannerDialogs.xaml

@@ -1,48 +1,69 @@
-<UserControl x:Class="PDF_Master.Views.Dialog.HomePageToolsDialogs.CreateFromScannerDialogs"
-             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:prism="http://prismlibrary.com/"
-             prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
-             prism:ViewModelLocator.AutoWireViewModel="True"
-             mc:Ignorable="d" 
-             Height="560" Width="352">
-    <Grid Background="White">
+<UserControl
+    x:Class="PDF_Master.Views.Dialog.HomePageToolsDialogs.CreateFromScannerDialogs"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:prism="http://prismlibrary.com/"
+    Width="352"
+    Height="560"
+    prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
+    prism:ViewModelLocator.AutoWireViewModel="True"
+    Background="White"
+    mc:Ignorable="d">
+    <Grid Margin="16,0,16,0" Background="White">
+
         <Grid.RowDefinitions>
-            <RowDefinition Height="48"/>
-            <RowDefinition/>
-            <RowDefinition Height="64"/>
+            <RowDefinition Height="48" />
+            <RowDefinition />
+            <RowDefinition Height="64" />
         </Grid.RowDefinitions>
-        <TextBlock Text="从扫描仪创建pdf" VerticalAlignment="Center" HorizontalAlignment="Left"/>
+        <TextBlock
+            Height="24"
+            HorizontalAlignment="Left"
+            VerticalAlignment="Center"
+            FontFamily="Segoe UI"
+            FontSize="16"
+            FontStyle="Normal"
+            FontWeight="SemiBold"
+            Text="Create PDF from scanner" />
         <Grid Grid.Row="1" Background="#F3F3F3">
             <StackPanel>
-                <TextBlock Text="扫描仪"/>
-                <ListBox Name="Listboxscan" Height="Auto"  SelectedIndex="{Binding SeIndex,Mode=TwoWay}">
-                
-                </ListBox>
+                <TextBlock
+                    Margin="8,0,0,0"
+                    FontFamily="Segoe UI"
+                    FontSize="14"
+                    LineHeight="22"
+                    Text="Scanners" />
+                <ListBox
+                    Name="Listboxscan"
+                    Height="Auto"
+                    Margin="10,0,0,0"
+                    SelectedIndex="{Binding SeIndex, Mode=TwoWay}" />
             </StackPanel>
         </Grid>
         <Grid Grid.Row="2">
             <WrapPanel HorizontalAlignment="Right" VerticalAlignment="Center">
-                <Button x:Name="But_Scan"                 
+                <Button
+                    x:Name="But_Scan"
                     Width="60"
-                    Height="32"                 
+                    Height="32"
                     HorizontalAlignment="Center"
                     VerticalAlignment="Top"
-                        Command="{Binding ToScanCommand}"
-                    Background="#273C62"                 
-                    Style="{StaticResource Btn.cta}" IsDefault="True" />
-                <Button/>
-                <Button                 
+                    Command="{Binding ToScanCommand}"
+                    Content="Scan"
+                    IsDefault="True"
+                    Style="{StaticResource Btn.cta}" />
+              
+                <Button
                     Width="60"
-                    Height="32"   
+                    Height="32"
                     Margin="8,0,0,0"
                     HorizontalAlignment="Center"
                     VerticalAlignment="Top"
-                    Background="#273C62"                 
-                    Style="{StaticResource Btn.cta}" IsCancel="True" />
-                <Button/>
+                    IsCancel="True"
+                    Style="{StaticResource btn.sec}" Content="Cancel" />
+               
             </WrapPanel>
         </Grid>
     </Grid>

+ 14 - 3
PDF Office/Views/Dialog/HomePageToolsDialogs/CreateFromScannerDialogs.xaml.cs

@@ -30,11 +30,22 @@ namespace PDF_Master.Views.Dialog.HomePageToolsDialogs
         {
             InitializeComponent();
             ListScanners();
-          
-          
+
+            Loaded += Focus_Loaded;
+        }
+
+        public static ImageFile imageFile;
+
+        private void Focus_Loaded(object sender, RoutedEventArgs e)
+        {
+            //if (Listboxscan.Items.Count > 0)
+            //{
+            // Focus;
+            //}
+
+
         }
 
-        public static ImageFile imageFile ;
         private void ListScanners()
         {