void previewWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { ViewFiles.Refresh(); WorkerStatusContainer status = e.UserState as WorkerStatusContainer; WorkerStatus = string.Format("{0} of {1}", status.CurrentFile, status.TotalFileCount); }
void previewWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { ViewFiles.Refresh(); WorkerStatusContainer status = e.UserState as WorkerStatusContainer; WorkerStatus = string.Format(Shoko.Commons.Properties.Resources.Rename_Changed, status.CurrentFile, status.TotalFileCount); }
void renameWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { ViewFiles.Refresh(); WorkerRunning = false; WorkerNotRunning = true; stopWorker = false; EnableDisableControls(true); }
void previewWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { ViewFiles.Refresh(); WorkerRunning = false; WorkerNotRunning = true; stopWorker = false; EnableDisableControls(true); //HideShowControls(System.Windows.Visibility.Visible); }
void btnSearch_Click(object sender, RoutedEventArgs e) { try { if (!VM_ShokoServer.Instance.ServerOnline) { return; } FileSearchCriteria searchType = FileSearchCriteria.Name; if (cboSearchType.SelectedItem.ToString() == SearchTypeHash) { searchType = FileSearchCriteria.ED2KHash; } if (cboSearchType.SelectedItem.ToString() == SearchTypeTopOneHundred) { searchType = FileSearchCriteria.LastOneHundred; } if (txtFileSearch.Text.Trim().Length == 0 && searchType != FileSearchCriteria.LastOneHundred) { MessageBox.Show(Shoko.Commons.Properties.Resources.Seach_Criteria, Shoko.Commons.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); txtFileSearch.Focus(); return; } FileResults.Clear(); ViewFiles.Refresh(); FileCount = 0; Cursor = Cursors.Wait; EnableDisableControls(false); List <VM_VideoLocal> rawVids = VM_ShokoServer.Instance.ShokoServices.SearchForFiles( (int)searchType, txtFileSearch.Text, VM_ShokoServer.Instance.CurrentUser.JMMUserID).OrderByNatural(a => a.Places.First().FilePath).CastList <VM_VideoLocal>(); foreach (VM_VideoLocal raw in rawVids) { FileResults.Add(raw); } FileCount = rawVids.Count; Cursor = Cursors.Arrow; } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { Cursor = Cursors.Arrow; EnableDisableControls(true); } }
void btnSearch_Click(object sender, RoutedEventArgs e) { try { if (!JMMServerVM.Instance.ServerOnline) { return; } FileSearchCriteria searchType = FileSearchCriteria.Name; if (cboSearchType.SelectedItem.ToString() == SearchTypeHash) { searchType = FileSearchCriteria.ED2KHash; } if (cboSearchType.SelectedItem.ToString() == SearchTypeTopOneHundred) { searchType = FileSearchCriteria.LastOneHundred; } if (txtFileSearch.Text.Trim().Length == 0 && searchType != FileSearchCriteria.LastOneHundred) { MessageBox.Show(Properties.Resources.Seach_Criteria, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); txtFileSearch.Focus(); return; } FileResults.Clear(); ViewFiles.Refresh(); FileCount = 0; this.Cursor = Cursors.Wait; EnableDisableControls(false); List <JMMServerBinary.Contract_VideoLocal> rawVids = JMMServerVM.Instance.clientBinaryHTTP.SearchForFiles( (int)searchType, txtFileSearch.Text, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); foreach (JMMServerBinary.Contract_VideoLocal raw in rawVids) { FileResults.Add(new VideoLocalVM(raw)); } FileCount = rawVids.Count; this.Cursor = Cursors.Arrow; } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { this.Cursor = Cursors.Arrow; EnableDisableControls(true); } }
void btnClearList_Click(object sender, RoutedEventArgs e) { try { FileResults.Clear(); ViewFiles.Refresh(); FileCount = 0; } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
void txtFileSearch_TextChanged(object sender, TextChangedEventArgs e) { ViewFiles.Refresh(); }
void btnLoadFiles_Click(object sender, RoutedEventArgs e) { try { if (!VM_ShokoServer.Instance.ServerOnline) { return; } ViewFiles.Refresh(); Cursor = Cursors.Wait; EnableDisableControls(false); List <VM_VideoLocal> rawVids = new List <VM_VideoLocal>(); if (LoadTypeIsRandom) { rawVids = VM_ShokoServer.Instance.ShokoServices.RandomFileRenamePreview(udRandomFiles.Value.Value, VM_ShokoServer.Instance.CurrentUser.JMMUserID).CastList <VM_VideoLocal>(); /*List<int> testIDs = new List<int>(); * * testIDs.Add(6041); // Gekijouban Bleach: Fade to Black Kimi no Na o Yobu * testIDs.Add(6784); // Fate/Stay Night: Unlimited Blade Works * testIDs.Add(5975); // Toaru Majutsu no Index * testIDs.Add(7599); // Toaru Majutsu no Index II * testIDs.Add(8694); // Gekijouban Toaru Majutsu no Index (movie) * testIDs.Add(6071); // Quiz Magic Academy: The Original Animation * testIDs.Add(4145); // Amaenaide yo!! Katsu!! * testIDs.Add(2369); // Bleach * testIDs.Add(69); // One Piece * foreach (int animeID in testIDs) * { * List<JMMServerBinary.Contract_VideoLocal> raws = VM_ShokoServer.Instance.clientBinaryHTTP.GetVideoLocalsForAnime(animeID, * VM_ShokoServer.Instance.CurrentUser.JMMUserID.Value); * * rawVids.AddRange(raws); * }*/ } if (LoadTypeIsAll) { rawVids = VM_ShokoServer.Instance.ShokoServices.RandomFileRenamePreview(int.MaxValue, VM_ShokoServer.Instance.CurrentUser.JMMUserID).CastList <VM_VideoLocal>(); } if (LoadTypeIsSeries) { Window wdw = Window.GetWindow(this); SelectGroupSeriesForm frm = new SelectGroupSeriesForm(); frm.Owner = wdw; frm.Init(); bool?result = frm.ShowDialog(); if (result.HasValue && result.Value == true) { if (frm.SelectedObject.GetType() == typeof(VM_AnimeGroup_User)) { VM_AnimeGroup_User grp = frm.SelectedObject as VM_AnimeGroup_User; foreach (VM_AnimeSeries_User ser in grp.AllAnimeSeries) { rawVids.AddRange(VM_ShokoServer.Instance.ShokoServices.GetVideoLocalsForAnime(ser.AniDB_ID, VM_ShokoServer.Instance.CurrentUser.JMMUserID).Cast <VM_VideoLocal>()); } } if (frm.SelectedObject.GetType() == typeof(VM_AnimeSeries_User)) { VM_AnimeSeries_User ser = frm.SelectedObject as VM_AnimeSeries_User; rawVids.AddRange(VM_ShokoServer.Instance.ShokoServices.GetVideoLocalsForAnime(ser.AniDB_ID, VM_ShokoServer.Instance.CurrentUser.JMMUserID).Cast <VM_VideoLocal>()); } } } foreach (VM_VideoLocal vid in rawVids) { VM_VideoLocal_Renamed ren = new VM_VideoLocal_Renamed(); ren.VideoLocalID = vid.VideoLocalID; ren.VideoLocal = vid; ren.Success = false; FileResults.Add(ren); } FileCount = FileResults.Count; Cursor = Cursors.Arrow; } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { Cursor = Cursors.Arrow; EnableDisableControls(true); } }
void btnLoadFiles_Click(object sender, RoutedEventArgs e) { try { if (!VM_ShokoServer.Instance.ServerOnline) { return; } ViewFiles.Refresh(); Cursor = Cursors.Wait; EnableDisableControls(false); List <VM_VideoLocal> rawVids = new List <VM_VideoLocal>(); if (LoadTypeIsRandom) { rawVids = VM_ShokoServer.Instance.ShokoServices .RandomFileRenamePreview(udRandomFiles.Value.Value, VM_ShokoServer.Instance.CurrentUser.JMMUserID) .CastList <VM_VideoLocal>(); } else if (LoadTypeIsAll) { rawVids = VM_ShokoServer.Instance.ShokoServices .RandomFileRenamePreview(int.MaxValue, VM_ShokoServer.Instance.CurrentUser.JMMUserID) .CastList <VM_VideoLocal>(); } else if (LoadTypeIsSeries) { Window wdw = Window.GetWindow(this); SelectGroupSeriesForm frm = new SelectGroupSeriesForm(); frm.Owner = wdw; frm.Init(); bool?result = frm.ShowDialog(); if (result.HasValue && result.Value == true) { if (frm.SelectedObject.GetType() == typeof(VM_AnimeGroup_User)) { VM_AnimeGroup_User grp = frm.SelectedObject as VM_AnimeGroup_User; foreach (VM_AnimeSeries_User ser in grp.AllAnimeSeries) { rawVids.AddRange(VM_ShokoServer.Instance.ShokoServices .GetVideoLocalsForAnime(ser.AniDB_ID, VM_ShokoServer.Instance.CurrentUser.JMMUserID) .Cast <VM_VideoLocal>()); } } if (frm.SelectedObject.GetType() == typeof(VM_AnimeSeries_User)) { VM_AnimeSeries_User ser = frm.SelectedObject as VM_AnimeSeries_User; rawVids.AddRange(VM_ShokoServer.Instance.ShokoServices .GetVideoLocalsForAnime(ser.AniDB_ID, VM_ShokoServer.Instance.CurrentUser.JMMUserID) .Cast <VM_VideoLocal>()); } } } else if (LoadTypeIsLast) { int number = udRandomFiles.Value.Value; rawVids = VM_ShokoServer.Instance.ShokoServices .SearchForFiles((int)FileSearchCriteria.LastOneHundred, number.ToString(), VM_ShokoServer.Instance.CurrentUser.JMMUserID) .OrderByDescending(a => a.DateTimeCreated) .CastList <VM_VideoLocal>(); } foreach (VM_VideoLocal vid in rawVids) { VM_VideoLocal_Renamed ren = new VM_VideoLocal_Renamed(); ren.VideoLocalID = vid.VideoLocalID; ren.VideoLocal = vid; ren.Success = false; FileResults.Add(ren); } FileCount = FileResults.Count; Cursor = Cursors.Arrow; } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { Cursor = Cursors.Arrow; EnableDisableControls(true); } }