private static void FileThumbItem(ThumbItem thumbItem, XXX item) { if (item == null) { return; } thumbItem.Added = item.AddedDate; thumbItem.Cover = item.Cover; thumbItem.Deleted = item.IsDeleted; thumbItem.Description = item.Description; if (item.Cover != null) { thumbItem.HasCover = true; } else { thumbItem.Cover = Util.CreateCover(item.Title); thumbItem.HasCover = false; } thumbItem.IsComplete = item.IsComplete; thumbItem.Media = item.Media.Name; thumbItem.Name = item.Title; thumbItem.MyRating = item.MyRating / 4; thumbItem.ReleaseDate = item.ReleaseDate; thumbItem.Runtime = item.Runtime; thumbItem.Seen = item.Watched; thumbItem.ToBeDeleted = item.ToBeDeleted; thumbItem.ToBuy = item.IsWhish; thumbItem.ToWatch = item.ToWatch; }
void OnPlay(object sender, ExecutedRoutedEventArgs args) { try { if (args != null) { if (args.Parameter != null) { if (args.Parameter.GetType() == typeof(ThumbItem)) { ThumbItem item = args.Parameter as ThumbItem; string results = CommonServices.OpenFile(item); if (string.IsNullOrWhiteSpace(results) == false) { new MessageBoxYesNo(results, false, true).ShowDialog(); } } } else { string results = CommonServices.OpenFile(MainStack.SelectedItem as ThumbItem); if (string.IsNullOrWhiteSpace(results) == false) { new MessageBoxYesNo(results, false, true).ShowDialog(); } } } } catch (Exception ex) { CatchException(ex); } }
void worker_DoWork(object sender, DoWorkEventArgs e) { try { Total = _objEntity.Count(); IServices service = null; //Fix Since 2.5.5.0 for (int i = 0; i < _objEntity.Count(); i++) { ThumbItem item = _objEntity.ElementAt(i); if (_isCancelationPending == true) { break; } if (service == null) { service = Util.GetService(item.EType); } IMyCollectionsData currentItem = service.Get(item.Id); service.GetInfoFromWeb(currentItem); service.Add(currentItem); Current++; } } catch (Exception ex) { Util.LogException(ex); } }
private void mniGenerateTvix_Click(object sender, RoutedEventArgs e) { Cursor = Cursors.Wait; string strTvixOutput; if (Convert.ToBoolean(MySettings.TvixInFolder) == true) { strTvixOutput = string.Empty; } else { strTvixOutput = MySettings.TvixOutput; } ThumbItem item = CoverFlow.SelectedItem as ThumbItem; if (item != null) { ThemeServices.CreateFiles(item.Id, strTvixOutput, item.EType); } if (string.IsNullOrEmpty(strTvixOutput)) { new MessageBoxYesNo("1 layout generated", false, false).ShowDialog(); } else { new MessageBoxYesNo("1 layout generated in " + strTvixOutput, false, false).ShowDialog(); } Cursor = null; }
private void mniLoanInfo_Click(object sender, RoutedEventArgs e) { Cursor = Cursors.Wait; ThumbItem thumbitem = MainStack.SelectedItem as ThumbItem; new LoanTo(thumbitem).Show(); Cursor = null; }
private void mniOpenSelected_Click(object sender, RoutedEventArgs e) { ThumbItem item = MainStack.SelectedItem as ThumbItem; string results = CommonServices.OpenFile(item); if (string.IsNullOrWhiteSpace(results) == false) { new MessageBoxYesNo(results, false, true).ShowDialog(); } }
public static bool ViewNotComplete(object item) { ThumbItem thumitem = item as ThumbItem; if (thumitem != null && (thumitem.IsComplete == false && thumitem.Deleted == false)) { return(true); } else { return(false); } }
public static bool WithoutCover(object item) { ThumbItem thumitem = item as ThumbItem; if (thumitem != null && (thumitem.HasCover == false && thumitem.Deleted == false)) { return(true); } else { return(false); } }
public static bool ViewToBuy(object item) { ThumbItem thumitem = item as ThumbItem; if (thumitem != null && (thumitem.ToBuy == true && thumitem.Deleted == false)) { return(true); } else { return(false); } }
public static void LaunchDocument(ThumbItem item) { string manualPath; using (ThumbGroup thumbGroup = new ThumbGroup(item)) manualPath = thumbGroup.ManualPath; if (string.IsNullOrEmpty(manualPath)) return; using (Process proc = new Process()) { proc.StartInfo = new ProcessStartInfo(); proc.StartInfo.FileName = manualPath; proc.Start(); } }
private void mniSetBack_Click(object sender, RoutedEventArgs e) { Cursor = Cursors.Wait; ThumbItem thumbitem = MainStack.SelectedItem as ThumbItem; if (thumbitem != null) { int intResults = LoanServices.SetBackLoan(new Collection <string> { thumbitem.Id }); RoutedEventArgs args = new RoutedEventArgs(SaveEvent); RaiseEvent(args); new MessageBoxYesNo(intResults.ToString(CultureInfo.InvariantCulture) + " item are back from loan", false, false).ShowDialog(); } Cursor = null; }
void OnEdit(object sender, ExecutedRoutedEventArgs args) { if (args != null) { if (args.Parameter != null) { if (args.Parameter.GetType() == typeof(ThumbItem)) { ThumbItem item = args.Parameter as ThumbItem; UpdateItem(item); } } else { UpdateItem(MainStack.SelectedItem as ThumbItem); } } }
void OnDelete(object sender, ExecutedRoutedEventArgs args) { if (args != null) { if (args.Parameter != null) { if (args.Parameter.GetType() == typeof(ThumbItem)) { ThumbItem toDelete = args.Parameter as ThumbItem; DeleteItem(new List <ThumbItem> { toDelete }); } } else { DeleteItem(new List <ThumbItem> { MainStack.SelectedItem as ThumbItem }); } } }
private static void FileThumbItem(ThumbItem thumbItem, Music item) { thumbItem.Added = item.AddedDate; thumbItem.Cover = item.Cover; thumbItem.Deleted = item.IsDeleted; thumbItem.Description = item.Comments; if (item.Cover != null) { thumbItem.HasCover = true; } else { thumbItem.Cover = Util.CreateCover(item.Title); thumbItem.HasCover = false; } thumbItem.IsComplete = item.IsComplete; thumbItem.Media = item.Media.Name; thumbItem.Name = item.Title; thumbItem.MyRating = item.MyRating / 4; thumbItem.ReleaseDate = item.ReleaseDate; thumbItem.Runtime = item.Runtime; thumbItem.Seen = item.Watched; thumbItem.ToBeDeleted = item.ToBeDeleted; thumbItem.ToBuy = item.IsWhish; thumbItem.ToWatch = item.ToWatch; Artist artist = (from items in item.Artists select items).FirstOrDefault <Artist>(); string name = string.Empty; if (artist != null) { name = artist.FirstName + " " + artist.LastName; } thumbItem.Artist = name; }
private static void FileThumbItem(ThumbItem thumbItem, SeriesSeason item) { //Fix Since 2.6.7.0 if (item == null) { return; } thumbItem.Added = item.AddedDate; thumbItem.Cover = item.Cover; thumbItem.Deleted = item.IsDeleted; thumbItem.Description = item.Description; thumbItem.Name = item.Title + " - s" + item.Season.ToString(CultureInfo.InvariantCulture); if (item.Cover != null) { thumbItem.HasCover = true; } else { thumbItem.Cover = Util.CreateCover(item.Title); thumbItem.HasCover = false; } thumbItem.IsComplete = item.IsComplete; if (item.Media != null) { thumbItem.Media = item.Media.Name; } thumbItem.Name = item.Title; thumbItem.MyRating = item.MyRating / 4; //thumbItem.PublicRating = item.MyRating/4; thumbItem.ReleaseDate = item.ReleaseDate; thumbItem.Runtime = item.Runtime; thumbItem.Seen = item.Watched; thumbItem.ToBeDeleted = item.ToBeDeleted; thumbItem.ToBuy = item.IsWhish; thumbItem.ToWatch = item.ToWatch; }
private void UpdateItem(ThumbItem thumbItem) { try { bool?saved = false; if (thumbItem != null && thumbItem.EType == EntityType.Artist) { Task.Factory.StartNew(() => Util.NotifyEvent("ArtistDetail:" + thumbItem.Name)); ArtistDetail artistdetail = new ArtistDetail(thumbItem.Name, thumbItem.EType); saved = artistdetail.ShowDialog(); } if (saved == true) { RoutedEventArgs args = new RoutedEventArgs(SaveEventVp); RaiseEvent(args); } } catch (Exception ex) { CatchException(ex); } }
public LoanTo(ThumbItem thumbitem) { InitializeComponent(); if (thumbitem == null) { return; } _strId = thumbitem.Id; _selectedItems = thumbitem.EType; cboAlias.ItemsSource = FriendServices.Gets(); cboAlias.DisplayMemberPath = "Alias"; imgTitle.Source = Util.CreateSmallImage(thumbitem.Cover); lblTitle.Text = thumbitem.Name; Loan objLoan = LoanServices.Get(_strId); if (objLoan != null) { txtEndDate.Text = objLoan.EndDate.ToShortDateString(); //Fix since 2.7.12.0 if (objLoan.Friend != null) { cboAlias.Text = objLoan.Friend.Alias; } txtStartDate.Text = objLoan.StartDate.ToShortDateString(); } else { txtStartDate.Text = DateTime.Now.ToShortDateString(); txtEndDate.Text = DateTime.Now.AddDays(10).ToShortDateString(); } }
private void mniSendKindle_OnClick(object sender, RoutedEventArgs e) { Cursor = Cursors.Wait; Task.Factory.StartNew(() => Util.NotifyEvent("SendKindle")); try { EBookReaderDevices reader = EBookReaderServices.GetReader(); if (reader != null) { ThumbItem item = MainStack.SelectedItems[0] as ThumbItem; if (item != null) { bool results = EBookReaderServices.CopyToReader(reader, item.Id); if (results == true) { new MessageBoxYesNo(item.Name + " " + ((App)Application.Current).LoadedLanguageResourceDictionary["CopyKindleOK"], false, false).ShowDialog(); } else { new MessageBoxYesNo(((App)Application.Current).LoadedLanguageResourceDictionary["CopyKindleKO"].ToString(), false, false).ShowDialog(); } } } else { new MessageBoxYesNo(((App)Application.Current).LoadedLanguageResourceDictionary["NoKindle"].ToString(), false, false).ShowDialog(); } } catch (Exception ex) { CatchException(ex); } Cursor = null; }
public static bool ViewAll(object item) { ThumbItem thumitem = item as ThumbItem; return(thumitem != null && !thumitem.Deleted); }
/// <summary> /// Initialises a new ThumbGroup with the thumbs of the specified parent /// </summary> /// <param name="parent">An Emulator or Game</param> public ThumbGroup(ThumbItem parent) { if (parent == null) throw new ArgumentException("The parent item cannot be null", "parent"); Options options = EmulatorsCore.Options; options.EnterReadLock(); bool doResize = options.ResizeGameart; maxThumbDimension = EmulatorsCore.Options.MaxImageDimensions; string imageDirectory = options.ImageDirectory; options.ExitReadLock(); string thumbFolder = parent.ThumbFolder; if (doResize) thumbAspect = parent.AspectRatio; parentItem = parent; lock (parent.SyncRoot) { if (parent.Id != null) thumbPath = string.Format(@"{0}\{1}\{2}\{3}\", imageDirectory, THUMB_DIR_NAME, thumbFolder, parent.Id); } //init Thumbs logo = new Thumb(ThumbType.Logo); frontCover = new Thumb(ThumbType.FrontCover); backCover = new Thumb(ThumbType.BackCover); titleScreen = new Thumb(ThumbType.TitleScreen); inGame = new Thumb(ThumbType.InGameScreen); fanart = new Thumb(ThumbType.Fanart); //load the paths/images loadThumbs(); }
private void UpdateItem(ThumbItem thumbItem) { try { bool?saved = false; switch (thumbItem.EType) { case EntityType.Apps: AppsUpdate objAppsDetails = new AppsUpdate(); objAppsDetails.ItemsId = thumbItem.Id; saved = objAppsDetails.ShowDialog(); break; case EntityType.Books: BookUpdate objBookDetails = new BookUpdate(); objBookDetails.ItemsId = thumbItem.Id; saved = objBookDetails.ShowDialog(); break; case EntityType.Games: GameUpdate objGameDetails = new GameUpdate(); objGameDetails.ItemsId = thumbItem.Id; saved = objGameDetails.ShowDialog(); break; case EntityType.Movie: MovieUpdate objMovieDetails = new MovieUpdate(); objMovieDetails.ItemsId = thumbItem.Id; saved = objMovieDetails.ShowDialog(); break; case EntityType.Music: MusicUpdate objMusicDetails = new MusicUpdate(); objMusicDetails.ItemsId = thumbItem.Id; saved = objMusicDetails.ShowDialog(); break; case EntityType.Nds: NdsUpdate objNdsDetails = new NdsUpdate(); objNdsDetails.ItemsId = thumbItem.Id; saved = objNdsDetails.ShowDialog(); break; case EntityType.Series: SerieUpdate objSerieDetails = new SerieUpdate(); objSerieDetails.ItemsId = thumbItem.Id; saved = objSerieDetails.ShowDialog(); break; case EntityType.XXX: XxxUpdate objXxxDetails = new XxxUpdate(); objXxxDetails.ItemsId = thumbItem.Id; saved = objXxxDetails.ShowDialog(); break; } if (saved == true) { RoutedEventArgs args = new RoutedEventArgs(SaveEventCf); RaiseEvent(args); } } catch (Exception ex) { CatchException(ex); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { string tooltip = string.Empty; ThumbItem item = value as ThumbItem; if (item != null) { Order currentOrder = ((App)Application.Current).CurrentOrder; switch (currentOrder) { case Order.Name: tooltip = item.Name; break; case Order.Added: tooltip = string.Format(@"{0} - {1}", item.Name, item.Added.ToShortDateString()); break; case Order.Runtime: int?time = item.Runtime; if (time == null) { return(item.Name); } string runtime; TimeSpan ts = TimeSpan.FromSeconds((int)time); if (ts.Hours <= 0) { runtime = String.Format("{0}:{1:D2}", ts.Minutes, ts.Seconds); } else { runtime = String.Format("{0}:{1}:{2:D2}", ts.Hours, ts.Minutes, ts.Seconds); } tooltip = string.Format(@"{0} - {1}", item.Name, runtime); break; case Order.Media: tooltip = string.Format(@"{0} - {1}", item.Name, item.Media); break; case Order.MyRating: tooltip = string.Format(@"{0} - {1}", item.Name, item.MyRating * 4); break; case Order.Artist: tooltip = string.Format(@"{0} - {1}", item.Name, item.Artist); break; case Order.Type: tooltip = string.Format(@"{0} - {1}", item.Name, item.Type); break; case Order.PublicRating: if (item.PublicRating != null) { tooltip = string.Format(@"{0} - {1}", item.Name, item.PublicRating * 4); } else { return(item.Name); } break; case Order.NumId: if (item.NumId != null) { tooltip = string.Format(@"{0} - {1}", item.Name, item.NumId); } else { return(item.Name); } break; default: throw new ArgumentOutOfRangeException(); } } return(tooltip); }
private void UpdateItem(ThumbItem thumbItem) { try { if (thumbItem == null) { return; } bool?saved = false; switch (thumbItem.EType) { case EntityType.Apps: AppsUpdate objAppsDetails = new AppsUpdate(); objAppsDetails.ItemsId = thumbItem.Id; saved = objAppsDetails.ShowDialog(); if (saved == true) { Apps apps = new AppServices().Get(thumbItem.Id) as Apps; FileThumbItem(thumbItem, apps); } break; case EntityType.Artist: Task.Factory.StartNew(() => Util.NotifyEvent("ArtistDetail:" + thumbItem.Name)); ArtistDetail artistDetails = new ArtistDetail(thumbItem.Name, thumbItem.EType); saved = artistDetails.ShowDialog(); break; case EntityType.Books: BookUpdate objBookDetails = new BookUpdate(); objBookDetails.ItemsId = thumbItem.Id; saved = objBookDetails.ShowDialog(); if (saved == true) { Books books = new BookServices().Get(thumbItem.Id) as Books; FileThumbItem(thumbItem, books); } break; case EntityType.Games: GameUpdate objGameDetails = new GameUpdate(); objGameDetails.ItemsId = thumbItem.Id; saved = objGameDetails.ShowDialog(); if (saved == true) { Gamez games = new GameServices().Get(thumbItem.Id) as Gamez; FileThumbItem(thumbItem, games); } break; case EntityType.Movie: MovieUpdate objMovieDetails = new MovieUpdate(); objMovieDetails.ItemsId = thumbItem.Id; saved = objMovieDetails.ShowDialog(); if (saved == true) { Movie movie = new MovieServices().Get(thumbItem.Id) as Movie; FileThumbItem(thumbItem, movie); } break; case EntityType.Music: MusicUpdate objMusicDetails = new MusicUpdate(); objMusicDetails.ItemsId = thumbItem.Id; saved = objMusicDetails.ShowDialog(); if (saved == true) { Music music = new MusicServices().Get(thumbItem.Id) as Music; FileThumbItem(thumbItem, music); } break; case EntityType.Nds: NdsUpdate objNdsDetails = new NdsUpdate(); objNdsDetails.ItemsId = thumbItem.Id; saved = objNdsDetails.ShowDialog(); if (saved == true) { Nds nds = new NdsServices().Get(thumbItem.Id) as Nds; FileThumbItem(thumbItem, nds); } break; case EntityType.Series: Main main = Util.TryFindParent <Main>(this); main.NewSeasonAdded = false; SerieUpdate objSerieDetails = new SerieUpdate(); objSerieDetails.ItemsId = thumbItem.Id; saved = objSerieDetails.ShowDialog(); main.NewSeasonAdded = objSerieDetails.NewSeasonAdded; if (objSerieDetails.NewSeasonAdded == true) { saved = true; } if (saved == true) { SeriesSeason serie = new SerieServices().Get(thumbItem.Id) as SeriesSeason; FileThumbItem(thumbItem, serie); } break; case EntityType.XXX: XxxUpdate objXxxDetails = new XxxUpdate(); objXxxDetails.ItemsId = thumbItem.Id; saved = objXxxDetails.ShowDialog(); if (saved == true) { XXX xxx = new XxxServices().Get(thumbItem.Id) as XXX; FileThumbItem(thumbItem, xxx); } break; } _currentItem = thumbItem; if (saved == true) { RoutedEventArgs args = new RoutedEventArgs(UpdateEvent); RaiseEvent(args); Cursor = null; ShowVisibleItems(MainStack); } } catch (Exception ex) { CatchException(ex); } }
public static string OpenFile(ThumbItem item) { string results = String.Empty; if (item != null) { string strPath = String.Empty; bool bLaunched = false; IServices service = Util.GetService(item.EType); IMyCollectionsData currentItem = service.Get(item.Id); if (currentItem != null) { switch (item.EType) { case EntityType.Music: string fullpath = Path.Combine(currentItem.FilePath, currentItem.FileName); strPath = fullpath; if (Directory.Exists(fullpath)) { string[] strFiles = Util.GetFiles(fullpath, new List <string> { "*.mp3", "*.flc" }); if (strFiles.Any()) { string filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "play.m3u"); //FIX 2.8.9.0 using (StreamWriter file = new StreamWriter(filePath, false, Encoding.Default)) { foreach (string music in strFiles) { file.WriteLine(music); } file.Close(); } Process.Start(filePath); bLaunched = true; } else { results = "Can't find any mp3 or flc"; } } else if (File.Exists(fullpath)) { Process.Start(fullpath); bLaunched = true; } else { results = "Can't find any mp3 or flc"; } break; case EntityType.Apps: case EntityType.Books: case EntityType.Games: case EntityType.Nds: if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false || String.IsNullOrWhiteSpace(currentItem.FileName) == false) { if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false && String.IsNullOrWhiteSpace(currentItem.FileName) == false) { strPath = Path.Combine(currentItem.FilePath, currentItem.FileName); } if (String.IsNullOrWhiteSpace(currentItem.FilePath) == true && String.IsNullOrWhiteSpace(currentItem.FileName) == false) { strPath = currentItem.FileName; } if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false && String.IsNullOrWhiteSpace(currentItem.FileName) == true) { strPath = currentItem.FilePath; } if (Directory.Exists(strPath) == true || File.Exists(strPath) == true) { Process.Start(strPath); bLaunched = true; } } break; case EntityType.Movie: case EntityType.XXX: if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false || String.IsNullOrWhiteSpace(currentItem.FileName) == false) { if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false && String.IsNullOrWhiteSpace(currentItem.FileName) == false) { strPath = Path.Combine(currentItem.FilePath, currentItem.FileName); } if (String.IsNullOrWhiteSpace(currentItem.FilePath) == true && String.IsNullOrWhiteSpace(currentItem.FileName) == false) { strPath = currentItem.FileName; } if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false && String.IsNullOrWhiteSpace(currentItem.FileName) == true) { strPath = currentItem.FilePath; } if (Directory.Exists(strPath) == true && File.Exists(strPath) == false) { string[] strFiles = Util.GetFiles(strPath, new List <string> { "*.avi", "*.mkv", "*.mov", "*.divx" }); if (strFiles.Any()) { strPath = Path.Combine(strPath, strFiles[0]); } } if (Directory.Exists(strPath) == true || File.Exists(strPath) == true) { Process.Start(strPath); bLaunched = true; } } break; case EntityType.Series: if (Directory.Exists(currentItem.FilePath)) { string[] strFiles = Util.GetFiles(currentItem.FilePath, new List <string> { "*.avi", "*.mkv", "*.mov", "*.divx" }); if (strFiles.Any()) { SelectFile objWindow = new SelectFile(strFiles); objWindow.ShowDialog(); if (String.IsNullOrEmpty(objWindow.SelectedValue) == false) { Process.Start(objWindow.SelectedValue); } bLaunched = true; } else { results = "Can't find any avi or mkv"; } } else { results = "Can't file path : " + currentItem.FilePath; } break; } } if (bLaunched == false && String.IsNullOrWhiteSpace(results)) { results = "Can't find path : " + strPath; } } return(results); }
private static void FileThumbItem(ThumbItem thumbItem, Movie item) { //Fix v2.5 if (item == null) { return; } thumbItem.Added = item.AddedDate; thumbItem.Cover = item.Cover; thumbItem.Deleted = item.IsDeleted; thumbItem.Description = item.Description; if (item.Cover != null) { thumbItem.HasCover = true; } else { thumbItem.Cover = Util.CreateCover(item.Title); thumbItem.HasCover = false; } thumbItem.IsComplete = item.IsComplete; if (item.Media != null) { thumbItem.Media = item.Media.Name; } thumbItem.Name = item.Title; thumbItem.OriginalTitle = item.OriginalTitle; double?publicRating = null; double alloCine = -1; double imdb = -1; if (string.IsNullOrWhiteSpace(item.AlloCine) == false) { double.TryParse(item.AlloCine, NumberStyles.Float, new CultureInfo("fr-FR"), out alloCine); } if (string.IsNullOrWhiteSpace(item.Imdb) == false) { double.TryParse(item.Imdb, out imdb); } if (imdb >= 0 && alloCine >= 0) { publicRating = (imdb + alloCine) / 2; } else if (imdb >= 0) { publicRating = imdb; } else if (alloCine >= 0) { publicRating = alloCine; } thumbItem.PublicRating = publicRating / 4; double?myRating = item.MyRating; thumbItem.MyRating = myRating / 4; thumbItem.ReleaseDate = item.ReleaseDate; thumbItem.Runtime = item.Runtime; thumbItem.Seen = item.Watched; thumbItem.ToBeDeleted = item.ToBeDeleted; thumbItem.ToBuy = item.IsWhish; thumbItem.ToWatch = item.ToWatch; }