Exemplo n.º 1
0
        private void SaveInfo(string filepath)
        {
            if (vieModel.DetailMovie == null)
            {
                return;
            }
            if (!string.IsNullOrEmpty(vieModel.DetailMovie.id))
            {
                //视频类型、文件大小、创建时间
                vieModel.DetailMovie.filepath = filepath;

                FileInfo fileInfo = new FileInfo(filepath);

                string id = Identify.GetFanhao(fileInfo.Name);
                int    vt = (int)Identify.GetVedioType(id);
                if (vt > 0)
                {
                    vieModel.DetailMovie.vediotype = vt;
                }
                if (File.Exists(filepath))
                {
                    vieModel.DetailMovie.filesize = fileInfo.Length;
                    string createDate = "";
                    try { createDate = fileInfo.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"); }
                    catch { }
                    if (createDate == "")
                    {
                        createDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    }
                    vieModel.DetailMovie.otherinfo = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    vieModel.DetailMovie.scandate  = createDate;
                }

                vieModel.SaveModel();

                string table = ((Main)Jvedio.GetWindow.Get("Main")).GetCurrentList();
                if (string.IsNullOrEmpty(table))
                {
                    vieModel.Query(vieModel.id);
                }
                else
                {
                    vieModel.Query(vieModel.id, table);
                }
                HandyControl.Controls.Growl.Success("路径、视频类型、文件大小、创建时间、导入时间成功更新!", "EditGrowl");
            }
            else
            {
                vieModel.Refresh(filepath);
            }
        }
Exemplo n.º 2
0
 public void ChoseMovie(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.OpenFileDialog OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
     OpenFileDialog1.Title            = "选择一个视频";
     OpenFileDialog1.FileName         = "";
     OpenFileDialog1.Filter           = "常见视频文件(*.avi, *.mp4, *.mkv, *.mpg, *.rmvb)| *.avi; *.mp4; *.mkv; *.mpg; *.rmvb|其它视频文件((*.rm, *.mov, *.mpeg, *.flv, *.wmv, *.m4v)| *.rm; *.mov; *.mpeg; *.flv; *.wmv; *.m4v|所有文件 (*.*)|*.*";
     OpenFileDialog1.FilterIndex      = 1;
     OpenFileDialog1.RestoreDirectory = true;
     if (OpenFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         if (!string.IsNullOrEmpty(vieModel.DetailMovie.id))
         {
             vieModel.DetailMovie.filepath = OpenFileDialog1.FileName;
             vieModel.SaveModel();
             new PopupWindow(this, "修改已保存").Show();
             vieModel.Query(vieModel.id);
         }
         else
         {
             vieModel.Refresh(OpenFileDialog1.FileName);
         }
     }
 }