private void CommandBinding_PlayVideo2(object sender, ExecutedRoutedEventArgs e) { object obj = e.Parameter; if (obj == null) { return; } try { if (obj.GetType() == typeof(VM_DuplicateFile)) { VM_DuplicateFile df = obj as VM_DuplicateFile; Process.Start(new ProcessStartInfo(df.GetLocalFilePath2())); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { Cursor = Cursors.Arrow; } }
private void CommandBinding_OpenFolder2(object sender, ExecutedRoutedEventArgs e) { object obj = e.Parameter; if (obj == null) { return; } try { if (obj.GetType() == typeof(VM_DuplicateFile)) { VM_DuplicateFile df = obj as VM_DuplicateFile; if (File.Exists(df.GetLocalFilePath2())) { Utils.OpenFolderAndSelectFile(df.GetLocalFilePath2()); } else { MessageBox.Show(Shoko.Commons.Properties.Resources.MSG_ERR_FileNotFound, Shoko.Commons.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); } } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void CommandBinding_DeleteFileDB(object sender, ExecutedRoutedEventArgs e) { object obj = e.Parameter; if (obj == null) { return; } try { if (obj.GetType() == typeof(VM_DuplicateFile)) { VM_DuplicateFile df = obj as VM_DuplicateFile; MessageBoxResult res = MessageBox.Show(string.Format(Shoko.Commons.Properties.Resources.DuplicateFiles_DeleteEntry), Shoko.Commons.Properties.Resources.Confirm, MessageBoxButton.YesNo, MessageBoxImage.Question); if (res == MessageBoxResult.Yes) { Cursor = Cursors.Wait; string result = VM_ShokoServer.Instance.ShokoServices.DeleteDuplicateFile(df.DuplicateFileID, 0); if (result.Length > 0) { MessageBox.Show(result, Shoko.Commons.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); } else { DuplicateFilesCollection.Remove(df); FileCount = DuplicateFilesCollection.Count; //RefreshDuplicateFiles(); } } } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { Cursor = Cursors.Arrow; } }