Parcourir la source

img位置调整

tags/录制修改前
zhangxueyang il y a 4 ans
Parent
révision
f3df2c3cf3

+ 53
- 61
XHWK.WKTool/FileDirectoryWindow.xaml Voir le fichier

@@ -33,28 +33,29 @@
33 33
             <UniformGrid
34 34
                 Height="36"
35 35
                 Margin="0,0,0,0"
36
-                
36
+                Background="{Binding Colour}"
37 37
                 Columns="6"
38 38
                 Rows="1">
39 39
                 <!--题号-->
40
-                <TextBlock
40
+                <TextBlock 
41 41
                     HorizontalAlignment="Center"
42 42
                     VerticalAlignment="Center"
43 43
                     FontSize="15"
44 44
                     Text="{Binding SerialNumber}" />
45 45
                 <Grid>
46
-                    <StackPanel Orientation="Horizontal">
47
-                        <TextBlock
46
+                    <StackPanel Orientation="Horizontal"   HorizontalAlignment="Center"
47
+                    VerticalAlignment="Center">
48
+                        <TextBox IsEnabled="{Binding IsEnabled}"
48 49
                     HorizontalAlignment="Center"
49 50
                     VerticalAlignment="Center"
50 51
                     FontSize="15"
51 52
                     Text="{Binding VideoName}" />
52
-                        <Button Background="Transparent"
53
+                        <Button x:Name="btnModify" Background="Transparent"
53 54
                                 Cursor="Hand"
54
-                        BorderThickness="0">
55
+                        BorderThickness="0" Click="BtnModify_Click">
55 56
                             <Grid>
56
-                                <Image Source="./Images/fileDirectory1.png"/>
57
-                                <Image Source="./Images/fileDirectory2.png" Visibility="Collapsed"/>
57
+                                <Image Source="./Images/fileDirectory3.png" Margin="6,6,6,6" Visibility="{Binding vis}"/>
58
+                                <Image Source="./Images/fileDirectory4.png" Margin="6,6,6,6" Visibility="{Binding cos}"/>
58 59
                             </Grid>
59 60
                         </Button>
60 61
                     </StackPanel>
@@ -82,30 +83,31 @@
82 83
                     Text="{Binding VideoTime}" />
83 84
 
84 85
                 <Grid>
85
-                    <StackPanel Orientation="Horizontal">
86
-                        <Button Cursor="Hand" Content="播放" FontSize="15"
87
-                        Background="Transparent"
88
-                            Foreground="#2D8CF0"
89
-                        BorderThickness="0"
90
-                     >
86
+                    <StackPanel Orientation="Horizontal"   HorizontalAlignment="Center"
87
+                    VerticalAlignment="Center">
88
+                        <Button x:Name="btnPlay" Background="Transparent" 
89
+                                Cursor="Hand"
90
+                        BorderThickness="0" Click="BtnPlay_Click">
91
+                            <Grid>
92
+                                <Image Source="./Images/fileDirectory1.png" Margin="6,6,6,6" Visibility="{Binding vis}"/>
93
+                                <Image Source="./Images/fileDirectory2.png" Margin="6,6,6,6" Visibility="{Binding cos}"/>
94
+                            </Grid>
91 95
                         </Button>
92
-
93
-
94
-
95
-                        <Button Cursor="Hand" Content="上传" FontSize="15"
96
-                        Background="Transparent"
97
-                            Foreground="#2D8CF0"
98
-                        BorderThickness="0"
99
-                     >
96
+                        <Button x:Name="btnUpload" Background="Transparent"
97
+                                Cursor="Hand"
98
+                        BorderThickness="0" Click="BtnUpload_Click">
99
+                            <Grid>
100
+                                <Image Source="./Images/fileDirectory7.png" Margin="6,6,6,6" Visibility="{Binding vis}"/>
101
+                                <Image Source="./Images/fileDirectory8.png" Margin="6,6,6,6" Visibility="{Binding cos}"/>
102
+                            </Grid>
100 103
                         </Button>
101
-
102
-
103
-
104
-                        <Button Cursor="Hand" Content="删除" FontSize="15"
105
-                        Background="Transparent"
106
-                            Foreground="#2D8CF0"
107
-                        BorderThickness="0"
108
-                     >
104
+                        <Button x:Name="btnDelete" Background="Transparent"
105
+                                Cursor="Hand"
106
+                        BorderThickness="0" Click="BtnDelete_Click">
107
+                            <Grid>
108
+                                <Image Source="./Images/fileDirectory5.png" Margin="6,6,6,6" Visibility="{Binding vis}"/>
109
+                                <Image Source="./Images/fileDirectory6.png" Margin="6,6,6,6" Visibility="{Binding cos}"/>
110
+                            </Grid>
109 111
                         </Button>
110 112
                     </StackPanel>
111 113
                 </Grid>
@@ -181,38 +183,28 @@
181 183
                     ItemsSource="{Binding menuList}" />
182 184
             </Grid>
183 185
             <!--第三行 删除 上传 按钮-->
184
-            <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center">
185
-                <Button  Cursor="Hand" x:Name="btnDelete" Content="删除" FontSize="18" Foreground="#FFFFFF" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Width="115" Height="45" Margin="0,0,30,0">
186
-                    <Button.Template>
187
-                        <ControlTemplate TargetType="{x:Type Button}">
188
-                            <Border
189
-                                BorderBrush="{TemplateBinding Control.BorderBrush}"
190
-                                BorderThickness="1"
191
-                                CornerRadius="2">
192
-                                <Border.Background>#F0582B</Border.Background>
193
-                                <ContentPresenter
194
-                                    HorizontalAlignment="Center"
195
-                                    VerticalAlignment="Center"
196
-                                    Content="{TemplateBinding ContentControl.Content}" />
197
-                            </Border>
198
-                        </ControlTemplate>
199
-                    </Button.Template>
186
+            <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center" Height="32">
187
+                <TextBlock Text="共" FontSize="20" Padding="0,5,0,0"/>
188
+                <TextBlock x:Name="txbSum" Text="0" FontSize="20" Padding="0,5,0,0"/>
189
+                <TextBlock Text="条" FontSize="20" Padding="0,5,0,0"/>
190
+                <Button Background="Transparent"
191
+                                Cursor="Hand"
192
+                        BorderThickness="0">
193
+                    <Image Source="./Images/class_p1.png"/>
200 194
                 </Button>
201
-                <Button  Cursor="Hand" x:Name="btnUpload" Content="上传" FontSize="18" Foreground="#FFFFFF" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Width="115" Height="45" Margin="30,0,0,0">
202
-                    <Button.Template>
203
-                        <ControlTemplate TargetType="{x:Type Button}">
204
-                            <Border
205
-                                BorderBrush="{TemplateBinding Control.BorderBrush}"
206
-                                BorderThickness="1"
207
-                                CornerRadius="2">
208
-                                <Border.Background>#2D8CF0</Border.Background>
209
-                                <ContentPresenter
210
-                                    HorizontalAlignment="Center"
211
-                                    VerticalAlignment="Center"
212
-                                    Content="{TemplateBinding ContentControl.Content}" />
213
-                            </Border>
214
-                        </ControlTemplate>
215
-                    </Button.Template>
195
+                <Button Background="Transparent"
196
+                                Cursor="Hand"
197
+                        BorderThickness="0" Content="1" FontSize="20" Width="30"/>
198
+                <Button Background="Transparent"
199
+                                Cursor="Hand"
200
+                        BorderThickness="0" Content="2" FontSize="20" Width="30"/>
201
+                <Button Background="Transparent"
202
+                                Cursor="Hand"
203
+                        BorderThickness="0" Content="3" FontSize="20" Width="30"/>
204
+                <Button Background="Transparent"
205
+                                Cursor="Hand"
206
+                        BorderThickness="0">
207
+                    <Image Source="./Images/class_p2.png"/>
216 208
                 </Button>
217 209
             </StackPanel>
218 210
             

+ 197
- 5
XHWK.WKTool/FileDirectoryWindow.xaml.cs Voir le fichier

@@ -1,8 +1,13 @@
1
-using Org.BouncyCastle.Asn1.Crmf;
1
+using Common.system;
2
+using Org.BouncyCastle.Asn1.Crmf;
3
+using System;
2 4
 using System.Collections.Generic;
3 5
 using System.Collections.ObjectModel;
6
+using System.Diagnostics;
4 7
 using System.Windows;
8
+using System.Windows.Controls;
5 9
 using System.Windows.Input;
10
+using System.Windows.Media;
6 11
 using XHWK.Model;
7 12
 
8 13
 namespace XHWK.WKTool
@@ -33,6 +38,7 @@ namespace XHWK.WKTool
33 38
             //加载视频列表
34 39
             LoadingVideoList();
35 40
             int i = 1;
41
+            bool isColour = true;
36 42
             //显示视频
37 43
             foreach (Model_Video videoinfo in model_VideoList)
38 44
             {
@@ -49,17 +55,41 @@ namespace XHWK.WKTool
49 55
                 //文件存储路径
50 56
                 //videoinfo.VidePath;
51 57
 
58
+                string colour = "#FFFFFF";
59
+                if (isColour==true)
60
+                {
61
+                    colour = "#FFFFFF";
62
+                    isColour = false;
63
+                }
64
+                else
65
+                {
66
+                    colour = "#E6F1FF";
67
+                    isColour = true;
68
+                }
69
+                string vis = "Visible";
70
+                string cos = "Collapsed";
71
+                if(!videoinfo.IsUpload)
72
+                {
73
+                    vis= "Collapsed";
74
+                    cos= "Visible";
75
+                }
76
+
52 77
                 pageData.menuList.Add(new FileDirectoryModel()
53 78
                 {
54 79
                     SerialNumber = i,
55
-                    VideoName = Common.system.FileToolsCommon.GetIOFileName( videoinfo.VidePath),
80
+                    VideoName = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VidePath),
56 81
                     VideoDuration = 0,
57 82
                     VideoSize = videoinfo.VideoSize,
58 83
                     VideoTime = videoinfo.RSTime,
59
-
60
-                });
84
+                    IsEnabled = false,
85
+                    Path = videoinfo.VidePath,
86
+                    Colour = colour,
87
+                    Visi = vis,
88
+                    Coll=cos,
89
+                }) ; ; 
61 90
                 i++;
62 91
             }
92
+            txbSum.Text = pageData.menuList.Count.ToString();
63 93
             DataContext = pageData;
64 94
         }
65 95
         /// <summary>
@@ -96,7 +126,129 @@ namespace XHWK.WKTool
96 126
         {
97 127
             DragMove();
98 128
         }
99
-     
129
+        /// <summary>
130
+        /// 上传
131
+        /// </summary>
132
+        /// <param name="sender"></param>
133
+        /// <param name="e"></param>
134
+        private void BtnUpload_Click(object sender, RoutedEventArgs e) 
135
+        {
136
+            List<Button> buttons = FindChilds<Button>(listView1, "btnUpload");
137
+            for (int i = 0; i < buttons.Count; i++)
138
+            {
139
+                if (buttons[i] == sender)
140
+                {
141
+                 
142
+                }
143
+            }
144
+        }
145
+        /// <summary>
146
+        /// 删除
147
+        /// </summary>
148
+        /// <param name="sender"></param>
149
+        /// <param name="e"></param>
150
+        private void BtnDelete_Click(object sender, RoutedEventArgs e)
151
+        {
152
+            List<Button> buttons = FindChilds<Button>(listView1, "btnDelete");
153
+            for (int i = 0; i < buttons.Count; i++)
154
+            {
155
+                if (buttons[i] == sender)
156
+                {
157
+
158
+                }
159
+            }
160
+        }
161
+        /// <summary>
162
+        /// 播放
163
+        /// </summary>
164
+        /// <param name="sender"></param>
165
+        /// <param name="e"></param>
166
+        private void BtnPlay_Click(object sender, RoutedEventArgs e)
167
+        {
168
+            List<Button> buttons = FindChilds<Button>(listView1, "btnPlay");
169
+            for (int i = 0; i < buttons.Count; i++)
170
+            {
171
+                if (buttons[i] == sender)
172
+                {
173
+                    try
174
+                    {
175
+                        ProcessStartInfo psi = new ProcessStartInfo(pageData.menuList[i].Path);
176
+                        Process pro = new Process
177
+                        {
178
+                            StartInfo = psi
179
+                        };
180
+                        pro.Start();
181
+                    }
182
+                    catch (Exception ex)
183
+                    {
184
+                        LogHelper.WriteErrLog("FileDirectoryWindow【BtnPlay_Click】" + ex.Message, ex);
185
+                        MessageBox.Show(ex.Message);
186
+                        return;
187
+                    }
188
+                }
189
+            }
190
+        }
191
+
192
+
193
+
194
+        public static List<T> FindChilds<T>(DependencyObject parent, string childName)
195
+  where T : DependencyObject
196
+        {
197
+            List<T> list = new List<T>();
198
+            if (parent == null)
199
+            {
200
+                return list;
201
+            }
202
+
203
+            int childrenCount = VisualTreeHelper.GetChildrenCount(parent);
204
+            for (int i = 0; i < childrenCount; i++)
205
+            {
206
+                DependencyObject child = VisualTreeHelper.GetChild(parent, i);
207
+                // 如果子控件不是需查找的控件类型
208
+                T childType = child as T;
209
+                if (childType == null)
210
+                {
211
+                    // 在下一级控件中递归查找
212
+                    List<T> findChildList = FindChilds<T>(child, childName);
213
+                    for (int j = 0; j < findChildList.Count; j++)
214
+                    {
215
+                    }
216
+                    list.AddRange(FindChilds<T>(child, childName));
217
+                }
218
+                else if (!string.IsNullOrEmpty(childName))
219
+                {
220
+                    FrameworkElement frameworkElement = child as FrameworkElement;
221
+                    // 如果控件名称符合参数条件
222
+                    if (frameworkElement != null && frameworkElement.Name == childName)
223
+                    {
224
+                        list.Add((T)child);
225
+                    }
226
+                }
227
+                else
228
+                {
229
+                    // 查找到了控件
230
+                    list.Add((T)child);
231
+                }
232
+            }
233
+
234
+            return list;
235
+        }
236
+        /// <summary>
237
+        /// 修改
238
+        /// </summary>
239
+        /// <param name="sender"></param>
240
+        /// <param name="e"></param>
241
+        private void BtnModify_Click(object sender, RoutedEventArgs e)
242
+        {
243
+            List<Button> buttons = FindChilds<Button>(listView1, "btnModify");
244
+            for (int i = 0; i < buttons.Count; i++)
245
+            {
246
+                if (buttons[i] == sender)
247
+                {
248
+                    pageData.menuList[i].IsEnabled = true;
249
+                }
250
+            }
251
+        }
100 252
     }
101 253
     public class FileDirectoryData : NotifyModel
102 254
     {
@@ -188,5 +340,45 @@ namespace XHWK.WKTool
188 340
                 OnPropertyChanged("Colour");
189 341
             }
190 342
         }
343
+        private bool _isEnabled;
344
+        /// <summary>
345
+        /// 是否可编辑
346
+        /// </summary>
347
+        public bool IsEnabled
348
+        {
349
+            get => _isEnabled;
350
+            set
351
+            {
352
+                _isEnabled = value;
353
+                OnPropertyChanged("IsEnabled");
354
+            }
355
+        }
356
+        public string Path { get; set; }
357
+        private string _visi;
358
+        /// <summary>
359
+        /// 显示
360
+        /// </summary>
361
+        public string Visi
362
+        {
363
+            get => _visi;
364
+            set
365
+            {
366
+                _visi = value;
367
+                OnPropertyChanged("Visi");
368
+            }
369
+        }
370
+        private string _coll;
371
+        /// <summary>
372
+        /// 显示
373
+        /// </summary>
374
+        public string Coll
375
+        {
376
+            get => _coll;
377
+            set
378
+            {
379
+                _coll = value;
380
+                OnPropertyChanged("Coll");
381
+            }
382
+        }
191 383
     }
192 384
 }

+ 5
- 1
XHWK.WKTool/PrintWindow.xaml.cs Voir le fichier

@@ -70,6 +70,10 @@ namespace XHWK.WKTool
70 70
                 System.Windows.Forms.MessageBox.Show("打印机不能为空!", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, System.Windows.Forms.MessageBoxOptions.DefaultDesktopOnly);
71 71
                 return;
72 72
             }
73
+            string imgPath = FileToolsCommon.GetFileAbsolutePath("temp");
74
+            FileToolsCommon.CreateFile(imgPath);
75
+            string pdf = imgPath + "\\101.pdf";
76
+            string tpf = imgPath + "\\102.TPF";
73 77
             int pr = 1;
74 78
             string msg = string.Empty;
75 79
             string outPut = string.Empty;
@@ -78,7 +82,7 @@ namespace XHWK.WKTool
78 82
             {
79 83
                 pyte = 1;
80 84
             }
81
-            LatticeFileHelper.GeneratingPDF(@"G:\101.pdf", @"G:\102.TPF", out pr, out msg, out outPut, pyte);
85
+            LatticeFileHelper.GeneratingPDF(pdf, tpf, out pr, out msg, out outPut, pyte);
82 86
             if (pr == 0)
83 87
             {
84 88
                 outPut = outPut.Replace("[", "").Replace("]", "").Replace("\"", "").Trim();

+ 24
- 10
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs Voir le fichier

@@ -178,8 +178,10 @@ namespace XHWK.WKTool
178 178
                         if (I > 10010)
179 179
                         {
180 180
                             long time = Timestamp();
181
+                        string imgPath= FileToolsCommon.GetFileAbsolutePath("temp/imgplayer");
182
+                            FileToolsCommon.CreateFile(imgPath);
181 183
                             //string FilePathName = ImgPath + RsImgName.Count + ".png";
182
-                            string path = CameraHelper.CaptureImage(@"G:\103", time.ToString());
184
+                            string path = CameraHelper.CaptureImage(imgPath, time.ToString());
183 185
                             if (!string.IsNullOrWhiteSpace(path))
184 186
                             {
185 187
                                 RbnOpen.Add(path);
@@ -292,12 +294,21 @@ namespace XHWK.WKTool
292 294
         /// <param name="e"></param>
293 295
         private void BtnUpload_Click(object sender, RoutedEventArgs e)
294 296
         {
295
-            //if (APP.IsLoginType == false)
296
-            //{
297
-            //    Login();
298
-            //    return;
299
-            //}
300
-            APP.fileDirectoryWindow = new FileDirectoryWindow();
297
+            if (APP.IsLoginType == false)
298
+            {
299
+                Login();
300
+                return;
301
+            }
302
+            if(APP.fileDirectoryWindow==null)
303
+            {
304
+                APP.fileDirectoryWindow = new FileDirectoryWindow();
305
+                APP.fileDirectoryWindow.Topmost = true;
306
+                APP.fileDirectoryWindow.Owner = this;
307
+            }
308
+            else
309
+            {
310
+                Initialize();
311
+            }
301 312
             APP.fileDirectoryWindow.Show();
302 313
 
303 314
             #region 测试上传
@@ -1345,7 +1356,8 @@ namespace XHWK.WKTool
1345 1356
             }
1346 1357
             if (APP.pageData.pagenum < 200)
1347 1358
             {
1348
-                if (APP.PageDrawList != null && APP.PageDrawList.Count > 0 && APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null)
1359
+                if (APP.PageDrawList != null && APP.PageDrawList.Count > 0 && APP.PageDrawList.Count > APP.pageData.currpage - 1
1360
+                    && APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null)
1349 1361
                 {
1350 1362
                     APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = true;
1351 1363
                 }
@@ -1392,8 +1404,10 @@ namespace XHWK.WKTool
1392 1404
                 ////设置纸张横向
1393 1405
                 //document.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
1394 1406
 
1395
-
1396
-                iTextSharp.text.pdf.PdfWriter.GetInstance(document, new FileStream(@"G:\101.pdf", FileMode.Create, FileAccess.ReadWrite));
1407
+                string imgPath = FileToolsCommon.GetFileAbsolutePath("temp");
1408
+                FileToolsCommon.CreateFile(imgPath);
1409
+                imgPath += "\\101.pdf";
1410
+                iTextSharp.text.pdf.PdfWriter.GetInstance(document, new FileStream(imgPath, FileMode.Create, FileAccess.ReadWrite));
1397 1411
                 document.Open();
1398 1412
                 iTextSharp.text.Image image;
1399 1413
                 for (int i = 0; i < APP.PageDrawList.Count; i++)

Chargement…
Annuler
Enregistrer