private void Button_Click(object sender, RoutedEventArgs e) { if (vieModel.DetailMovie.id == "") { new Msgbox(this, "识别码为空!").ShowDialog(); return; } if (vieModel.DetailMovie.vediotype <= 0) { new Msgbox(this, "请选择视频类型!").ShowDialog(); return; } string oldID = vieModel.DetailMovie.id; string newID = idTextBox.Text; bool success = vieModel.SaveModel(idTextBox.Text); if (success) { UpdateMain(oldID, newID); //更新主窗口 UpdateDetail(); //更新详情窗口 HandyControl.Controls.Growl.Success("保存成功", "EditGrowl"); } else { HandyControl.Controls.Growl.Error("保存失败,已存在该识别码", "EditGrowl"); } }
private void Button_Click(object sender, RoutedEventArgs e) { if (vieModel.DetailMovie.id == "") { new Msgbox(this, Jvedio.Language.Resources.NullID).ShowDialog(); return; } if (vieModel.DetailMovie.vediotype <= 0) { new Msgbox(this, Jvedio.Language.Resources.Message_ChooseVedioType).ShowDialog(); return; } string oldID = vieModel.DetailMovie.id; string newID = idTextBox.Text; bool success = vieModel.SaveModel(idTextBox.Text); if (success) { UpdateMain(oldID, newID); //更新主窗口 UpdateDetail(); //更新详情窗口 HandyControl.Controls.Growl.Success(Jvedio.Language.Resources.Message_Success, "EditGrowl"); } else { HandyControl.Controls.Growl.Error(Jvedio.Language.Resources.Message_SaveFailForExistID, "EditGrowl"); } }
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); } } }
private void SaveInfo(string filepath) { 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.scandate = createDate; } vieModel.SaveModel(); vieModel.Query(vieModel.id); HandyControl.Controls.Growl.Success("路径、视频类型、文件大小、创建时间成功更新!", "EditGrowl"); } else { vieModel.Refresh(filepath); } }