Przeglądaj źródła

上传页面 修改到主页面。

tags/录制修改前
zhangxueyang 4 lat temu
rodzic
commit
9313553ce0

+ 212
- 6
XHWK.WKTool/XHMicroLessonSystemWindow.xaml Wyświetl plik

@@ -22,6 +22,114 @@
22 22
             </Border.Effect>
23 23
         </Border>
24 24
     </Grid>-->
25
+    <Window.Resources>
26
+        <!--  ListBox容器样式  -->
27
+        <Style x:Key="ListBoxItemContainerStyle" TargetType="{x:Type ListBoxItem}">
28
+            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
29
+            <Setter Property="HorizontalAlignment" Value="Stretch" />
30
+            <Setter Property="Template">
31
+                <Setter.Value>
32
+                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
33
+                        <Border
34
+                            x:Name="itemBox"
35
+                            Background="Transparent"
36
+                            BorderBrush="Transparent"
37
+                            BorderThickness="0">
38
+                            <ContentPresenter />
39
+                        </Border>
40
+                        <ControlTemplate.Triggers />
41
+                    </ControlTemplate>
42
+                </Setter.Value>
43
+            </Setter>
44
+        </Style>
45
+        <DataTemplate x:Key="TongjiItem">
46
+            <UniformGrid
47
+                Height="50"
48
+                Margin="0,0,0,0"
49
+                Background="{Binding Colour}"
50
+                Columns="5"
51
+                Rows="1">
52
+                <!--题号-->
53
+                <TextBlock 
54
+                    HorizontalAlignment="Center"
55
+                    VerticalAlignment="Center"
56
+                    FontSize="16"
57
+                    Text="{Binding SerialNumber}" />
58
+                <Grid>
59
+                    <StackPanel Orientation="Horizontal"   HorizontalAlignment="Center"
60
+                    VerticalAlignment="Center">
61
+                        <TextBox IsEnabled="{Binding IsEnabled}"
62
+                    HorizontalAlignment="Center"
63
+                    VerticalAlignment="Center"
64
+                    FontSize="16" Height="30" Padding="0,5,0,0"
65
+                    Text="{Binding VideoName,Mode=TwoWay}" Width="150"/>
66
+                        <Button x:Name="btnModify" Background="Transparent"
67
+                                Cursor="Hand"
68
+                        BorderThickness="0" Click="BtnModify_Click">
69
+                            <Grid>
70
+                                <Image Source="./Images/fileDirectory3.png" Margin="6,6,6,6" Height="20" Visibility="{Binding vis}"/>
71
+                                <Image Source="./Images/fileDirectory4.png" Margin="6,6,6,6" Height="20" Visibility="{Binding cos}"/>
72
+                            </Grid>
73
+                        </Button>
74
+                    </StackPanel>
75
+                </Grid>
76
+
77
+
78
+                <!--分值-->
79
+                <!--
80
+                <TextBlock
81
+                    HorizontalAlignment="Center"
82
+                    VerticalAlignment="Center"
83
+                    FontSize="15"
84
+                    Text="{Binding VideoDuration}" />-->
85
+
86
+                <!--平均时长-->
87
+                <TextBlock
88
+                    HorizontalAlignment="Center"
89
+                    VerticalAlignment="Center"
90
+                    FontSize="16"
91
+                    Text="{Binding VideoSize}" />
92
+                <!--最短时长-->
93
+                <TextBlock
94
+                    HorizontalAlignment="Center"
95
+                    VerticalAlignment="Center"
96
+                    FontSize="16"
97
+                    Text="{Binding VideoTime}" />
98
+
99
+                <Grid>
100
+                    <StackPanel Orientation="Horizontal"   HorizontalAlignment="Center"
101
+                    VerticalAlignment="Center">
102
+                        <Button x:Name="btnPlay" Background="Transparent" 
103
+                                Cursor="Hand"
104
+                        BorderThickness="0" Click="BtnPlay_Click">
105
+                            <Grid>
106
+                                <Image Source="./Images/fileDirectory1.png" Margin="10" Height="20" Visibility="{Binding vis}"/>
107
+                                <Image Source="./Images/fileDirectory2.png" Margin="10"  Height="20" Visibility="{Binding cos}"/>
108
+                            </Grid>
109
+                        </Button>
110
+                        <Button x:Name="btnUpload" Background="Transparent"
111
+                                Cursor="Hand"
112
+                        BorderThickness="0" Click="BtnUploads_Click">
113
+                            <Grid>
114
+                                <Image Source="./Images/fileDirectory7.png" Margin="6,6,6,6" Height="20" Visibility="{Binding vis}"/>
115
+                                <Image Source="./Images/fileDirectory8.png" Margin="6,6,6,6" Height="20" Visibility="{Binding cos}"/>
116
+                            </Grid>
117
+                        </Button>
118
+                        <Button x:Name="btnDelete" Background="Transparent"
119
+                                Cursor="Hand"
120
+                        BorderThickness="0" Click="BtnDelete_Click">
121
+                            <Grid>
122
+                                <Image Source="./Images/fileDirectory5.png" Margin="6,6,6,6" Height="20" Visibility="{Binding vis}"/>
123
+                                <Image Source="./Images/fileDirectory6.png" Margin="6,6,6,6" Height="20" Visibility="{Binding cos}"/>
124
+                            </Grid>
125
+                        </Button>
126
+                    </StackPanel>
127
+                </Grid>
128
+
129
+
130
+            </UniformGrid>
131
+        </DataTemplate>
132
+    </Window.Resources>
25 133
     <Window.BorderBrush>
26 134
         <RadialGradientBrush>
27 135
             <GradientStop Offset="0.997" Color="#001B1919"/>
@@ -145,7 +253,7 @@
145 253
                 </StackPanel>
146 254
             </Grid>
147 255
             <!--主内容-->
148
-                <Grid Grid.Row="1" x:Name="GridMain" Width="1276" >
256
+                <Grid Grid.Row="1" x:Name="GridMain" Width="1276" Visibility="Visible">
149 257
                     <ScrollViewer x:Name="scroMain" VerticalScrollBarVisibility="Visible">
150 258
                         <Grid x:Name="gridM"  Margin="0,0,0,0" Background="#FFFFFF" Visibility="Visible" Height="1780">
151 259
                             <Grid>
@@ -271,17 +379,17 @@
271 379
                     <TextBlock x:Name="txbFilePath" Text="文件路径" FontSize="16" Width="80"  Foreground="#2D8CF0" Padding="2,26,10,0"/>
272 380
                     <!--输入框-->
273 381
                     <Border Background="#CDD6E0" Width="525" Height="43" CornerRadius="3">
274
-                        <Label x:Name="txbStoragePath" Content="D:\" FontSize="16" Foreground="#333333" Padding="5,12,2,2" Width="523" Height="42" BorderBrush="{x:Null}" BorderThickness="0"/>
382
+                        <Label x:Name="txbStoragePath" Background="#FFFFFF" Content="D:\" FontSize="16" Foreground="#333333" Padding="5,12,2,2" Width="523" Height="42" BorderBrush="{x:Null}" BorderThickness="0"/>
275 383
                     </Border>
276 384
                     <!--浏览按钮-->
277
-                    <Button Cursor="Hand" x:Name="btnBrowse" Content="打开" FontSize="18" Width="80" Height="43" Margin="18,0,0,0" Click="BtnBrowse_Click">
385
+                    <Button Cursor="Hand" x:Name="btnBrowse" Content="浏览" FontSize="18" Width="80" Height="43" Margin="18,0,0,0" Click="BtnBrowse_Click">
278 386
                         <Button.Template>
279 387
                             <ControlTemplate TargetType="{x:Type Button}">
280 388
                                 <Border
281 389
                                 BorderBrush="{TemplateBinding Control.BorderBrush}"
282 390
                                 BorderThickness="1"
283 391
                                 CornerRadius="2">
284
-                                    <Border.Background>#CDD6E0</Border.Background>
392
+                                        <Border.Background>#EBEFF3</Border.Background>
285 393
                                     <ContentPresenter
286 394
                                     HorizontalAlignment="Center"
287 395
                                     VerticalAlignment="Center"
@@ -318,8 +426,106 @@
318 426
                 </Button>
319 427
             </Grid>
320 428
                 <!--上传-->
321
-                <Grid Grid.Row="1" x:Name="gridUpload">
322
-                    
429
+                <Grid Grid.Row="1" x:Name="gridUpload" Visibility="Collapsed">
430
+                    <Border Width="1276" Background="#EFF1F8">
431
+                        <Grid  Width="1236" Background="#FFFFFF" Margin="0,0,0,0">
432
+                        <!--分4行-->
433
+                        <Grid.RowDefinitions>
434
+                            <RowDefinition Height="*"/>
435
+                                <RowDefinition Height="30"/>
436
+                            </Grid.RowDefinitions>
437
+                        <!--第二行 内容-->
438
+                        <Grid Grid.Row="0" Margin="0,0,0,0">
439
+                            <Grid.RowDefinitions>
440
+                                <RowDefinition Height="45"/>
441
+                                <RowDefinition Height="*"/>
442
+                            </Grid.RowDefinitions>
443
+                            <UniformGrid x:Name="uniStatisticsByTitle"
444
+                Grid.Row="0"
445
+                Margin="0,0,0,0"
446
+                Background="#E6F0FF"
447
+                Columns="5"
448
+                Rows="1">
449
+                                <TextBlock
450
+                    HorizontalAlignment="Center"
451
+                    VerticalAlignment="Center"
452
+                    FontSize="16"
453
+                    Text="序号"  />
454
+                                <TextBlock
455
+                    HorizontalAlignment="Center"
456
+                    VerticalAlignment="Center"
457
+                    FontSize="16"
458
+                    Text="视频名称"/>
459
+                                <!--<TextBlock
460
+                    HorizontalAlignment="Center"
461
+                    VerticalAlignment="Center"
462
+                    FontSize="15"
463
+                    Text="视频时长" Foreground="White" />-->
464
+                                <TextBlock
465
+                    HorizontalAlignment="Center"
466
+                    VerticalAlignment="Center"
467
+                    FontSize="16"
468
+                    Text="视频大小"/>
469
+                                <TextBlock
470
+                    HorizontalAlignment="Center"
471
+                    VerticalAlignment="Center"
472
+                    FontSize="16"
473
+                    Text="日期"/>
474
+                                <TextBlock
475
+                    HorizontalAlignment="Center"
476
+                    VerticalAlignment="Center"
477
+                    FontSize="16"
478
+                    Text="操作"/>
479
+                            </UniformGrid>
480
+                            <ListBox Grid.Row="1" Margin="0,0,0,0"
481
+                    x:Name="listView1"
482
+                    BorderThickness="0"
483
+                    FontSize="20"
484
+                    ItemContainerStyle="{StaticResource ListBoxItemContainerStyle}"
485
+                    ItemTemplate="{StaticResource TongjiItem}"
486
+                    ItemsSource="{Binding menuList}" 
487
+                           ScrollViewer.HorizontalScrollBarVisibility="Disabled"
488
+                                ScrollViewer.VerticalScrollBarVisibility="Disabled"/>
489
+                        </Grid>
490
+                        <StackPanel Grid.Row="3" x:Name="stpUp" Orientation="Horizontal" Background="Transparent" Width="180" HorizontalAlignment="Center"
491
+            Height="30" Margin="0,0,0,0" Grid.Column="1" VerticalAlignment="Bottom">
492
+                            <Button Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
493
+                    x:Name="btnLastPage"
494
+                    Width="60" Height="20"
495
+                    Click="BtnLastPage_Click">
496
+                                <Button.Content>
497
+                                    <StackPanel>
498
+                                        <Image Width="16" Height="12" Source=".\Images\class_p1.png" />
499
+                                    </StackPanel>
500
+                                </Button.Content>
501
+                            </Button>
502
+                            <Grid Width="60"  Background="Transparent">
503
+                                <Grid.RowDefinitions>
504
+                                    <RowDefinition Height="311*"/>
505
+                                    <RowDefinition Height="483*"/>
506
+                                </Grid.RowDefinitions>
507
+                                <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,-12,0,0" Grid.Row="1"  Background="Transparent">
508
+                                    <StackPanel HorizontalAlignment="Center" Orientation="Horizontal"  Background="Transparent">
509
+                                        <TextBlock x:Name="txbCurrpageTwo" TextAlignment="Center" FontSize="15"/>
510
+                                        <TextBlock Text="/" TextAlignment="Center" FontSize="15"/>
511
+                                        <TextBlock x:Name="txbPageNumTwo" TextAlignment="Center" FontSize="15"/>
512
+                                    </StackPanel>
513
+                                </StackPanel>
514
+                            </Grid>
515
+                            <Button Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
516
+                    x:Name="btnNextPage"  Background="Transparent"
517
+                    Width="60" Height="20"
518
+                    Click="BtnNextPage_Click">
519
+                                <Button.Content>
520
+                                    <StackPanel>
521
+                                        <Image Width="16" Height="12" Source=".\Images\class_p2.png" />
522
+                                    </StackPanel>
523
+                                </Button.Content>
524
+                            </Button>
525
+                        </StackPanel>
526
+
527
+                    </Grid>
528
+                    </Border>
323 529
                 </Grid>
324 530
             <Grid Grid.Row="2" Background="#EFF1F8" Margin="0,0,0,0">
325 531
                 <StackPanel Orientation="Horizontal" Margin="0,0,0,0">

+ 517
- 26
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs Wyświetl plik

@@ -24,6 +24,7 @@ using System.Text;
24 24
 using System.Collections.Specialized;
25 25
 using XHWK.WKTool.Config;
26 26
 using System.Windows.Threading;
27
+using System.Diagnostics;
27 28
 
28 29
 namespace XHWK.WKTool
29 30
 {
@@ -79,6 +80,24 @@ namespace XHWK.WKTool
79 80
         /// 计时用
80 81
         /// </summary>
81 82
         private TimeSpan _timeSpan = new TimeSpan(0, 0, 0, 0, 0);
83
+        #region 上传
84
+        /// <summary>
85
+        /// 视频模型
86
+        /// </summary>
87
+        List<Model_Video> model_VideoList = null;
88
+        /// <summary>
89
+        /// 数据列表
90
+        /// </summary>
91
+        internal FileDirectoryData pageData = new FileDirectoryData();
92
+        /// <summary>
93
+        /// 下标
94
+        /// </summary>
95
+        private int Subscript = 0;
96
+        /// <summary>
97
+        /// 是否是修改状态
98
+        /// </summary>
99
+        private bool IsModify = false;
100
+        #endregion
82 101
         #endregion
83 102
 
84 103
         #region 初始化
@@ -440,17 +459,17 @@ namespace XHWK.WKTool
440 459
                 Login();
441 460
                 return;
442 461
             }
443
-            if (APP.fileDirectoryWindow == null)
462
+            if(gridUpload.Visibility == Visibility.Visible)
444 463
             {
445
-                APP.fileDirectoryWindow = new FileDirectoryWindow();
446
-                //APP.fileDirectoryWindow.Topmost = true;
447
-                APP.fileDirectoryWindow.Owner = this;
464
+                gridUpload.Visibility = Visibility.Collapsed;
465
+                GridMain.Visibility = Visibility.Visible;
448 466
             }
449 467
             else
450 468
             {
451
-                APP.fileDirectoryWindow.Initialize();
469
+                gridUpload.Visibility = Visibility.Visible;
470
+                GridMain.Visibility = Visibility.Collapsed;
471
+                InitializeUpload();
452 472
             }
453
-            APP.fileDirectoryWindow.ShowDialog();
454 473
         }
455 474
         /// <summary>
456 475
         /// 关闭事件
@@ -572,6 +591,12 @@ namespace XHWK.WKTool
572 591
             imgPlayerLeft.Visibility = Visibility.Collapsed;
573 592
             imgPlayerRightUnder.Visibility = Visibility.Collapsed;
574 593
             imgPlayerLeftUnder.Visibility = Visibility.Collapsed;
594
+            if(!txbStoragePath.Content.ToString().Equals(APP.WKData.WkPath))
595
+            {
596
+                //存储文件
597
+                FileToolsCommon.SetConfigValue("VideoSavePath", txbStoragePath.Content.ToString());
598
+                System.Windows.MessageBox.Show("路径已变更,下次创建微课时自动生效!!!");
599
+            }
575 600
         }
576 601
         /// <summary>
577 602
         /// 设置事件
@@ -614,23 +639,23 @@ namespace XHWK.WKTool
614 639
         /// <param name="e"></param>
615 640
         private void BtnBrowse_Click(object sender, RoutedEventArgs e)
616 641
         {
617
-            System.Diagnostics.Process.Start(APP.WKData.WkPath);
618
-            //string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
619
-            //Ofd = new System.Windows.Forms.FolderBrowserDialog();
642
+            //System.Diagnostics.Process.Start(APP.WKData.WkPath);
643
+            string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
644
+            Ofd = new System.Windows.Forms.FolderBrowserDialog();
620 645
 
621
-            //Result = Ofd.ShowDialog();
622
-            //if (Result == System.Windows.Forms.DialogResult.OK)
623
-            //{
624
-            //    if (Ofd.SelectedPath != "")
625
-            //    {
646
+            Result = Ofd.ShowDialog();
647
+            if (Result == System.Windows.Forms.DialogResult.OK)
648
+            {
649
+                if (Ofd.SelectedPath != "")
650
+                {
626 651
 
627 652
 
628
-            //        //txbStoragePath.Text = Ofd.SelectedPath;
629
-            //        //string ApplicationData = ZConfig.dataPath + "fileStorageAddress.txt";
630
-            //        //string temp = ofd.SelectedPath;
631
-            //        //System.IO.File.WriteAllText(ApplicationData, temp, Encoding.Default);
632
-            //    }
633
-            //}
653
+                    txbStoragePath.Content = Ofd.SelectedPath;
654
+                    //string ApplicationData = ZConfig.dataPath + "fileStorageAddress.txt";
655
+                    //string temp = ofd.SelectedPath;
656
+                    //System.IO.File.WriteAllText(ApplicationData, temp, Encoding.Default);
657
+                }
658
+            }
634 659
         }
635 660
         /// <summary>
636 661
         /// 画笔颜色事件 白色
@@ -2630,15 +2655,481 @@ namespace XHWK.WKTool
2630 2655
             imgCanvas.Source = null;
2631 2656
         }
2632 2657
 
2633
-        private void Button_Click(object sender, RoutedEventArgs e)
2658
+        #region 上传
2659
+        /// <summary>
2660
+        /// 初始化上传
2661
+        /// </summary>
2662
+        public void InitializeUpload()
2634 2663
         {
2635
-            //System.Windows.SplashScreen(LoadDialog);
2636
-            //Common.system.SplashScreen.Show(typeof(LoadDialog));
2637
-            //Thread.Sleep(5000);
2638
-            //Common.system.SplashScreen.Close();
2639 2664
             APP.myloading.Show();
2640
-            Thread.Sleep(1000);
2665
+            MouseNumber = 0;
2666
+            IsModify = false;
2667
+            //加载视频列表
2668
+            LoadingVideoList();
2669
+            int i = 1;
2670
+            bool isColour = true;
2671
+            pageData.menuList.Clear();
2672
+            //显示视频
2673
+            foreach (Model_Video videoinfo in model_VideoList)
2674
+            {
2675
+                //是否已上传
2676
+                //videoinfo.IsUpload;
2677
+                //录制时间
2678
+                //videoinfo.RSTime;
2679
+                //文件大小
2680
+                //videoinfo.VideoSize;
2681
+                //文件缩略图路径
2682
+                //videoinfo.ThumbnailPath;
2683
+                //文件唯一标示 上传事件筛选需要上传的视频
2684
+                //videoinfo.FileGuid;
2685
+                //文件存储路径
2686
+                //videoinfo.VidePath;
2687
+
2688
+                string colour = "#FFFFFF";
2689
+                if (isColour == true)
2690
+                {
2691
+                    colour = "#FFFFFF";
2692
+                    isColour = false;
2693
+                }
2694
+                else
2695
+                {
2696
+                    colour = "#E6F1FF";
2697
+                    isColour = true;
2698
+                }
2699
+                string vis = "Visible";
2700
+                string cos = "Collapsed";
2701
+                if (!videoinfo.IsUpload)
2702
+                {
2703
+                    vis = "Collapsed";
2704
+                    cos = "Visible";
2705
+                }
2706
+                if (i <= 16)
2707
+                {
2708
+                    pageData.menuList.Add(new FileDirectoryModel()
2709
+                    {
2710
+                        SerialNumber = i,
2711
+                        VideoName = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VideoPath).Replace(".MP4", "").Replace(".FLV", "").Replace(".AVI", "").Trim(),
2712
+                        Name = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VideoPath).Replace(".MP4", "").Replace(".FLV", "").Replace(".AVI", "").Trim(),
2713
+                        FilePath = videoinfo.VideoPath.Replace(FileToolsCommon.GetIOFileName(videoinfo.VideoPath), "").Trim(),
2714
+                        VideoDuration = 0,
2715
+                        VideoSize = videoinfo.VideoSize,
2716
+                        VideoTime = videoinfo.RSTime,
2717
+                        IsEnabled = false,
2718
+                        Path = videoinfo.VideoPath,
2719
+                        Colour = colour,
2720
+                        Visi = vis,
2721
+                        Coll = cos,
2722
+                        FileGuid = videoinfo.FileGuid,
2723
+                        VideoType = videoinfo.VideoType.ToString()
2724
+                    }); ;
2725
+                }
2726
+                i++;
2727
+            }
2728
+            Currpage = 0;
2729
+            PageNum = 0;
2730
+            if (pageData.menuList.Count>0)
2731
+            {
2732
+                Currpage = 1;
2733
+                txbCurrpageTwo.Text = Currpage.ToString();
2734
+                stpUp.Visibility = Visibility.Visible;
2735
+            }
2736
+            else
2737
+            {
2738
+                stpUp.Visibility = Visibility.Hidden;
2739
+            }
2740
+            PageNum = model_VideoList.Count;
2741
+            if (PageNum > 0)
2742
+            {
2743
+                int t = 1;
2744
+                while (PageNum > 16 * t)
2745
+                {
2746
+                    t++;
2747
+                }
2748
+                PageNum = t;
2749
+            }
2750
+            else
2751
+            {
2752
+                PageNum = 0;
2753
+            }
2754
+            txbPageNumTwo.Text = PageNum.ToString();
2641 2755
             APP.myloading.Hide();
2756
+            DataContext = pageData;
2757
+        }
2758
+        /// <summary>
2759
+        /// 当前页
2760
+        /// </summary>
2761
+        int Currpage = 0;
2762
+        /// <summary>
2763
+        /// 总页码
2764
+        /// </summary>
2765
+        int PageNum = 0;
2766
+        /// <summary>
2767
+        /// 加载视频列表
2768
+        /// </summary>
2769
+        public void LoadingVideoList()
2770
+        {
2771
+            try
2772
+            {
2773
+                model_VideoList = new List<Model_Video>();
2774
+                foreach (Model_WKData Vdata in APP.WKDataList)
2775
+                {
2776
+                    if (Vdata.VideoList == null)
2777
+                        continue;
2778
+                    foreach (Model_Video videoinfo in Vdata.VideoList)
2779
+                    {
2780
+                        try
2781
+                        {
2782
+                            if (string.IsNullOrWhiteSpace(videoinfo.VideoPath))
2783
+                            {
2784
+                                continue;
2785
+                            }
2786
+                            if (string.IsNullOrWhiteSpace(videoinfo.VideoSize) || videoinfo.VideoSize == "0 MB")
2787
+                            {
2788
+                                videoinfo.VideoSize = FileToolsCommon.GetFileSizeByMB(videoinfo.VideoPath).ToString() + " MB";
2789
+                            }
2790
+                            model_VideoList.Add(videoinfo);
2791
+                        }
2792
+                        catch (Exception ex)
2793
+                        {
2794
+                            LogHelper.WriteErrLog("【加载视频列表】(LoadingVideoList)" + ex.Message, ex);
2795
+                        }
2796
+                    }
2797
+                }
2798
+            }
2799
+            catch (Exception ex)
2800
+            {
2801
+                LogHelper.WriteErrLog("【加载视频列表】(LoadingVideoList)" + ex.Message, ex);
2802
+            }
2803
+        }
2804
+        /// <summary>
2805
+        /// 上传
2806
+        /// </summary>
2807
+        /// <param name="sender"></param>
2808
+        /// <param name="e"></param>
2809
+        private void BtnUploads_Click(object sender, RoutedEventArgs e) 
2810
+        {
2811
+            pageData.menuList[Subscript].IsEnabled = false;
2812
+            List<System.Windows.Controls.Button> buttons = FindChilds<System.Windows.Controls.Button>(listView1, "btnUpload");
2813
+            for (int i = 0; i < buttons.Count; i++)
2814
+            {
2815
+                if (buttons[i] == sender)
2816
+                {
2817
+                    DAL_Upload dAL_Upload = new DAL_Upload();
2818
+
2819
+                    if (dAL_Upload.UploadVideo(pageData.menuList[i].FileGuid, out string ErrMessage))
2820
+                    {
2821
+                        pageData.menuList[i].Visi = "Visible";
2822
+                        pageData.menuList[i].Coll = "Collapsed";
2823
+
2824
+                        DataContext = pageData;
2825
+
2826
+                        System.Windows.MessageBox.Show("视频上传成功!");
2827
+                    }
2828
+                    else
2829
+                    {
2830
+                        System.Windows.MessageBox.Show(ErrMessage);
2831
+                    }
2832
+
2833
+
2834
+                }
2835
+            }
2836
+        }
2837
+        /// <summary>
2838
+        /// 删除
2839
+        /// </summary>
2840
+        /// <param name="sender"></param>
2841
+        /// <param name="e"></param>
2842
+        private void BtnDelete_Click(object sender, RoutedEventArgs e)
2843
+        {
2844
+
2845
+            pageData.menuList[Subscript].IsEnabled = false;
2846
+            List<System.Windows.Controls.Button> buttons = FindChilds<System.Windows.Controls.Button>(listView1, "btnDelete");
2847
+            for (int i = 0; i < buttons.Count; i++)
2848
+            {
2849
+                if (buttons[i] == sender)
2850
+                {
2851
+
2852
+                    //if (APP.W_PromptWindow == null)
2853
+                    //{
2854
+                    //    APP.W_PromptWindow = new PromptWindow();
2855
+                    //    APP.W_PromptWindow.Owner = this;
2856
+                    //}
2857
+                    //APP.W_PromptWindow.Initialize(pageData.menuList[i].VideoName);
2858
+                    //APP.W_PromptWindow.ShowDialog();
2859
+
2860
+                    foreach (Model_WKData wKData in APP.WKDataList)
2861
+                    {
2862
+                        if (wKData.VideoList == null)
2863
+                            continue;
2864
+                        if (wKData.VideoList.Exists(x => x.FileGuid == pageData.menuList[i].FileGuid))
2865
+                        {
2866
+                            try
2867
+                            {
2868
+                                FileToolsCommon.DeleteFile(wKData.VideoList.Find(x => x.FileGuid == pageData.menuList[i].FileGuid).VideoPath);
2869
+                                FileToolsCommon.DeleteFile(wKData.VideoList.Find(x => x.FileGuid == pageData.menuList[i].FileGuid).ThumbnailPath);
2870
+                                wKData.VideoList.Remove(wKData.VideoList.Find(x => x.FileGuid == pageData.menuList[i].FileGuid));
2871
+                                InitializeUpload();
2872
+                                return;
2873
+                            }
2874
+                            catch (Exception ex)
2875
+                            {
2876
+                                System.Windows.MessageBox.Show("无法删除视频!" + ex.Message);
2877
+                                return;
2878
+                            }
2879
+                        }
2880
+                    }
2881
+                }
2882
+            }
2883
+        }
2884
+        /// <summary>
2885
+        /// 播放
2886
+        /// </summary>
2887
+        /// <param name="sender"></param>
2888
+        /// <param name="e"></param>
2889
+        private void BtnPlay_Click(object sender, RoutedEventArgs e)
2890
+        {
2891
+            pageData.menuList[Subscript].IsEnabled = false;
2892
+            List<System.Windows.Controls.Button> buttons = FindChilds<System.Windows.Controls.Button>(listView1, "btnPlay");
2893
+            for (int i = 0; i < buttons.Count; i++)
2894
+            {
2895
+                if (buttons[i] == sender)
2896
+                {
2897
+                    try
2898
+                    {
2899
+                        ProcessStartInfo psi = new ProcessStartInfo(pageData.menuList[i].Path);
2900
+                        Process pro = new Process
2901
+                        {
2902
+                            StartInfo = psi
2903
+                        };
2904
+                        pro.Start();
2905
+                    }
2906
+                    catch (Exception ex)
2907
+                    {
2908
+                        LogHelper.WriteErrLog("FileDirectoryWindow【BtnPlay_Click】" + ex.Message, ex);
2909
+                        System.Windows.MessageBox.Show(ex.Message);
2910
+                        return;
2911
+                    }
2912
+                }
2913
+            }
2914
+        }
2915
+        /// <summary>
2916
+        /// 搜索集合匹配的索引
2917
+        /// </summary>
2918
+        /// <typeparam name="T"></typeparam>
2919
+        /// <param name="parent"></param>
2920
+        /// <param name="childName"></param>
2921
+        /// <returns></returns>
2922
+        public static List<T> FindChilds<T>(DependencyObject parent, string childName)
2923
+  where T : DependencyObject
2924
+        {
2925
+            List<T> list = new List<T>();
2926
+            if (parent == null)
2927
+            {
2928
+                return list;
2929
+            }
2930
+
2931
+            int childrenCount = VisualTreeHelper.GetChildrenCount(parent);
2932
+            for (int i = 0; i < childrenCount; i++)
2933
+            {
2934
+                DependencyObject child = VisualTreeHelper.GetChild(parent, i);
2935
+                // 如果子控件不是需查找的控件类型
2936
+                T childType = child as T;
2937
+                if (childType == null)
2938
+                {
2939
+                    // 在下一级控件中递归查找
2940
+                    List<T> findChildList = FindChilds<T>(child, childName);
2941
+                    for (int j = 0; j < findChildList.Count; j++)
2942
+                    {
2943
+                    }
2944
+                    list.AddRange(FindChilds<T>(child, childName));
2945
+                }
2946
+                else if (!string.IsNullOrEmpty(childName))
2947
+                {
2948
+                    FrameworkElement frameworkElement = child as FrameworkElement;
2949
+                    // 如果控件名称符合参数条件
2950
+                    if (frameworkElement != null && frameworkElement.Name == childName)
2951
+                    {
2952
+                        list.Add((T)child);
2953
+                    }
2954
+                }
2955
+                else
2956
+                {
2957
+                    // 查找到了控件
2958
+                    list.Add((T)child);
2959
+                }
2960
+            }
2961
+
2962
+            return list;
2963
+        }
2964
+        /// <summary>
2965
+        /// 修改
2966
+        /// </summary>
2967
+        /// <param name="sender"></param>
2968
+        /// <param name="e"></param>
2969
+        private void BtnModify_Click(object sender, RoutedEventArgs e)
2970
+        {
2971
+            if (IsModify)
2972
+            {
2973
+                pageData.menuList[Subscript].IsEnabled = false;
2974
+            }
2975
+            List<System.Windows.Controls.Button> buttons = FindChilds<System.Windows.Controls.Button>(listView1, "btnModify");
2976
+            for (int i = 0; i < buttons.Count; i++)
2977
+            {
2978
+                if (buttons[i] == sender)
2979
+                {
2980
+                    pageData.menuList[i].IsEnabled = true;
2981
+                    Subscript = i;
2982
+                    IsModify = true;
2983
+                }
2984
+            }
2642 2985
         }
2986
+        int MouseNumber = 0;
2987
+        /// <summary>
2988
+        /// 上传 上页
2989
+        /// </summary>
2990
+        /// <param name="sender"></param>
2991
+        /// <param name="e"></param>
2992
+        private void BtnLastPage_Click(object sender, RoutedEventArgs e)
2993
+        {
2994
+            if (Currpage >1)
2995
+            {
2996
+                Currpage -= 1;
2997
+                txbCurrpageTwo.Text = Currpage.ToString();
2998
+                int i = 1;
2999
+                bool isColour = true;
3000
+                pageData.menuList.Clear();
3001
+                //显示视频
3002
+                foreach (Model_Video videoinfo in model_VideoList)
3003
+                {
3004
+                    //是否已上传
3005
+                    //videoinfo.IsUpload;
3006
+                    //录制时间
3007
+                    //videoinfo.RSTime;
3008
+                    //文件大小
3009
+                    //videoinfo.VideoSize;
3010
+                    //文件缩略图路径
3011
+                    //videoinfo.ThumbnailPath;
3012
+                    //文件唯一标示 上传事件筛选需要上传的视频
3013
+                    //videoinfo.FileGuid;
3014
+                    //文件存储路径
3015
+                    //videoinfo.VidePath;
3016
+
3017
+                    string colour = "#FFFFFF";
3018
+                    if (isColour == true)
3019
+                    {
3020
+                        colour = "#FFFFFF";
3021
+                        isColour = false;
3022
+                    }
3023
+                    else
3024
+                    {
3025
+                        colour = "#E6F1FF";
3026
+                        isColour = true;
3027
+                    }
3028
+                    string vis = "Visible";
3029
+                    string cos = "Collapsed";
3030
+                    if (!videoinfo.IsUpload)
3031
+                    {
3032
+                        vis = "Collapsed";
3033
+                        cos = "Visible";
3034
+                    }
3035
+                    if (i <= Currpage * 16 && i >= (Currpage - 1) * 16)
3036
+                    {
3037
+                        pageData.menuList.Add(new FileDirectoryModel()
3038
+                        {
3039
+                            SerialNumber = i,
3040
+                            VideoName = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VideoPath).Replace(".MP4", "").Replace(".FLV", "").Replace(".AVI", "").Trim(),
3041
+                            Name = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VideoPath).Replace(".MP4", "").Replace(".FLV", "").Replace(".AVI", "").Trim(),
3042
+                            FilePath = videoinfo.VideoPath.Replace(FileToolsCommon.GetIOFileName(videoinfo.VideoPath), "").Trim(),
3043
+                            VideoDuration = 0,
3044
+                            VideoSize = videoinfo.VideoSize,
3045
+                            VideoTime = videoinfo.RSTime,
3046
+                            IsEnabled = false,
3047
+                            Path = videoinfo.VideoPath,
3048
+                            Colour = colour,
3049
+                            Visi = vis,
3050
+                            Coll = cos,
3051
+                            FileGuid = videoinfo.FileGuid,
3052
+                            VideoType = videoinfo.VideoType.ToString()
3053
+                        }); ;
3054
+                    }
3055
+                    i++;
3056
+                }
3057
+                APP.myloading.Hide();
3058
+            }
3059
+        }
3060
+        /// <summary>
3061
+        /// 上传 下页
3062
+        /// </summary>
3063
+        /// <param name="sender"></param>
3064
+        /// <param name="e"></param>
3065
+        private void BtnNextPage_Click(object sender, RoutedEventArgs e)
3066
+        {
3067
+            if(Currpage< PageNum)
3068
+            {
3069
+                Currpage += 1;
3070
+                txbCurrpageTwo.Text = Currpage.ToString();
3071
+                int i = 1;
3072
+                bool isColour = true;
3073
+                pageData.menuList.Clear();
3074
+                //显示视频
3075
+                foreach (Model_Video videoinfo in model_VideoList)
3076
+                {
3077
+                    //是否已上传
3078
+                    //videoinfo.IsUpload;
3079
+                    //录制时间
3080
+                    //videoinfo.RSTime;
3081
+                    //文件大小
3082
+                    //videoinfo.VideoSize;
3083
+                    //文件缩略图路径
3084
+                    //videoinfo.ThumbnailPath;
3085
+                    //文件唯一标示 上传事件筛选需要上传的视频
3086
+                    //videoinfo.FileGuid;
3087
+                    //文件存储路径
3088
+                    //videoinfo.VidePath;
3089
+
3090
+                    string colour = "#FFFFFF";
3091
+                    if (isColour == true)
3092
+                    {
3093
+                        colour = "#FFFFFF";
3094
+                        isColour = false;
3095
+                    }
3096
+                    else
3097
+                    {
3098
+                        colour = "#E6F1FF";
3099
+                        isColour = true;
3100
+                    }
3101
+                    string vis = "Visible";
3102
+                    string cos = "Collapsed";
3103
+                    if (!videoinfo.IsUpload)
3104
+                    {
3105
+                        vis = "Collapsed";
3106
+                        cos = "Visible";
3107
+                    }
3108
+                    if (i <= Currpage*16&&i>(Currpage-1)*16)
3109
+                    {
3110
+                        pageData.menuList.Add(new FileDirectoryModel()
3111
+                        {
3112
+                            SerialNumber = i,
3113
+                            VideoName = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VideoPath).Replace(".MP4", "").Replace(".FLV", "").Replace(".AVI", "").Trim(),
3114
+                            Name = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VideoPath).Replace(".MP4", "").Replace(".FLV", "").Replace(".AVI", "").Trim(),
3115
+                            FilePath = videoinfo.VideoPath.Replace(FileToolsCommon.GetIOFileName(videoinfo.VideoPath), "").Trim(),
3116
+                            VideoDuration = 0,
3117
+                            VideoSize = videoinfo.VideoSize,
3118
+                            VideoTime = videoinfo.RSTime,
3119
+                            IsEnabled = false,
3120
+                            Path = videoinfo.VideoPath,
3121
+                            Colour = colour,
3122
+                            Visi = vis,
3123
+                            Coll = cos,
3124
+                            FileGuid = videoinfo.FileGuid,
3125
+                            VideoType = videoinfo.VideoType.ToString()
3126
+                        }); ;
3127
+                    }
3128
+                    i++;
3129
+                }
3130
+                APP.myloading.Hide();
3131
+            }    
3132
+        }
3133
+        #endregion
2643 3134
     }
2644 3135
 }

Ładowanie…
Anuluj
Zapisz