public HomeController() { _MarvelPublicKey = ConfigurationManager.AppSettings["MarvelPublicApiKey"]; _MarvelPrivateKey = ConfigurationManager.AppSettings["MarvelPrivateApiKey"]; _Marvel = new Marvel(_MarvelPublicKey, _MarvelPrivateKey, true); }
public CharacterTest() { _MarvelPublicKey = "67d146c4c462f0b55bf12bb7d60948af"; _MarvelPrivateKey = "54fd1a8ac788767cc91938bcb96755186074970b"; _Marvel = new Marvel(_MarvelPublicKey, _MarvelPrivateKey); _Comparer = CompareInfo.GetCompareInfo("en-US"); }
public APIController() { _MarvelPublicKey = ConfigurationManager.AppSettings["MarvelPublicApiKey"]; _MarvelPrivateKey = ConfigurationManager.AppSettings["MarvelPrivateApiKey"]; _Marvel = new Marvel(_MarvelPublicKey, _MarvelPrivateKey, true); }
private void button1_Click(object sender, EventArgs e) { Personaje per1 = new Enemigo("Enemigo"); Personaje per2 = new Enemigo("Enemigo1"); Personaje per4 = new Enemigo("Enemigo2"); Personaje per3 = new Advenger("Octavio"); string salida = ""; try { Marvel.AgregarBichito = per1; Marvel.AgregarBichito = per2; Marvel.AgregarBichito = per3; salida = Marvel.Mostrar(); } catch (AgregarBichitoException ex) { salida = ex.Message; } catch (Exception tdd) { } MessageBox.Show(salida); }
public async Task <List <Marvel> > RefreshDataAsync() { MarvelList = new List <Marvel>(); var uri = new Uri(string.Format(Constants.MarvelUrl, string.Empty)); try { for (int i = 0; i < 30; i++) { var response = await _client.GetAsync(uri); Debug.WriteLine("XXXX: " + response.ToString()); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); // Debug.WriteLine(content); Marvel marvel = JsonConvert.DeserializeObject <Marvel>(content); Debug.WriteLine(marvel); MarvelList.Add(marvel); } } } catch (Exception ex) { Debug.WriteLine(@"\tERROR {0}", ex.Message); } return(MarvelList); }
public ComicTest() { _marvelPublicKey = "ae9f4edf31b262cf13acb7b7f972bc61"; _marvelPrivateKey = "ac741b4559b405ef585151ef6abe146c23e5d96a"; _marvel = new Marvel(_marvelPublicKey, _marvelPrivateKey); _comparer = CompareInfo.GetCompareInfo("en-US"); }
private void InitLabels(Marvel item) { lblname.Text = item.name; lblrealname.Text = item.realname; lblteam.Text = item.team; lblfap.Text = item.firstappearance; lblcreatedby.Text = item.createdby; lblpub.Text = item.publisher; }
public ActionResult SearchCharacter(String characterName) { Character character = Marvel.searchAvengers(characterName); if (character == null) { ViewBag.ErrorMessage = true; return(View("SearchCharacter")); } return(View("SearchCharacter", character)); }
public async Task Api_Should_Throw_MarvelError_Invalid_Hash(string publicKey, string privateKey) { var marvel = new Marvel(publicKey, privateKey); var exceptionJson = Assert .ThrowsAsync <MarvelException>(async() => await marvel.GetCharactersJson(new CancellationToken())); Assert.That(exceptionJson.code.Equals(ErrorConstants.Code.InvalidCredentials)); Assert.That(exceptionJson.message.Equals(ErrorConstants.Message.ApiInvalidHash)); var exception = Assert .ThrowsAsync <MarvelException>(async() => await marvel.GetCharacters(new CancellationToken())); Assert.That(exception.code.Equals(ErrorConstants.Code.InvalidCredentials)); Assert.That(exception.message.Equals(ErrorConstants.Message.ApiInvalidHash)); }
public ActionResult AddCharacter(int id) { if (!db.Characters.Any(x => x.CharacterID == id)) { Character tempCharacter = Marvel.getAvengers(id); db.Characters.Add(new CharacterDB { CharacterID = id, Description = tempCharacter.Description, Name = tempCharacter.Name, ThumbnailURL = (tempCharacter.Thumbnail.Path + "." + tempCharacter.Thumbnail.Extension), URL = tempCharacter.Urls[tempCharacter.Urls.FindIndex(x => x.Type == "wiki")].URL }); db.SaveChanges(); } return(View("Index", db.Characters.ToList())); }
private void btnMostrarPersonajes_Click(object sender, EventArgs e) { rtbPersonajes.Text = Marvel.MostrarInformacion(); }
public MarvelDetails(Marvel item) { InitializeComponent(); InitLabels(item); }
async void OnItemSelected(object sender, SelectedItemChangedEventArgs e) { Marvel marvel = (Marvel)e.SelectedItem; await DisplayAlert("Worthless Info", marvel.Name + "\nHas " + marvel.Description + " characters.", "OK"); }
private async void Search() { this.IsRefreshing = true; if (string.IsNullOrEmpty(this.Hero)) { await Application.Current.MainPage.DisplayAlert( "Error", // Titulo del Error "You must enter some Text", // Mensage "Accept"); // Nombre del botón return; } var connection = await this.apiService.CheckConnection(); // si no hay coneccion if (!connection.IsSuccess) { this.IsRefreshing = false; // desactiva la carga del listView await Application.Current.MainPage.DisplayAlert( "Error", connection.Message, "Accept"); return; } //para cargar las lands hay que instanciar el servicio var response = await this.apiService.Get <Marvel>( "http://gateway.marvel.com", Hero); // si dio algun error if (!response.IsSuccess) { this.IsRefreshing = false; // desactiva la carga del listView await Application.Current.MainPage.DisplayAlert( "Error", response.Message, "Accept"); return; } this.marvel = (Marvel)response.Result; //Si no encuentra al super heroe if (marvel.Data.Results.Count == 0) { await Application.Current.MainPage.DisplayAlert( "Error", // Titulo del Error "Super Hero Was not Found", // Mensage "Accept"); // Nombre del botón this.IsRefreshing = false; Hero = ""; //esto hace que vuelva hacia la pestaña anterior await Application.Current.MainPage.Navigation.PopAsync(); return; } this.SuperHero = new ObservableCollection <MarvelItemViewModel>( this.ToSuperHeroItemViewModel()); //this.Img = String.Format("{0}.{1}", marvel.Data.Results[0].Thumbnail.Path, marvel.Data.Results[0].Thumbnail.Extension); this.IsRefreshing = false; }
public MarvelApi() { marvelApi = new Marvel("c886fa14b8458ab2c899c25c0e282baf", "a7e93dfcc905218264a44cea885dea95fb0e92a3"); }