/// <summary> /// </summary> /// <param name="parameter">MapPokemonWrapper containing the Pokemon that we're trying to capture</param> /// <param name="mode"></param> /// <param name="suspensionState"></param> /// <returns></returns> public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState) { if (suspensionState.Any()) { // Recovering the state CurrentEncounter = new EncounterResponse(); CurrentLureEncounter = new DiskEncounterResponse(); CurrentCaptureAward = new CaptureAward(); SelectedCaptureItem = new ItemData(); CurrentPokemon = JsonConvert.DeserializeObject <IMapPokemon>((string)suspensionState[nameof(CurrentPokemon)]); CurrentEncounter.MergeFrom(ByteString.FromBase64((string)suspensionState[nameof(CurrentEncounter)]).CreateCodedInput()); CurrentLureEncounter.MergeFrom(ByteString.FromBase64((string)suspensionState[nameof(CurrentLureEncounter)]).CreateCodedInput()); CurrentCaptureAward.MergeFrom(ByteString.FromBase64((string)suspensionState[nameof(CurrentCaptureAward)]).CreateCodedInput()); SelectedCaptureItem.MergeFrom(ByteString.FromBase64((string)suspensionState[nameof(SelectedCaptureItem)]).CreateCodedInput()); RaisePropertyChanged(() => CurrentEncounter); RaisePropertyChanged(() => CurrentLureEncounter); RaisePropertyChanged(() => CurrentCaptureAward); RaisePropertyChanged(() => SelectedCaptureItem); } else { // Navigating from game page, so we need to actually load the encounter CurrentPokemon = (IMapPokemon)NavigationHelper.NavigationState[nameof(CurrentPokemon)]; Busy.SetBusy(true, string.Format(Resources.CodeResources.GetString("LoadingEncounterText"), Resources.Pokemon.GetString(CurrentPokemon.PokemonId.ToString()))); NavigationHelper.NavigationState.Remove(nameof(CurrentPokemon)); Logger.Write($"Catching {CurrentPokemon.PokemonId}"); await HandleEncounter(); } }
public void MergeFrom(CatchPokemonResponse other) { if (other == null) { return; } if (other.Status != 0) { Status = other.Status; } if (other.MissPercent != 0D) { MissPercent = other.MissPercent; } if (other.CapturedPokemonId != 0UL) { CapturedPokemonId = other.CapturedPokemonId; } if (other.captureAward_ != null) { if (captureAward_ == null) { captureAward_ = new global::POGOProtos.Data.Capture.CaptureAward(); } CaptureAward.MergeFrom(other.CaptureAward); } if (other.CaptureReason != 0) { CaptureReason = other.CaptureReason; } if (other.DisplayPokedexId != 0) { DisplayPokedexId = other.DisplayPokedexId; } }
public void MergeFrom(CatchPokemonResponse other) { if (other == null) { return; } if (other.Status != 0) { Status = other.Status; } if (other.MissPercent != 0D) { MissPercent = other.MissPercent; } if (other.CapturedPokemonId != 0UL) { CapturedPokemonId = other.CapturedPokemonId; } if (other.captureAward_ != null) { if (captureAward_ == null) { captureAward_ = new global::POGOProtos.Data.Capture.CaptureAward(); } CaptureAward.MergeFrom(other.CaptureAward); } if (other.CaptureReason != 0) { CaptureReason = other.CaptureReason; } if (other.DisplayPokedexId != 0) { DisplayPokedexId = other.DisplayPokedexId; } if (other.ThrowsRemaining != 0) { ThrowsRemaining = other.ThrowsRemaining; } if (other.pokemonDisplay_ != null) { if (pokemonDisplay_ == null) { pokemonDisplay_ = new global::POGOProtos.Data.PokemonDisplay(); } PokemonDisplay.MergeFrom(other.PokemonDisplay); } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); }