public JogoConfiguracaoViewModel( INavigationService navigationService, IDialogService dialogService, ICampoService campoService, IModoJogoService modoJogoService, IMetricoService metricoService, IBuracosService buracoService, ITeeService teeService, ITeeDistanciaService teeDistanciaService) : base(navigationService, dialogService) { _campoService = campoService; _modoJogoService = modoJogoService; _metricoService = metricoService; _buracoService = buracoService; _teeService = teeService; _teeDistanciaService = teeDistanciaService; ActivityIndicatorTool = new ActivityIndicatorTool(activityIndicatorCor: "#11990f", mensagemAMostrar: "Creating the game...", backgroundCorVisivel: "#CC000000", backgroundCorEscondido: "#00000000"); Jogadores = new ObservableCollection <JogadorWrapperViewModel>(); InicializarComunicacaoMediadorMensagens(); //Preencher Pickers. Task.Run(async() => await InicializarDados()); }
/// <summary> /// Tira um screenshot do Scorecard, enviando para o email do jogador /// da propriedade JogadorAEnviarPrint. /// </summary> private async Task TirarPrint() { ActivityIndicatorTool.ExecutarRoda(); //Tirar screenshot. byte[] screenshot = await _screenshotService.TirarScreenshotAsync(); //Guardar screenshot como anexo do email. MimeKit.AttachmentCollection attachments = new MimeKit.AttachmentCollection(); attachments.Add("ScorecardPNG,", screenshot, ContentType.Parse("image/png")); //Enviar Email. try { await _emailService.EnviarEmail(emailDestino : JogadorAEnviarPrint.Email, assunto : "IT4ClubCar Game Results", mensagemConteudo : "Like you asked :)", attachments : attachments); await base.NavigationService.SairDeScorecard(); } catch (SaslException e) { await base.DialogService.MostrarMensagem("Error while sending the email. Please try again later"); } catch (AuthenticationException e) { await base.DialogService.MostrarMensagem("Error while sending the email. Please try again later"); } ActivityIndicatorTool.PararRoda(); }
/// <summary> /// Obtém o tempo atual e guarda os valores na propriedade WeatherAtual. /// </summary> private async Task ObterTempoAtual() { ActivityIndicatorTool.ExecutarRoda(); PrevisoesTempo = await _weatherService.ObterPrevisoesPorNomeCidade("Alcantarilha"); ActivityIndicatorTool.PararRoda(); }
public CampoInformacoesViewModel(INavigationService navigationService , IDialogService dialogService, ICampoService campoService) : base(navigationService, dialogService) { _campoService = campoService; ActivityIndicatorTool = new ActivityIndicatorTool(activityIndicatorCor: "#11990f", mensagemAMostrar: "Obtaining Courses...", backgroundCorVisivel: "#CC000000", backgroundCorEscondido: "#00000000"); Task.Run(async() => await ObterCamposExistentes()); }
public VerTempoViewModel(INavigationService navigationService, IDialogService dialogService, IWeatherService weatherService) : base(navigationService, dialogService) { _weatherService = weatherService; ActivityIndicatorTool = new ActivityIndicatorTool(activityIndicatorCor: "#4286f4", mensagemAMostrar: "Predicting weather...", backgroundCorVisivel: "#CC000000", backgroundCorEscondido: "#00000000"); //Obter tempo atual Task.Run(async() => await ObterTempoAtual()); }
public PedirBuggyBarPopupViewModel(INavigationService navigationService, IDialogService dialogService, IBuggyBarService buggyBarService, ITelemovelService telemovelService) : base(navigationService, dialogService) { _buggyBarService = buggyBarService; _telemovelService = telemovelService; ActivityIndicatorTool = new ActivityIndicatorTool(activityIndicatorCor: "#e2243d", mensagemAMostrar: "Calling BuggyBar...", backgroundCorVisivel: "#CC000000", backgroundCorEscondido: "#00000000"); InicializarComunicacaoComMediadorMensagens(); }
/// <summary> /// Envia um sms ao BuggyBar a pedir a sua presença no buraco indicado pelo utilizador. /// </summary> private async Task EnviarPedido() { ActivityIndicatorTool.ExecutarRoda(); string numeroTelemovelBuggyBar = await _buggyBarService.ObterNumeroTelemovel(); string mensagemAEnviar = "\n Campo : " + Campo.Nome + "\n Buraco : " + BuracoSelecionado.Numero; await _telemovelService.EnviarSMS(numeroTelemovelBuggyBar, mensagemAEnviar); await base.NavigationService.SairDePedirBuggyBar(); ActivityIndicatorTool.PararRoda(); }
public ScorecardPopupViewModel(INavigationService navigationService, IDialogService dialogService, IScreenshotService screenshotService, IEmailService emailService) : base(navigationService, dialogService) { _screenshotService = screenshotService; _emailService = emailService; ActivityIndicatorTool = new ActivityIndicatorTool(activityIndicatorCor: "#e2243d", mensagemAMostrar: "Sending print to email...", backgroundCorVisivel: "#CC000000", backgroundCorEscondido: "#00000000"); TeesUsados = new ObservableCollection <TeeWrapperViewModel>(); InicializarComunicacaoMediadorMensagens(); }
/// <summary> /// Obtém todos os campos existentes. /// </summary> private async Task ObterCamposExistentes() { ActivityIndicatorTool.ExecutarRoda(); _camposExistentes = await _campoService.ObterCamposDisponiveis(); if (_camposExistentes.Count.Equals(0)) { return; } //Definir primeiro campo a mostrar os detalhes. IndicadorCampoAtual = 0; ActivityIndicatorTool.PararRoda(); }
/// <summary> /// Executado quando o utilizador clica no botão "Start" após ter configurado o jogo. /// </summary> private async Task ComecarJogo() { ActivityIndicatorTool.ExecutarRoda(); JogoWrapperViewModel novoJogo = null; novoJogo = await ConfigurarJogo(); await base.NavigationService.IrParaJogo(); MediadorMensagensService.Instancia.Avisar(MediadorMensagensService.ViewModelMensagens.NovoJogo, novoJogo); ActivityIndicatorTool.PararRoda(); LimparMemoria(); }