private void CommandBinding_RehashFile(object sender, ExecutedRoutedEventArgs e) { try { Window parentWindow = Window.GetWindow(this); object obj = e.Parameter; if (obj == null) { return; } if (obj.GetType() == typeof(VM_VideoLocal)) { VM_VideoLocal vid = obj as VM_VideoLocal; if (vid.IsLocalFile()) { EnableDisableControls(false); VM_ShokoServer.Instance.ShokoServices.RehashFile(vid.VideoLocalID); } } if (obj.GetType() == typeof(MultipleVideos)) { MultipleVideos mv = obj as MultipleVideos; foreach (VM_VideoLocal v in mv.VideoLocals) { if (v.IsLocalFile()) { VM_ShokoServer.Instance.ShokoServices.RehashFile(v.VideoLocalID); } } } MessageBox.Show(Shoko.Commons.Properties.Resources.MSG_INFO_AddedQueueCmds, Shoko.Commons.Properties.Resources.Done, MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } EnableDisableControls(true); }
private void CommandBinding_OpenFolder(object sender, ExecutedRoutedEventArgs e) { object obj = e.Parameter; if (obj == null) { return; } if (obj.GetType() == typeof(VM_VideoLocal)) { VM_VideoLocal vid = obj as VM_VideoLocal; if (vid.IsLocalFile() && File.Exists(vid.GetLocalFileSystemFullPath())) { Utils.OpenFolderAndSelectFile(vid.GetLocalFileSystemFullPath()); } else { MessageBox.Show(Shoko.Commons.Properties.Resources.MSG_ERR_FileNotFound, Shoko.Commons.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); } } }