|
@@ -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 初始化
|
|
@@ -446,17 +465,17 @@ namespace XHWK.WKTool
|
446
|
465
|
Login();
|
447
|
466
|
return;
|
448
|
467
|
}
|
449
|
|
- if (APP.fileDirectoryWindow == null)
|
|
468
|
+ if(gridUpload.Visibility == Visibility.Visible)
|
450
|
469
|
{
|
451
|
|
- APP.fileDirectoryWindow = new FileDirectoryWindow();
|
452
|
|
- //APP.fileDirectoryWindow.Topmost = true;
|
453
|
|
- APP.fileDirectoryWindow.Owner = this;
|
|
470
|
+ gridUpload.Visibility = Visibility.Collapsed;
|
|
471
|
+ GridMain.Visibility = Visibility.Visible;
|
454
|
472
|
}
|
455
|
473
|
else
|
456
|
474
|
{
|
457
|
|
- APP.fileDirectoryWindow.Initialize();
|
|
475
|
+ gridUpload.Visibility = Visibility.Visible;
|
|
476
|
+ GridMain.Visibility = Visibility.Collapsed;
|
|
477
|
+ InitializeUpload();
|
458
|
478
|
}
|
459
|
|
- APP.fileDirectoryWindow.ShowDialog();
|
460
|
479
|
}
|
461
|
480
|
/// <summary>
|
462
|
481
|
/// 关闭事件
|
|
@@ -578,6 +597,12 @@ namespace XHWK.WKTool
|
578
|
597
|
imgPlayerLeft.Visibility = Visibility.Collapsed;
|
579
|
598
|
imgPlayerRightUnder.Visibility = Visibility.Collapsed;
|
580
|
599
|
imgPlayerLeftUnder.Visibility = Visibility.Collapsed;
|
|
600
|
+ if(!txbStoragePath.Content.ToString().Equals(APP.WKData.WkPath))
|
|
601
|
+ {
|
|
602
|
+ //存储文件
|
|
603
|
+ FileToolsCommon.SetConfigValue("VideoSavePath", txbStoragePath.Content.ToString());
|
|
604
|
+ System.Windows.MessageBox.Show("路径已变更,下次创建微课时自动生效!!!");
|
|
605
|
+ }
|
581
|
606
|
}
|
582
|
607
|
/// <summary>
|
583
|
608
|
/// 设置事件
|
|
@@ -620,23 +645,23 @@ namespace XHWK.WKTool
|
620
|
645
|
/// <param name="e"></param>
|
621
|
646
|
private void BtnBrowse_Click(object sender, RoutedEventArgs e)
|
622
|
647
|
{
|
623
|
|
- System.Diagnostics.Process.Start(APP.WKData.WkPath);
|
624
|
|
- //string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
|
625
|
|
- //Ofd = new System.Windows.Forms.FolderBrowserDialog();
|
|
648
|
+ //System.Diagnostics.Process.Start(APP.WKData.WkPath);
|
|
649
|
+ string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
|
|
650
|
+ Ofd = new System.Windows.Forms.FolderBrowserDialog();
|
626
|
651
|
|
627
|
|
- //Result = Ofd.ShowDialog();
|
628
|
|
- //if (Result == System.Windows.Forms.DialogResult.OK)
|
629
|
|
- //{
|
630
|
|
- // if (Ofd.SelectedPath != "")
|
631
|
|
- // {
|
|
652
|
+ Result = Ofd.ShowDialog();
|
|
653
|
+ if (Result == System.Windows.Forms.DialogResult.OK)
|
|
654
|
+ {
|
|
655
|
+ if (Ofd.SelectedPath != "")
|
|
656
|
+ {
|
632
|
657
|
|
633
|
658
|
|
634
|
|
- // //txbStoragePath.Text = Ofd.SelectedPath;
|
635
|
|
- // //string ApplicationData = ZConfig.dataPath + "fileStorageAddress.txt";
|
636
|
|
- // //string temp = ofd.SelectedPath;
|
637
|
|
- // //System.IO.File.WriteAllText(ApplicationData, temp, Encoding.Default);
|
638
|
|
- // }
|
639
|
|
- //}
|
|
659
|
+ txbStoragePath.Content = Ofd.SelectedPath;
|
|
660
|
+ //string ApplicationData = ZConfig.dataPath + "fileStorageAddress.txt";
|
|
661
|
+ //string temp = ofd.SelectedPath;
|
|
662
|
+ //System.IO.File.WriteAllText(ApplicationData, temp, Encoding.Default);
|
|
663
|
+ }
|
|
664
|
+ }
|
640
|
665
|
}
|
641
|
666
|
/// <summary>
|
642
|
667
|
/// 画笔颜色事件 白色
|
|
@@ -811,8 +836,10 @@ namespace XHWK.WKTool
|
811
|
836
|
/// <param name="e"></param>
|
812
|
837
|
private void BtnScreenshot_Click(object sender, RoutedEventArgs e)
|
813
|
838
|
{
|
|
839
|
+ APP.ImgPath = string.Empty;
|
814
|
840
|
string time = GetTimeStamp();
|
815
|
841
|
string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + time + ".jpg";
|
|
842
|
+ APP.ImgPath = desktopPath;
|
816
|
843
|
ImageHelper.GetScreenshot(new System.Drawing.Rectangle(0, 0, 0, 0), desktopPath,false,out BitmapImage bitmap);
|
817
|
844
|
if (this.WindowState == WindowState.Normal)//截图隐藏窗口
|
818
|
845
|
{
|
|
@@ -846,6 +873,7 @@ namespace XHWK.WKTool
|
846
|
873
|
{
|
847
|
874
|
if (this.WindowState == WindowState.Minimized)//截图完恢复窗口
|
848
|
875
|
{
|
|
876
|
+ this.Topmost = true;
|
849
|
877
|
this.WindowState = WindowState.Normal;
|
850
|
878
|
}
|
851
|
879
|
if (!string.IsNullOrWhiteSpace(APP.ImgPath) && File.Exists(APP.ImgPath))
|
|
@@ -878,6 +906,7 @@ namespace XHWK.WKTool
|
878
|
906
|
btnPrint.IsEnabled = true;
|
879
|
907
|
}
|
880
|
908
|
}
|
|
909
|
+ this.Topmost = false;
|
881
|
910
|
}
|
882
|
911
|
}
|
883
|
912
|
/// <summary>
|
|
@@ -1035,11 +1064,11 @@ namespace XHWK.WKTool
|
1035
|
1064
|
}
|
1036
|
1065
|
if (APP.pageData.currpage > 0 && APP.pageData.currpage < APP.PageDrawList.Count)
|
1037
|
1066
|
{
|
1038
|
|
- imgDocumentation.Source = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));//给当前页面展示图片
|
1039
|
1067
|
imgCanvas.Source = null;
|
1040
|
1068
|
ImgScreenshot.Visibility = Visibility.Collapsed;//当前页为导入时不可截图
|
1041
|
1069
|
ImgScreenshotTwo.Visibility = Visibility.Visible;
|
1042
|
1070
|
btnScreenshot.IsEnabled = false;
|
|
1071
|
+ imgDocumentation.Source = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));//给当前页面展示图片
|
1043
|
1072
|
}
|
1044
|
1073
|
else
|
1045
|
1074
|
{
|
|
@@ -2640,15 +2669,481 @@ namespace XHWK.WKTool
|
2640
|
2669
|
imgCanvas.Source = null;
|
2641
|
2670
|
}
|
2642
|
2671
|
|
2643
|
|
- private void Button_Click(object sender, RoutedEventArgs e)
|
|
2672
|
+ #region 上传
|
|
2673
|
+ /// <summary>
|
|
2674
|
+ /// 初始化上传
|
|
2675
|
+ /// </summary>
|
|
2676
|
+ public void InitializeUpload()
|
2644
|
2677
|
{
|
2645
|
|
- //System.Windows.SplashScreen(LoadDialog);
|
2646
|
|
- //Common.system.SplashScreen.Show(typeof(LoadDialog));
|
2647
|
|
- //Thread.Sleep(5000);
|
2648
|
|
- //Common.system.SplashScreen.Close();
|
2649
|
2678
|
APP.myloading.Show();
|
2650
|
|
- Thread.Sleep(1000);
|
|
2679
|
+ MouseNumber = 0;
|
|
2680
|
+ IsModify = false;
|
|
2681
|
+ //加载视频列表
|
|
2682
|
+ LoadingVideoList();
|
|
2683
|
+ int i = 1;
|
|
2684
|
+ bool isColour = true;
|
|
2685
|
+ pageData.menuList.Clear();
|
|
2686
|
+ //显示视频
|
|
2687
|
+ foreach (Model_Video videoinfo in model_VideoList)
|
|
2688
|
+ {
|
|
2689
|
+ //是否已上传
|
|
2690
|
+ //videoinfo.IsUpload;
|
|
2691
|
+ //录制时间
|
|
2692
|
+ //videoinfo.RSTime;
|
|
2693
|
+ //文件大小
|
|
2694
|
+ //videoinfo.VideoSize;
|
|
2695
|
+ //文件缩略图路径
|
|
2696
|
+ //videoinfo.ThumbnailPath;
|
|
2697
|
+ //文件唯一标示 上传事件筛选需要上传的视频
|
|
2698
|
+ //videoinfo.FileGuid;
|
|
2699
|
+ //文件存储路径
|
|
2700
|
+ //videoinfo.VidePath;
|
|
2701
|
+
|
|
2702
|
+ string colour = "#FFFFFF";
|
|
2703
|
+ if (isColour == true)
|
|
2704
|
+ {
|
|
2705
|
+ colour = "#FFFFFF";
|
|
2706
|
+ isColour = false;
|
|
2707
|
+ }
|
|
2708
|
+ else
|
|
2709
|
+ {
|
|
2710
|
+ colour = "#E6F1FF";
|
|
2711
|
+ isColour = true;
|
|
2712
|
+ }
|
|
2713
|
+ string vis = "Visible";
|
|
2714
|
+ string cos = "Collapsed";
|
|
2715
|
+ if (!videoinfo.IsUpload)
|
|
2716
|
+ {
|
|
2717
|
+ vis = "Collapsed";
|
|
2718
|
+ cos = "Visible";
|
|
2719
|
+ }
|
|
2720
|
+ if (i <= 16)
|
|
2721
|
+ {
|
|
2722
|
+ pageData.menuList.Add(new FileDirectoryModel()
|
|
2723
|
+ {
|
|
2724
|
+ SerialNumber = i,
|
|
2725
|
+ VideoName = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VideoPath).Replace(".MP4", "").Replace(".FLV", "").Replace(".AVI", "").Trim(),
|
|
2726
|
+ Name = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VideoPath).Replace(".MP4", "").Replace(".FLV", "").Replace(".AVI", "").Trim(),
|
|
2727
|
+ FilePath = videoinfo.VideoPath.Replace(FileToolsCommon.GetIOFileName(videoinfo.VideoPath), "").Trim(),
|
|
2728
|
+ VideoDuration = 0,
|
|
2729
|
+ VideoSize = videoinfo.VideoSize,
|
|
2730
|
+ VideoTime = videoinfo.RSTime,
|
|
2731
|
+ IsEnabled = false,
|
|
2732
|
+ Path = videoinfo.VideoPath,
|
|
2733
|
+ Colour = colour,
|
|
2734
|
+ Visi = vis,
|
|
2735
|
+ Coll = cos,
|
|
2736
|
+ FileGuid = videoinfo.FileGuid,
|
|
2737
|
+ VideoType = videoinfo.VideoType.ToString()
|
|
2738
|
+ }); ;
|
|
2739
|
+ }
|
|
2740
|
+ i++;
|
|
2741
|
+ }
|
|
2742
|
+ Currpage = 0;
|
|
2743
|
+ PageNum = 0;
|
|
2744
|
+ if (pageData.menuList.Count>0)
|
|
2745
|
+ {
|
|
2746
|
+ Currpage = 1;
|
|
2747
|
+ txbCurrpageTwo.Text = Currpage.ToString();
|
|
2748
|
+ stpUp.Visibility = Visibility.Visible;
|
|
2749
|
+ }
|
|
2750
|
+ else
|
|
2751
|
+ {
|
|
2752
|
+ stpUp.Visibility = Visibility.Hidden;
|
|
2753
|
+ }
|
|
2754
|
+ PageNum = model_VideoList.Count;
|
|
2755
|
+ if (PageNum > 0)
|
|
2756
|
+ {
|
|
2757
|
+ int t = 1;
|
|
2758
|
+ while (PageNum > 16 * t)
|
|
2759
|
+ {
|
|
2760
|
+ t++;
|
|
2761
|
+ }
|
|
2762
|
+ PageNum = t;
|
|
2763
|
+ }
|
|
2764
|
+ else
|
|
2765
|
+ {
|
|
2766
|
+ PageNum = 0;
|
|
2767
|
+ }
|
|
2768
|
+ txbPageNumTwo.Text = PageNum.ToString();
|
2651
|
2769
|
APP.myloading.Hide();
|
|
2770
|
+ DataContext = pageData;
|
|
2771
|
+ }
|
|
2772
|
+ /// <summary>
|
|
2773
|
+ /// 当前页
|
|
2774
|
+ /// </summary>
|
|
2775
|
+ int Currpage = 0;
|
|
2776
|
+ /// <summary>
|
|
2777
|
+ /// 总页码
|
|
2778
|
+ /// </summary>
|
|
2779
|
+ int PageNum = 0;
|
|
2780
|
+ /// <summary>
|
|
2781
|
+ /// 加载视频列表
|
|
2782
|
+ /// </summary>
|
|
2783
|
+ public void LoadingVideoList()
|
|
2784
|
+ {
|
|
2785
|
+ try
|
|
2786
|
+ {
|
|
2787
|
+ model_VideoList = new List<Model_Video>();
|
|
2788
|
+ foreach (Model_WKData Vdata in APP.WKDataList)
|
|
2789
|
+ {
|
|
2790
|
+ if (Vdata.VideoList == null)
|
|
2791
|
+ continue;
|
|
2792
|
+ foreach (Model_Video videoinfo in Vdata.VideoList)
|
|
2793
|
+ {
|
|
2794
|
+ try
|
|
2795
|
+ {
|
|
2796
|
+ if (string.IsNullOrWhiteSpace(videoinfo.VideoPath))
|
|
2797
|
+ {
|
|
2798
|
+ continue;
|
|
2799
|
+ }
|
|
2800
|
+ if (string.IsNullOrWhiteSpace(videoinfo.VideoSize) || videoinfo.VideoSize == "0 MB")
|
|
2801
|
+ {
|
|
2802
|
+ videoinfo.VideoSize = FileToolsCommon.GetFileSizeByMB(videoinfo.VideoPath).ToString() + " MB";
|
|
2803
|
+ }
|
|
2804
|
+ model_VideoList.Add(videoinfo);
|
|
2805
|
+ }
|
|
2806
|
+ catch (Exception ex)
|
|
2807
|
+ {
|
|
2808
|
+ LogHelper.WriteErrLog("【加载视频列表】(LoadingVideoList)" + ex.Message, ex);
|
|
2809
|
+ }
|
|
2810
|
+ }
|
|
2811
|
+ }
|
|
2812
|
+ }
|
|
2813
|
+ catch (Exception ex)
|
|
2814
|
+ {
|
|
2815
|
+ LogHelper.WriteErrLog("【加载视频列表】(LoadingVideoList)" + ex.Message, ex);
|
|
2816
|
+ }
|
|
2817
|
+ }
|
|
2818
|
+ /// <summary>
|
|
2819
|
+ /// 上传
|
|
2820
|
+ /// </summary>
|
|
2821
|
+ /// <param name="sender"></param>
|
|
2822
|
+ /// <param name="e"></param>
|
|
2823
|
+ private void BtnUploads_Click(object sender, RoutedEventArgs e)
|
|
2824
|
+ {
|
|
2825
|
+ pageData.menuList[Subscript].IsEnabled = false;
|
|
2826
|
+ List<System.Windows.Controls.Button> buttons = FindChilds<System.Windows.Controls.Button>(listView1, "btnUpload");
|
|
2827
|
+ for (int i = 0; i < buttons.Count; i++)
|
|
2828
|
+ {
|
|
2829
|
+ if (buttons[i] == sender)
|
|
2830
|
+ {
|
|
2831
|
+ DAL_Upload dAL_Upload = new DAL_Upload();
|
|
2832
|
+
|
|
2833
|
+ if (dAL_Upload.UploadVideo(pageData.menuList[i].FileGuid, out string ErrMessage))
|
|
2834
|
+ {
|
|
2835
|
+ pageData.menuList[i].Visi = "Visible";
|
|
2836
|
+ pageData.menuList[i].Coll = "Collapsed";
|
|
2837
|
+
|
|
2838
|
+ DataContext = pageData;
|
|
2839
|
+
|
|
2840
|
+ System.Windows.MessageBox.Show("视频上传成功!");
|
|
2841
|
+ }
|
|
2842
|
+ else
|
|
2843
|
+ {
|
|
2844
|
+ System.Windows.MessageBox.Show(ErrMessage);
|
|
2845
|
+ }
|
|
2846
|
+
|
|
2847
|
+
|
|
2848
|
+ }
|
|
2849
|
+ }
|
|
2850
|
+ }
|
|
2851
|
+ /// <summary>
|
|
2852
|
+ /// 删除
|
|
2853
|
+ /// </summary>
|
|
2854
|
+ /// <param name="sender"></param>
|
|
2855
|
+ /// <param name="e"></param>
|
|
2856
|
+ private void BtnDelete_Click(object sender, RoutedEventArgs e)
|
|
2857
|
+ {
|
|
2858
|
+
|
|
2859
|
+ pageData.menuList[Subscript].IsEnabled = false;
|
|
2860
|
+ List<System.Windows.Controls.Button> buttons = FindChilds<System.Windows.Controls.Button>(listView1, "btnDelete");
|
|
2861
|
+ for (int i = 0; i < buttons.Count; i++)
|
|
2862
|
+ {
|
|
2863
|
+ if (buttons[i] == sender)
|
|
2864
|
+ {
|
|
2865
|
+
|
|
2866
|
+ //if (APP.W_PromptWindow == null)
|
|
2867
|
+ //{
|
|
2868
|
+ // APP.W_PromptWindow = new PromptWindow();
|
|
2869
|
+ // APP.W_PromptWindow.Owner = this;
|
|
2870
|
+ //}
|
|
2871
|
+ //APP.W_PromptWindow.Initialize(pageData.menuList[i].VideoName);
|
|
2872
|
+ //APP.W_PromptWindow.ShowDialog();
|
|
2873
|
+
|
|
2874
|
+ foreach (Model_WKData wKData in APP.WKDataList)
|
|
2875
|
+ {
|
|
2876
|
+ if (wKData.VideoList == null)
|
|
2877
|
+ continue;
|
|
2878
|
+ if (wKData.VideoList.Exists(x => x.FileGuid == pageData.menuList[i].FileGuid))
|
|
2879
|
+ {
|
|
2880
|
+ try
|
|
2881
|
+ {
|
|
2882
|
+ FileToolsCommon.DeleteFile(wKData.VideoList.Find(x => x.FileGuid == pageData.menuList[i].FileGuid).VideoPath);
|
|
2883
|
+ FileToolsCommon.DeleteFile(wKData.VideoList.Find(x => x.FileGuid == pageData.menuList[i].FileGuid).ThumbnailPath);
|
|
2884
|
+ wKData.VideoList.Remove(wKData.VideoList.Find(x => x.FileGuid == pageData.menuList[i].FileGuid));
|
|
2885
|
+ InitializeUpload();
|
|
2886
|
+ return;
|
|
2887
|
+ }
|
|
2888
|
+ catch (Exception ex)
|
|
2889
|
+ {
|
|
2890
|
+ System.Windows.MessageBox.Show("无法删除视频!" + ex.Message);
|
|
2891
|
+ return;
|
|
2892
|
+ }
|
|
2893
|
+ }
|
|
2894
|
+ }
|
|
2895
|
+ }
|
|
2896
|
+ }
|
|
2897
|
+ }
|
|
2898
|
+ /// <summary>
|
|
2899
|
+ /// 播放
|
|
2900
|
+ /// </summary>
|
|
2901
|
+ /// <param name="sender"></param>
|
|
2902
|
+ /// <param name="e"></param>
|
|
2903
|
+ private void BtnPlay_Click(object sender, RoutedEventArgs e)
|
|
2904
|
+ {
|
|
2905
|
+ pageData.menuList[Subscript].IsEnabled = false;
|
|
2906
|
+ List<System.Windows.Controls.Button> buttons = FindChilds<System.Windows.Controls.Button>(listView1, "btnPlay");
|
|
2907
|
+ for (int i = 0; i < buttons.Count; i++)
|
|
2908
|
+ {
|
|
2909
|
+ if (buttons[i] == sender)
|
|
2910
|
+ {
|
|
2911
|
+ try
|
|
2912
|
+ {
|
|
2913
|
+ ProcessStartInfo psi = new ProcessStartInfo(pageData.menuList[i].Path);
|
|
2914
|
+ Process pro = new Process
|
|
2915
|
+ {
|
|
2916
|
+ StartInfo = psi
|
|
2917
|
+ };
|
|
2918
|
+ pro.Start();
|
|
2919
|
+ }
|
|
2920
|
+ catch (Exception ex)
|
|
2921
|
+ {
|
|
2922
|
+ LogHelper.WriteErrLog("FileDirectoryWindow【BtnPlay_Click】" + ex.Message, ex);
|
|
2923
|
+ System.Windows.MessageBox.Show(ex.Message);
|
|
2924
|
+ return;
|
|
2925
|
+ }
|
|
2926
|
+ }
|
|
2927
|
+ }
|
|
2928
|
+ }
|
|
2929
|
+ /// <summary>
|
|
2930
|
+ /// 搜索集合匹配的索引
|
|
2931
|
+ /// </summary>
|
|
2932
|
+ /// <typeparam name="T"></typeparam>
|
|
2933
|
+ /// <param name="parent"></param>
|
|
2934
|
+ /// <param name="childName"></param>
|
|
2935
|
+ /// <returns></returns>
|
|
2936
|
+ public static List<T> FindChilds<T>(DependencyObject parent, string childName)
|
|
2937
|
+ where T : DependencyObject
|
|
2938
|
+ {
|
|
2939
|
+ List<T> list = new List<T>();
|
|
2940
|
+ if (parent == null)
|
|
2941
|
+ {
|
|
2942
|
+ return list;
|
|
2943
|
+ }
|
|
2944
|
+
|
|
2945
|
+ int childrenCount = VisualTreeHelper.GetChildrenCount(parent);
|
|
2946
|
+ for (int i = 0; i < childrenCount; i++)
|
|
2947
|
+ {
|
|
2948
|
+ DependencyObject child = VisualTreeHelper.GetChild(parent, i);
|
|
2949
|
+ // 如果子控件不是需查找的控件类型
|
|
2950
|
+ T childType = child as T;
|
|
2951
|
+ if (childType == null)
|
|
2952
|
+ {
|
|
2953
|
+ // 在下一级控件中递归查找
|
|
2954
|
+ List<T> findChildList = FindChilds<T>(child, childName);
|
|
2955
|
+ for (int j = 0; j < findChildList.Count; j++)
|
|
2956
|
+ {
|
|
2957
|
+ }
|
|
2958
|
+ list.AddRange(FindChilds<T>(child, childName));
|
|
2959
|
+ }
|
|
2960
|
+ else if (!string.IsNullOrEmpty(childName))
|
|
2961
|
+ {
|
|
2962
|
+ FrameworkElement frameworkElement = child as FrameworkElement;
|
|
2963
|
+ // 如果控件名称符合参数条件
|
|
2964
|
+ if (frameworkElement != null && frameworkElement.Name == childName)
|
|
2965
|
+ {
|
|
2966
|
+ list.Add((T)child);
|
|
2967
|
+ }
|
|
2968
|
+ }
|
|
2969
|
+ else
|
|
2970
|
+ {
|
|
2971
|
+ // 查找到了控件
|
|
2972
|
+ list.Add((T)child);
|
|
2973
|
+ }
|
|
2974
|
+ }
|
|
2975
|
+
|
|
2976
|
+ return list;
|
2652
|
2977
|
}
|
|
2978
|
+ /// <summary>
|
|
2979
|
+ /// 修改
|
|
2980
|
+ /// </summary>
|
|
2981
|
+ /// <param name="sender"></param>
|
|
2982
|
+ /// <param name="e"></param>
|
|
2983
|
+ private void BtnModify_Click(object sender, RoutedEventArgs e)
|
|
2984
|
+ {
|
|
2985
|
+ if (IsModify)
|
|
2986
|
+ {
|
|
2987
|
+ pageData.menuList[Subscript].IsEnabled = false;
|
|
2988
|
+ }
|
|
2989
|
+ List<System.Windows.Controls.Button> buttons = FindChilds<System.Windows.Controls.Button>(listView1, "btnModify");
|
|
2990
|
+ for (int i = 0; i < buttons.Count; i++)
|
|
2991
|
+ {
|
|
2992
|
+ if (buttons[i] == sender)
|
|
2993
|
+ {
|
|
2994
|
+ pageData.menuList[i].IsEnabled = true;
|
|
2995
|
+ Subscript = i;
|
|
2996
|
+ IsModify = true;
|
|
2997
|
+ }
|
|
2998
|
+ }
|
|
2999
|
+ }
|
|
3000
|
+ int MouseNumber = 0;
|
|
3001
|
+ /// <summary>
|
|
3002
|
+ /// 上传 上页
|
|
3003
|
+ /// </summary>
|
|
3004
|
+ /// <param name="sender"></param>
|
|
3005
|
+ /// <param name="e"></param>
|
|
3006
|
+ private void BtnLastPage_Click(object sender, RoutedEventArgs e)
|
|
3007
|
+ {
|
|
3008
|
+ if (Currpage >1)
|
|
3009
|
+ {
|
|
3010
|
+ Currpage -= 1;
|
|
3011
|
+ txbCurrpageTwo.Text = Currpage.ToString();
|
|
3012
|
+ int i = 1;
|
|
3013
|
+ bool isColour = true;
|
|
3014
|
+ pageData.menuList.Clear();
|
|
3015
|
+ //显示视频
|
|
3016
|
+ foreach (Model_Video videoinfo in model_VideoList)
|
|
3017
|
+ {
|
|
3018
|
+ //是否已上传
|
|
3019
|
+ //videoinfo.IsUpload;
|
|
3020
|
+ //录制时间
|
|
3021
|
+ //videoinfo.RSTime;
|
|
3022
|
+ //文件大小
|
|
3023
|
+ //videoinfo.VideoSize;
|
|
3024
|
+ //文件缩略图路径
|
|
3025
|
+ //videoinfo.ThumbnailPath;
|
|
3026
|
+ //文件唯一标示 上传事件筛选需要上传的视频
|
|
3027
|
+ //videoinfo.FileGuid;
|
|
3028
|
+ //文件存储路径
|
|
3029
|
+ //videoinfo.VidePath;
|
|
3030
|
+
|
|
3031
|
+ string colour = "#FFFFFF";
|
|
3032
|
+ if (isColour == true)
|
|
3033
|
+ {
|
|
3034
|
+ colour = "#FFFFFF";
|
|
3035
|
+ isColour = false;
|
|
3036
|
+ }
|
|
3037
|
+ else
|
|
3038
|
+ {
|
|
3039
|
+ colour = "#E6F1FF";
|
|
3040
|
+ isColour = true;
|
|
3041
|
+ }
|
|
3042
|
+ string vis = "Visible";
|
|
3043
|
+ string cos = "Collapsed";
|
|
3044
|
+ if (!videoinfo.IsUpload)
|
|
3045
|
+ {
|
|
3046
|
+ vis = "Collapsed";
|
|
3047
|
+ cos = "Visible";
|
|
3048
|
+ }
|
|
3049
|
+ if (i <= Currpage * 16 && i >= (Currpage - 1) * 16)
|
|
3050
|
+ {
|
|
3051
|
+ pageData.menuList.Add(new FileDirectoryModel()
|
|
3052
|
+ {
|
|
3053
|
+ SerialNumber = i,
|
|
3054
|
+ VideoName = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VideoPath).Replace(".MP4", "").Replace(".FLV", "").Replace(".AVI", "").Trim(),
|
|
3055
|
+ Name = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VideoPath).Replace(".MP4", "").Replace(".FLV", "").Replace(".AVI", "").Trim(),
|
|
3056
|
+ FilePath = videoinfo.VideoPath.Replace(FileToolsCommon.GetIOFileName(videoinfo.VideoPath), "").Trim(),
|
|
3057
|
+ VideoDuration = 0,
|
|
3058
|
+ VideoSize = videoinfo.VideoSize,
|
|
3059
|
+ VideoTime = videoinfo.RSTime,
|
|
3060
|
+ IsEnabled = false,
|
|
3061
|
+ Path = videoinfo.VideoPath,
|
|
3062
|
+ Colour = colour,
|
|
3063
|
+ Visi = vis,
|
|
3064
|
+ Coll = cos,
|
|
3065
|
+ FileGuid = videoinfo.FileGuid,
|
|
3066
|
+ VideoType = videoinfo.VideoType.ToString()
|
|
3067
|
+ }); ;
|
|
3068
|
+ }
|
|
3069
|
+ i++;
|
|
3070
|
+ }
|
|
3071
|
+ APP.myloading.Hide();
|
|
3072
|
+ }
|
|
3073
|
+ }
|
|
3074
|
+ /// <summary>
|
|
3075
|
+ /// 上传 下页
|
|
3076
|
+ /// </summary>
|
|
3077
|
+ /// <param name="sender"></param>
|
|
3078
|
+ /// <param name="e"></param>
|
|
3079
|
+ private void BtnNextPage_Click(object sender, RoutedEventArgs e)
|
|
3080
|
+ {
|
|
3081
|
+ if(Currpage< PageNum)
|
|
3082
|
+ {
|
|
3083
|
+ Currpage += 1;
|
|
3084
|
+ txbCurrpageTwo.Text = Currpage.ToString();
|
|
3085
|
+ int i = 1;
|
|
3086
|
+ bool isColour = true;
|
|
3087
|
+ pageData.menuList.Clear();
|
|
3088
|
+ //显示视频
|
|
3089
|
+ foreach (Model_Video videoinfo in model_VideoList)
|
|
3090
|
+ {
|
|
3091
|
+ //是否已上传
|
|
3092
|
+ //videoinfo.IsUpload;
|
|
3093
|
+ //录制时间
|
|
3094
|
+ //videoinfo.RSTime;
|
|
3095
|
+ //文件大小
|
|
3096
|
+ //videoinfo.VideoSize;
|
|
3097
|
+ //文件缩略图路径
|
|
3098
|
+ //videoinfo.ThumbnailPath;
|
|
3099
|
+ //文件唯一标示 上传事件筛选需要上传的视频
|
|
3100
|
+ //videoinfo.FileGuid;
|
|
3101
|
+ //文件存储路径
|
|
3102
|
+ //videoinfo.VidePath;
|
|
3103
|
+
|
|
3104
|
+ string colour = "#FFFFFF";
|
|
3105
|
+ if (isColour == true)
|
|
3106
|
+ {
|
|
3107
|
+ colour = "#FFFFFF";
|
|
3108
|
+ isColour = false;
|
|
3109
|
+ }
|
|
3110
|
+ else
|
|
3111
|
+ {
|
|
3112
|
+ colour = "#E6F1FF";
|
|
3113
|
+ isColour = true;
|
|
3114
|
+ }
|
|
3115
|
+ string vis = "Visible";
|
|
3116
|
+ string cos = "Collapsed";
|
|
3117
|
+ if (!videoinfo.IsUpload)
|
|
3118
|
+ {
|
|
3119
|
+ vis = "Collapsed";
|
|
3120
|
+ cos = "Visible";
|
|
3121
|
+ }
|
|
3122
|
+ if (i <= Currpage*16&&i>(Currpage-1)*16)
|
|
3123
|
+ {
|
|
3124
|
+ pageData.menuList.Add(new FileDirectoryModel()
|
|
3125
|
+ {
|
|
3126
|
+ SerialNumber = i,
|
|
3127
|
+ VideoName = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VideoPath).Replace(".MP4", "").Replace(".FLV", "").Replace(".AVI", "").Trim(),
|
|
3128
|
+ Name = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VideoPath).Replace(".MP4", "").Replace(".FLV", "").Replace(".AVI", "").Trim(),
|
|
3129
|
+ FilePath = videoinfo.VideoPath.Replace(FileToolsCommon.GetIOFileName(videoinfo.VideoPath), "").Trim(),
|
|
3130
|
+ VideoDuration = 0,
|
|
3131
|
+ VideoSize = videoinfo.VideoSize,
|
|
3132
|
+ VideoTime = videoinfo.RSTime,
|
|
3133
|
+ IsEnabled = false,
|
|
3134
|
+ Path = videoinfo.VideoPath,
|
|
3135
|
+ Colour = colour,
|
|
3136
|
+ Visi = vis,
|
|
3137
|
+ Coll = cos,
|
|
3138
|
+ FileGuid = videoinfo.FileGuid,
|
|
3139
|
+ VideoType = videoinfo.VideoType.ToString()
|
|
3140
|
+ }); ;
|
|
3141
|
+ }
|
|
3142
|
+ i++;
|
|
3143
|
+ }
|
|
3144
|
+ APP.myloading.Hide();
|
|
3145
|
+ }
|
|
3146
|
+ }
|
|
3147
|
+ #endregion
|
2653
|
3148
|
}
|
2654
|
3149
|
}
|