// Start is called before the first frame update void Start() { ShowName id = ShowName.ICON1; foreach (Transform tran in transform) { IconItem ii = tran.gameObject.AddComponent <IconItem>(); ShowItem si = tran.gameObject.AddComponent <ShowItem>(); si.Init(id); id++; si.AddListener(() => { selectItem = si; iItem = ii; }); } }
public async Task GetShowsByMovieTest() { var showService = ShowService(); var name = "movieName"; var showitem = new ShowItem { Id = new ItemId(), MaxReservations = 50, Movie = "movieName", ShowDateTime = new DateTime(2010, 10, 10, 10, 10, 10) }; var showitem2 = new ShowItem { Id = new ItemId(), MaxReservations = 50, Movie = "movieName", ShowDateTime = new DateTime(2010, 10, 10, 10, 10, 10) }; var showitem3 = new ShowItem { Id = new ItemId(), MaxReservations = 50, Movie = "Bucks Bunny", ShowDateTime = new DateTime(2010, 10, 10, 10, 10, 10) }; await showService.AddAsync(showitem); await showService.AddAsync(showitem2); await showService.AddAsync(showitem3); var result = await showService.GetShowsByMovieAsync(name); result.ForEach(i => Assert.IsTrue(i.Movie.Equals(name))); ; }
private void duplicateRightClickMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { duplicateRightClickMenu.Close(); if (e.ClickedItem.Tag != null) { RightClickCommands n = (RightClickCommands)e.ClickedItem.Tag; ShowItem si = mlastSelected?.ShowItem; switch (n) { case RightClickCommands.kEpisodeGuideForShow: // epguide if (mlastSelected != null) { mainUi.GotoEpguideFor(mlastSelected.Episode, true); } else { if (si != null) { mainUi.GotoEpguideFor(si, true); } } Close(); break; case RightClickCommands.kForceRefreshSeries: if (si != null) { mainUi.ForceRefresh(new List <ShowItem> { si }); } Close(); break; case RightClickCommands.kEditShow: if (si != null) { mainUi.EditShow(si); } break; case RightClickCommands.kEditSeason: if (si != null) { mainUi.EditSeason(si, mlastSelected.SeasonNumber); } break; case RightClickCommands.kAddRule: if (mlastSelected != null) { ShowRule sr = mlastSelected.GenerateRule(); si?.AddSeasonRule(mlastSelected.SeasonNumber, sr); lvDuplicates.Items.Remove(mlastClicked); dupEps.Remove(mlastSelected); } break; default: { System.Diagnostics.Debug.Fail("Unknown right-click action " + n); break; } } } mlastSelected = null; }
private void ProcessFile([NotNull] FileInfo droppedFile) { if ((droppedFile.Attributes & FileAttributes.Directory) == FileAttributes.Directory) { Logger.Error($"{droppedFile.FullName} is a directory, ignoring."); return; } if (!droppedFile.IsMovieFile()) { Logger.Info($"{droppedFile.FullName} is not a movie file, ignoring."); return; } ShowItem bestShow = cbShowList.SelectedItem == "<Auto>" ? FinderHelper.FindBestMatchingShow(droppedFile, mDoc.Library.Shows) : mDoc.Library.Shows.FirstOrDefault(item => item.ShowName == cbShowList.SelectedItem); if (bestShow is null) { if (TVSettings.Instance.AutoAddAsPartOfQuickRename) { List <ShowItem> addedShows = FinderHelper.FindShows(new List <string> { droppedFile.Name }, mDoc); bestShow = addedShows.FirstOrDefault(); } if (bestShow is null) { Logger.Info($"Cannot find show for {droppedFile.FullName}, ignoring this file."); return; } } if (!FinderHelper.FindSeasEp(droppedFile, out int seasonNum, out int episodeNum, out int _, bestShow, out TVSettings.FilenameProcessorRE _)) { Logger.Info($"Cannot find episode for {bestShow.ShowName} for {droppedFile.FullName}, ignoring this file."); return; } SeriesInfo s = bestShow.TheSeries(); if (s is null) { //We have not downloaded the series, so have to assume that we need the episode/file Logger.Info( $"Can't rename file for {bestShow.ShowName} for {droppedFile.FullName}, as it has not been downloaded yet, ignoring this file."); return; } try { Episode ep = s.GetEpisode(seasonNum, episodeNum, bestShow.DvdOrder); ProcessedEpisode episode = new ProcessedEpisode(ep, bestShow); string filename = TVSettings.Instance.FilenameFriendly( TVSettings.Instance.NamingStyle.NameFor(episode, droppedFile.Extension, droppedFile.DirectoryName.Length)); FileInfo targetFile = new FileInfo(droppedFile.DirectoryName + Path.DirectorySeparatorChar + filename); if (droppedFile.FullName == targetFile.FullName) { Logger.Info( $"Can't rename file for {bestShow.ShowName} for {droppedFile.FullName}, as it already has the appropriate name."); return; } mDoc.TheActionList.Add(new ActionCopyMoveRename(droppedFile, targetFile, episode)); // if we're copying/moving a file across, we might also want to make a thumbnail or NFO for it mDoc.TheActionList.AddRange(new DownloadIdentifiersController().ProcessEpisode(episode, targetFile)); //If keep together is active then we may want to copy over related files too if (TVSettings.Instance.KeepTogether) { FileFinder.KeepTogether(mDoc.TheActionList, false, true); } } catch (SeriesInfo.EpisodeNotFoundException) { Logger.Info( $"Can't rename file for {bestShow.ShowName} for {droppedFile.FullName}, as it does not have Episode {episodeNum} for Season {seasonNum}."); } }
public static string WebsiteShowUrl([NotNull] ShowItem si) { return(string.IsNullOrWhiteSpace(si.TheSeries()?.Slug) ? WebsiteShowUrl(si.TvdbCode) : WebsiteShowUrl(si.TheSeries()?.Slug)); }
public void duplicateRightClickMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { this.duplicateRightClickMenu.Close(); if (e.ClickedItem.Tag != null) { RightClickCommands n = (RightClickCommands)e.ClickedItem.Tag; ShowItem si = this.mlastSelected?.ShowItem; switch (n) { case RightClickCommands.kEpisodeGuideForShow: // epguide if (this.mlastSelected != null) { this.mainUI.GotoEpguideFor(this.mlastSelected.Episode, true); } else { if (si != null) { this.mainUI.GotoEpguideFor(si, true); } } Close(); break; case RightClickCommands.kForceRefreshSeries: if (si != null) { this.mainUI.ForceRefresh(new List <ShowItem> { this.mlastSelected.ShowItem }); } Close(); break; case RightClickCommands.kEditShow: if (si != null) { this.mainUI.EditShow(si); } break; case RightClickCommands.kEditSeason: if (si != null) { this.mainUI.EditSeason(si, this.mlastSelected.SeasonNumber); } break; case RightClickCommands.kAddRule: ShowRule sr = new ShowRule(); sr.DoWhatNow = RuleAction.kMerge; sr.First = this.mlastSelected.episodeOne.AppropriateEpNum; sr.Second = this.mlastSelected.episodeTwo.AppropriateEpNum; si?.AddSeasonRule(this.mlastSelected.SeasonNumber, sr); this.lvDuplicates.Items.Remove(this.mlastClicked); this.dupEps.Remove(this.mlastSelected); break; default: { /* if ((n >= RightClickCommands.kWatchBase) && (n < RightClickCommands.kOpenFolderBase)) * { * int wn = n - RightClickCommands.kWatchBase; * if ((this.mLastFL != null) && (wn >= 0) && (wn < this.mLastFL.Count)) * Helpers.SysOpen(this.mLastFL[wn].FullName); * } * else if (n >= RightClickCommands.kOpenFolderBase) * { * int fnum = n - RightClickCommands.kOpenFolderBase; * * if (fnum < this.mFoldersToOpen.Count) * { * string folder = this.mFoldersToOpen[fnum]; * * if (Directory.Exists(folder)) * Helpers.SysOpen(folder); * } * * return; * } * else*/ System.Diagnostics.Debug.Fail("Unknown right-click action " + n); break; } } } this.mlastSelected = null; }
public async Task <bool> PostShow(ShowItem showItem) { var showService = _showServiceFactory.Get(showItem.Id.GetPartitionKey()); return(await showService.AddAsync(showItem)); }
public bool Filter(ShowItem si, Season sea) { return(!HideIgnoredSeasons || !si.IgnoreSeasons.Contains(sea.SeasonNumber)); }
private void AddShow(ShowItem si) { AddShow(si.ShowName, si.ShowDirectory); }
static void Main(string[] args) { User temporaryUser = new User(); bool isActive = true; string key; do { Console.Clear(); Console.WriteLine("1. Зарегистрировать пользователя \n2. Войти в личный кабинет \n3. Поиск \n4. Просмотреть весь каталог товаров \n5. Выход"); key = Console.ReadLine(); switch (key) { case "1": { Console.Clear(); User user = new User(); AccountRegistration registration = new AccountRegistration(); registration.Registration(user); } break; case "2": { Console.Clear(); LogIn login = new LogIn(); login.LogInChecker(temporaryUser); if (temporaryUser.IsLogged == true) { Console.Clear(); Console.WriteLine("1. Корзина \n2. История покупок \n3. Выйти из аккаунта \n4. Назад в главное меню"); string action; bool basketIsExit = false; action = Console.ReadLine(); switch (action) { case "1": { Console.WriteLine("Реализовано только в подкюченном режиме"); } break; case "2": { Console.WriteLine("Реализовано только в подкюченном режиме"); } break; case "3": { login.LogOut(temporaryUser); } break; case "4": { break; } break; } Console.ReadKey(); } else { Console.WriteLine("Для доступа в личный кабинет нужно авторизоваться в системе"); Console.ReadKey(); } } break; case "3": { int pageSize = 3; int pageNumber = 0; bool exit = false; FindItem find = new FindItem(); Console.WriteLine("Введите название товара"); string itemName = Console.ReadLine(); while (!exit) { Console.Clear(); try { var result = find.FindItems(itemName, pageSize, pageNumber); foreach (var item in result) { Console.WriteLine(item.Name); Console.WriteLine(item.Price); Console.WriteLine(item.Description); Console.WriteLine("--------------------------------------------------"); } } catch (ArgumentOutOfRangeException exception) { Console.WriteLine("Ошибка! Чтобы продолжить просмотр листайте вперед"); } Console.WriteLine("1. Следующая страница \n2. Предыдущая страница \n3. Выход"); string action = Console.ReadLine(); if (action == "1") { pageNumber++; } else if (action == "2") { pageNumber--; } else if (action == "3") { exit = true; } } } break; case "4": { int pageSize = 3; int pageNumber = 0; bool exit = false; int i = 1; ShowItem show = new ShowItem(); while (!exit) { Console.Clear(); try { var result = show.ShowItems(pageSize, pageNumber); foreach (var item in result) { Console.WriteLine("Наименование товара: " + item.Name); Console.WriteLine("Цена: " + item.Price); Console.WriteLine("Описание товара: " + item.Description); Console.WriteLine("--------------------------------------------------"); i++; } } catch (ArgumentOutOfRangeException exception) { Console.WriteLine("Ошибка! Чтобы продолжить просмотр листайте вперед"); } Console.WriteLine("1. Следующая страница \n2. Предыдущая страница \n3. Выход"); string action = Console.ReadLine(); if (action == "1") { pageNumber++; } else if (action == "2") { pageNumber--; } else if (action == "3") { exit = true; } } } break; case "5": { isActive = false; } break; } } while (isActive != false); }
public async Task <bool> AddAsync(ShowItem item) { return(await _showRepository.AddAsync(item)); }
private static bool IsShowBookedOut(ShowItem show) { return(show.MaxReservations <= show.Reservations.Count); }
private static bool IsReservationAfterShow(ShowItem show, ReservationItem reservationItem) { return(show.ShowDateTime.ToUniversalTime() < reservationItem.ReservationDateTime?.ToUniversalTime()); }
private static bool IsInvalidShow(ReservationItem reservation, ShowItem show) { return(show == null || IsReservationAfterShow(show, reservation) || IsShowBookedOut(show)); }
/// <summary> /// Returns true if any changes were made to the list. /// </summary> public static bool ShowList <T>(IList <T> list, ShowItem <T> showItemDelegate, float viewWidth, ShowListOptions options = ShowListOptions.Reorderable | ShowListOptions.Resizeable | ShowListOptions.Resizeable | ShowListOptions.ShowListSize, int minListSize = 0, int maxListSize = int.MaxValue) where T : new() { // To avoid clipping by vertical scrollbar viewWidth -= 20f; int indexToDelete = -1; int indexToMoveUp = -1; int indexToMoveDown = -1; int listCount = list.Count; var oddStyle = new GUIStyle(); oddStyle.normal.background = blackQuarterAlphaTexture2D; EditorGUI.indentLevel++; var listStyle = new GUIStyle(); listStyle.margin = new RectOffset(0, 0, 10, 0); listStyle.imagePosition = ImagePosition.ImageLeft; EditorGUILayout.BeginVertical(listStyle); if ((options & ShowListOptions.ShowListSize) == ShowListOptions.ShowListSize) { EditorGUILayout.LabelField(new GUIContent("Size: " + listCount), EditorUtils.boldLabelStyle); EditorGUILayout.Separator(); } GUI.changed = false; for (int i = 0; i < listCount; ++i) { var item = list[i]; //------------ // Show Item //------------ if (i % 2 == 0) { EditorGUILayout.BeginHorizontal(); } else { EditorGUILayout.BeginHorizontal(oddStyle); } EditorGUILayout.BeginVertical(GUILayout.Width(viewWidth * 0.94f)); var visible = showItemDelegate(item, i); EditorGUILayout.EndVertical(); //----------------------- // List Manipulation EditorGUILayout.BeginVertical(GUILayout.Width(viewWidth * 0.05f)); if (visible) { if ((options & ShowListOptions.Resizeable) == ShowListOptions.Resizeable) { GUI.enabled = (listCount > minListSize); if (GUILayout.Button("X", "toolbarbutton", GUILayout.ExpandWidth(false))) { indexToDelete = i; } } if ((options & ShowListOptions.Reorderable) == ShowListOptions.Reorderable) { GUI.enabled = (i < listCount - 1); if (GUILayout.Button("\u25BC", EditorStyles.toolbarButton, GUILayout.Width(18))) { indexToMoveDown = i; } GUI.enabled = i > 0; if (GUILayout.Button("\u25B2", EditorStyles.toolbarButton, GUILayout.Width(18))) { indexToMoveUp = i; } } } GUI.enabled = true; EditorGUILayout.EndVertical(); // End List Manipulation //----------------------- EditorGUILayout.EndHorizontal(); } bool itemsChanged = false; if (listCount < maxListSize && (options & ShowListOptions.Resizeable) == ShowListOptions.Resizeable) { if (GUILayout.Button("Add", EditorStyles.toolbarButton, GUILayout.Width(50))) { var newItem = default(T); if (newItem == null) { newItem = new T(); } list.Add(newItem); itemsChanged = true; } } EditorGUILayout.EndVertical(); EditorGUI.indentLevel--; if (indexToDelete >= 0 && listCount > minListSize) { list.RemoveAt(indexToDelete); itemsChanged = true; } if (indexToMoveUp >= 0) { Swap(list, indexToMoveUp, indexToMoveUp - 1); itemsChanged = true; } if (indexToMoveDown >= 0) { Swap(list, indexToMoveDown, indexToMoveDown + 1); itemsChanged = true; } return(itemsChanged || GUI.changed); } // ShowList<T>()
public Task <bool> AddAsync(ShowItem item) { return(AddFunc(item)); }