private void DgVideos_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { ccDetail.Content = null; ccDetailMultiple.Content = null; AnyVideosSelected = dgVideos.SelectedItems.Count > 0; OneVideoSelected = dgVideos.SelectedItems.Count == 1; MultipleVideosSelected = dgVideos.SelectedItems.Count > 1; MultipleTypeRange = cboMultiType.SelectedIndex == 0; MultipleTypeSingle = cboMultiType.SelectedIndex == 1; Visibility visible = Visibility.Visible; // if only one video selected if (OneVideoSelected) { VM_VideoLocal vid = dgVideos.SelectedItem as VM_VideoLocal; ccDetail.Content = vid; if (vid != null && !vid.IsHashed()) { visible = Visibility.Hidden; } } // if only one video selected if (MultipleVideosSelected) { MultipleVideos mv = new MultipleVideos(); mv.SelectedCount = dgVideos.SelectedItems.Count; mv.VideoLocalIDs = new List <int>(); mv.VideoLocals = new List <VM_VideoLocal>(); foreach (object obj in dgVideos.SelectedItems) { VM_VideoLocal vid = obj as VM_VideoLocal; mv.VideoLocalIDs.Add(vid.VideoLocalID); mv.VideoLocals.Add(vid); } ccDetailMultiple.Content = mv; if (!mv.AllHaveHashes) { visible = Visibility.Hidden; } } SetConfirmDetails(); Confirm1.Visibility = Confirm2.Visibility = visible; if (string.IsNullOrEmpty(txtSeriesSearch.Text)) { RefreshSeries(); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void CommandBinding_RescanFile(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; EnableDisableControls(false); if (vid.IsHashed()) { VM_ShokoServer.Instance.ShokoServices.RescanFile(vid.VideoLocalID); } } if (obj.GetType() == typeof(MultipleVideos)) { MultipleVideos mv = obj as MultipleVideos; foreach (VM_VideoLocal v in mv.VideoLocals) { if (v.IsHashed()) { VM_ShokoServer.Instance.ShokoServices.RescanFile(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); }