async Task Cargar() { await App.metodos.ActualizarNuevoJuego(); configuracion = await App.metodos.CargarConfiguracion(); TiempoLimite = configuracion.TiempoLimite; factor = configuracion.TiempoLimite / 60; puntos = tiempo = mistakes = 0; segundos = minutos = horas = 0; int discoveredStates = await App.metodos.ContarEstadosDescubiertos(); txbUserName.Text = configuracion.Nombre; txtResults.Text = String.Format(@"{0} / {1}", discoveredStates, totalStates); txbTimer.Text = ConvertToTime(tiempo); share = new Share(AppInfo.Name, String.Format("My score in #AhorcadoDeEstados for #WindowsPhone is {0} pts and {1} victories. Can you beat me? Download it now!", configuracion.Puntos, configuracion.Victorias), AppInfo.Link); string url = "ms-appx:///Imagenes/ahorcado0.png"; BitmapImage img = new BitmapImage(new Uri(url)); imgAhorcado.Source = img; ActivarDetalle(false); txbResult.Text = ""; if (discoveredStates < totalStates) { estado = await App.metodos.ObtenerEstadoAleatorio(); if (!estado.Status) { txbResult.Text = "** NEW **"; txbResult.Foreground = new SolidColorBrush(Colors.Yellow); } txbEstado.Text = ConvertTo_(estado.Nombre); answer = estado.Nombre.ToUpper(); chars = 0; spaces = CountSpaceChars(answer); DibujarBotones(); MostrarControles(true); MostrarTaps(true); ControlarTiempo(); } else { txbResult.Text = "VICTORY!! :)"; txbEstado.FontSize = 19; txbEstado.Text = "Congratulations! You completed the game! Thanks for playing! Now you know the 32 Mexican federal entities. Share your progress with your friends."; MostrarTaps(false); MostrarControles(false); MostrarMapa(); } }
private async Task SendData(Estados estado) { try { IBandClient bandClient = await ConnectToBand(); if (bandClient != null) { using (bandClient) { if (await CreateTile(bandClient)) { await bandClient.NotificationManager.SendMessageAsync(myTileId, "Victory", "You just discovered " + estado.Nombre, DateTimeOffset.Now, MessageFlags.ShowDialog); } } } } catch (BandException ex) { ShowDialogAsync("Error", "Error sending data. Exception found: " + ex.Message); } }
public async Task Publish(Estados estado) { await SendData(estado); await SetContent(estado); }
private async Task SetContent(Estados estado) { try { IBandClient bandClient = await ConnectToBand(); if (bandClient != null) { using (bandClient) { Guid messagesPageGuid = Guid.NewGuid(); PageData pageContent = new PageData(messagesPageGuid, 0, new WrappedTextBlockData(1, estado.Nombre), new WrappedTextBlockData(2, estado.Motto), new IconData(3, GetId(estado.Codigo))); await bandClient.TileManager.SetPagesAsync(myTileId, pageContent); } } } catch (BandException ex) { ShowDialogAsync("Error", "Error setting content. Exception found: " + ex.Message); } }
public async Task ActualizarEstado(Estados estado) { if (!estado.Status) { estado.Status = true; await db.conn.UpdateAsync(estado); } }