private void RickRoll(object Sender, RoutedEventArgs e) { Rick.Visibility = Visibility.Visible; Rick.Play(); LightBulb.Checked(false); colorTicker = new DispatcherTimer(); colorTicker.Tick += UpdateColor; colorTicker.Interval = new TimeSpan(0, 0, 0, 0, 250); // 4 x per second colorTicker.Start(); }
public async Task <Rick> Create(String dimension) { var d = await this.CreateDimension(dimension); var rick = new Rick(); rick.DimensionId = d.Id; rick = await rickRepository.Create(rick); rick.Dimension = d; return(rick); }
public async Task UpdateHttpRequest(string url) { Rick rick = new Rick(); var stringContent = new StringContent(JsonConvert.SerializeObject(rick), Encoding.UTF8, "application/json"); var client = _factory.CreateClient(); var result = await client.PutAsync(url, stringContent, CancellationToken.None); result.EnsureSuccessStatusCode(); Assert.Equal("application/json; charset=utf-8", result.Content.Headers.ContentType.ToString()); }
public LocalizacaoRickResult PostUniverso(UniversoViewModel universoVM) { try { using (var dbContext = _Repository.NewConnection()) { dbContext.BeginTransaction(); if (universoVM != null) { Universo universo = new Universo() { NomeUniverso = universoVM.NomeUniverso, Descricao = universoVM.Descricao, IdRick = universoVM.IdRick, DataCriacao = DateTime.Now, }; var universoInsert = _universoCore.Insert(universo, dbContext); Rick rick = _rickCore.SelectFirst(r => r.Id == universoVM.IdRick); if (rick != null) { rick.IdUniverso = universoInsert.Id; _rickCore.Update(rick, dbContext); } dbContext.Commit(); return(new LocalizacaoRickResult(HttpStatusCode.OK, true, "Universo adicionada com sucesso.", universoInsert)); } else { return(new LocalizacaoRickResult(HttpStatusCode.OK, false, "Erro ao cadastrar o universo.")); } } } catch (Exception ex) { return(new LocalizacaoRickResult(HttpStatusCode.OK, false, "Erro ao cadastrar o universo. " + ex.Message)); } }
public LocalizacaoRickResult DeleteUniverso(int id) { try { using (var dbContext = _Repository.NewConnection()) { dbContext.BeginTransaction(); Universo universo = _universoCore.SelectFirst(d => d.Id == id); if (universo != null) { Rick rick = _rickCore.SelectFirst(r => r.Id == universo.IdRick); if (rick != null) { rick.IdUniverso = null; _rickCore.Update(rick, dbContext); } var universoDelete = _universoCore.DeletePermanent(universo, dbContext); dbContext.Commit(); return(new LocalizacaoRickResult(HttpStatusCode.OK, true, "Universo deletada com sucesso.", universoDelete)); } else { return(new LocalizacaoRickResult(HttpStatusCode.OK, false, "Erro ao deletar o universo.")); } } } catch (Exception ex) { return(new LocalizacaoRickResult(HttpStatusCode.OK, false, "Erro ao deletar o universo. " + ex.Message)); } }
public async Task SetupAsync() { this.rick = await this.rickService.Create("Pastel-47"); }
public Task <Rick> GetDetails(string Url) { Rick rick = GetAll(0, 0).Result.Response.Where(x => x.Url == Url).FirstOrDefault(); return(Task.FromResult(rick)); }
public Task <Rick> FindById(Guid id) { Rick rick = GetAll(0, 0).Result.Response.Where(x => x.Id == id).FirstOrDefault(); return(Task.FromResult(rick)); }