//Loading the view along with the data to be displayed public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state) { int id = 0; if (parameter != null) { id = (int)parameter; } var service = new MovieService(); Movie = await service.GetMovieAsync(id); var credits = await service.GetMovieCastAndCrewAsync(id); foreach (Cast c in credits.cast) { Casts.Add(c); } foreach (Crew c in credits.crew) { Crews.Add(c); } await base.OnNavigatedToAsync(parameter, mode, state); }
public BattleUnitsStack(Unit _unitsType, uint _unitsCount) { unitsType = _unitsType; if (_unitsCount > MAXSIZE) { throw new UnitsStackOverflowException($"Trying to make battle stack of \"{unitsType.type}\" with {_unitsCount} units.\nBattleUnitsStack.MAXSIZE = {MAXSIZE}"); } totalHitPoints = unitsType.hitPoints * _unitsCount; state = State.NotMadeMove; fightedBack = false; initHitPoints = totalHitPoints; _metaUnit = new BattleUnit(_unitsType); foreach (var effect in _unitsType.Effects) { AddEffect(effect, double.PositiveInfinity); } GetLastEffect()?.Init(); foreach (var cast in _unitsType.Casts) { Casts.Add(cast); } parentArmy = null; }
public BattleUnitsStack(BattleUnitsStack otherStack) { unitsType = otherStack.unitsType; totalHitPoints = otherStack.totalHitPoints; state = otherStack.state; fightedBack = otherStack.fightedBack; initHitPoints = otherStack.initHitPoints; _metaUnit = new BattleUnit(otherStack.metaUnit); foreach (IModifier mod in otherStack.Modifiers.Keys) { Modifiers.Add(mod, (double)otherStack.Modifiers[mod]); } foreach (BaseEffect effect in otherStack.Effects.Keys) { AddEffect(effect, double.PositiveInfinity); } GetLastEffect()?.Init(); foreach (var cast in otherStack.Casts) { Casts.Add(cast); } parentArmy = otherStack.parentArmy; }
//Loading the view along with the data to be displayed public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state) { int id = 0; if (parameter != null) { id = (int)parameter; } var service = new MovieService(); Series = await service.GetSeriesAsync(id); var credits = await service.GetSeriesCastAndCrewAsync(id); foreach (Cast c in credits.cast) { Casts.Add(c); } foreach (Crew c in credits.crew) { Crews.Add(c); } for (int i = 0; i < Series.number_of_seasons; i++) { var season = await service.GetSeasonEpisodesAsync(id, i); Seasons.Add(season); } await base.OnNavigatedToAsync(parameter, mode, state); }
public BattleUnitsStack(UnitsStack otherStack) { unitsType = otherStack.unitsType; totalHitPoints = otherStack.unitsCount * unitsType.hitPoints; state = State.NotMadeMove; fightedBack = false; initHitPoints = totalHitPoints; _metaUnit = new BattleUnit(otherStack.unitsType); foreach (BaseEffect effect in otherStack.unitsType.Effects) { AddEffect(effect, double.PositiveInfinity); } GetLastEffect()?.Init(); foreach (var cast in otherStack.unitsType.Casts) { Casts.Add(cast); } parentArmy = null; }
public void RequestDetails() { var databaseService = ServiceLocator.Current.GetInstance <DatabaseService>(); using (var connection = databaseService.Connect()) { Slot = connection.Slots.Single(w => w.SlotId == _model.SlotId); var firstEpisode = Slot.Episodes.First(); firstEpisode.Casts.ToList().ForEach(w => Casts.Add(w.Name)); firstEpisode.Crews.ToList().ForEach(w => Crews.Add(w.Name)); ProgramId = firstEpisode.EpisodeId; Channel = Slot.Channel; Series = firstEpisode.Series; if (CanSlotReservation) { CanSlotReservation = !connection.SlotReservations.Any(w => w.Slot.SlotId == _model.SlotId); } CanSeriesReservation = !connection.SeriesReservations.Any(w => w.Series.SeriesId == Series.SeriesId); } }
private void FetchProgramInfo() { lock (_lockObj) { if (_abemaState.CurrentEpisode == null) { Title = ""; return; } try { _statusService.UpdateStatus(Resources.FetchingProgramInformation); var slot = _abemaState.CurrentSlot; var episode = _abemaState.CurrentEpisode; if (slot == null) { Title = ""; return; } Casts.Clear(); Crews.Clear(); Title = slot.Episodes.Count == 1 ? slot.Title : $"{slot.Title} - #{episode.Sequence}"; Description = slot.Description; episode.Casts.ForEach(w => Casts.Add(w.Name)); episode.Crews.ForEach(w => Crews.Add(w.Name)); ProvideThumbnails(episode); _statusService.UpdateStatus(Resources.FetchedProgramInformation); } catch { // ignored } } }
public void FindCast() //filmin castını bulan method { WebClient webClient = new WebClient(); string result = webClient.DownloadString("https://www.imdb.com" + this.MovieId); Boolean control = false; //ayn isim var mı kontrolunde kullanılıyor string roleResult, castUrl; string name, role = ""; int startsWith = result.IndexOf("credit_summary_item"); //herbir castın başında bu item olduğundan başlangıç noktası bu olarak alınır result = result.Substring(startsWith); int endsWith = result.IndexOf("<script>"); result = result.Substring(0, endsWith); while (result.IndexOf("credit_summary_item") != -1) //"credit_summary_item" bulamadığında döngü sonlanır { startsWith = result.IndexOf("credit_summary_item"); result = result.Substring(startsWith); endsWith = result.IndexOf("/div"); roleResult = result.Substring(0, endsWith); result = result.Substring(endsWith); startsWith = roleResult.IndexOf("inline"); roleResult = roleResult.Substring(startsWith); startsWith = roleResult.IndexOf(">"); roleResult = roleResult.Substring(startsWith + 1); endsWith = roleResult.IndexOf("<"); role = roleResult.Substring(0, endsWith - 2); do //aynı role içinde birden fazla kişi varsa diye ilki ismi yazıp , varsa devam eder { endsWith = roleResult.IndexOf(">"); roleResult = roleResult.Substring(endsWith + 1); startsWith = roleResult.IndexOf('"'); roleResult = roleResult.Substring(startsWith + 1); endsWith = roleResult.IndexOf('?'); castUrl = roleResult.Substring(0, endsWith); // castın url i //iki kez >(tag kapama) geçtikten sonra castın ismi vardır startsWith = roleResult.IndexOf(">"); roleResult = roleResult.Substring(startsWith + 1); endsWith = roleResult.IndexOf("<"); name = roleResult.Substring(0, endsWith); //tag kapama ile tag açma arasındaki string cast ismidir name = name.Replace("ö", "ö"); roleResult = roleResult.Substring(endsWith + 1); for (int i = 0; i < Casts.Count; i++) //aynı kişi varsa sadece rolüne ekleme yapar { if (Casts[i].CastId == castUrl) { Casts[i].Roles.Add(role); control = true; //aynı kisi varsa kontrolunu yapar break; } } if (control == false) { string first = name; string last = ""; if (name.Contains(" ")) { first = name.Substring(0, name.IndexOf(" ")); last = name.Substring(name.IndexOf(" ") + 1); } Cast cast = new Cast(first, last, castUrl); cast.Roles.Add(role); Casts.Add(cast); } }while (roleResult.IndexOf(",") != -1); control = false; } }
public void AddCast(Cast cast) { Casts.Add(cast); }