Beispiel #1
0
 void ls_loginCompleted(object sender, LeagueWS.loginCompletedEventArgs e)
 {
     try
     {
         if (e.Result)
         {
             lsUser = new LeagueWS.LeagueServiceClient();
             lsUser.encontrarUsuarioCompleted += ls_encontrarUsuarioCompleted;
             var settings = IsolatedStorageSettings.ApplicationSettings;
             if (settings.Count > 0 && settings["Login"].ToString() != "")
             {
                 lsUser.encontrarUsuarioAsync(settings["Login"].ToString());
             }
             else
             {
                 lsUser.encontrarUsuarioAsync(nomeInvocador.Text);
             }
         }
         else
         {
             MessageBox.Show("Login não efetuado");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.InnerException.Message);
     }
     finally
     {
         ls.CloseAsync();
     }
 }
Beispiel #2
0
 private void CarregarCounters()
 {
     listBoxCounters.Items.Clear();
     lsCounter = new LeagueWS.LeagueServiceClient();
     lsCounter.encontrarCounterPorCampeaoCompleted += ls_encontrarCounterPorCampeaoCompleted;
     lsCounter.encontrarCounterPorCampeaoAsync(Convert.ToInt32(NavigationContext.QueryString["id"]));
 }
Beispiel #3
0
 private void buttonAlterarCadastro_Click(object sender, RoutedEventArgs e)
 {
     user                        = new LeagueWS.usuario();
     user.login                  = GlobalData.UserLogged.login;
     user.nome                   = textBoxName.Text;
     user.email                  = "not implemented";
     user.sexo                   = radioButtonFeminino.IsChecked == true ? "f" : "m";
     user.dataNasc               = (DateTime)datePickerBornDate.Value;
     user.validado               = true;
     user.validador              = GlobalData.UserLogged.validador;
     ls                          = new LeagueWS.LeagueServiceClient();
     ls.alterarUsuarioCompleted += ls_alterarUsuarioCompleted;
     ls.alterarUsuarioAsync(user);
 }
 private void buttonAlterarCadastro_Click(object sender, RoutedEventArgs e)
 {
     user = new LeagueWS.usuario();
     user.login = GlobalData.UserLogged.login;
     user.nome = textBoxName.Text;
     user.email = "not implemented";
     user.sexo = radioButtonFeminino.IsChecked == true ? "f" : "m";
     user.dataNasc = (DateTime)datePickerBornDate.Value;
     user.validado = true;
     user.validador = GlobalData.UserLogged.validador;
     ls = new LeagueWS.LeagueServiceClient();
     ls.alterarUsuarioCompleted += ls_alterarUsuarioCompleted;
     ls.alterarUsuarioAsync(user);
 }
Beispiel #5
0
 private void buttonLogin_Click(object sender, RoutedEventArgs e)
 {
     if (nomeInvocador.Text != string.Empty && senha.Password != string.Empty)
     {
         buttonCadastro.IsEnabled    = false;
         buttonSemCadastro.IsEnabled = false;
         buttonLogin.IsEnabled       = false;
         ls = new LeagueWS.LeagueServiceClient();
         ls.loginCompleted += ls_loginCompleted;
         ls.loginAsync(nomeInvocador.Text, senha.Password);
     }
     else
     {
         MessageBox.Show("Insira o seu nome de invocadsor e sua senha.");
     }
 }
Beispiel #6
0
 private void buttonSaveCounter_Click(object sender, RoutedEventArgs e)
 {
     gridChooseCounter.Visibility = Visibility.Collapsed;
     foreach (CounterControl cc in listBoxCounterChose.Items)
     {
         if (cc.IsSelected)
         {
             LeagueWS.championcounter counterWS = new LeagueWS.championcounter();
             counterWS.idCounter  = cc.Champion.Id;
             counterWS.idChampion = Convert.ToInt16(NavigationContext.QueryString["id"]);
             lsInsertCounter      = new LeagueWS.LeagueServiceClient();
             lsInsertCounter.inserirCounterCompleted += ls_inserirCounterCompleted;
             lsInsertCounter.inserirCounterAsync(counterWS);
         }
     }
 }
 private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
 {
     textBlockSummonerName.Text = NavigationContext.QueryString["summoner"];
     if (NavigationContext.QueryString["validador"] == string.Empty)
     {
         string dicionario = "ACDEFGHIJKMPTWXYZ123478";
         Random rand = new Random();
         textBlockValidateNumber.Text = string.Empty;
         for (int i = 0; i < 6; i++)
             textBlockValidateNumber.Text += dicionario[rand.Next(dicionario.Count())];
         LeagueWS.LeagueServiceClient ls = new LeagueWS.LeagueServiceClient();
         ls.preCadastroCompleted += ls_preCadastroCompleted;
         ls.preCadastroAsync(textBlockSummonerName.Text, textBlockValidateNumber.Text);
     }
     else
     {
         textBlockValidateNumber.Text = NavigationContext.QueryString["validador"];
     }
 }
Beispiel #8
0
        public async Task LoginAutomatico()
        {
            var settings = IsolatedStorageSettings.ApplicationSettings;

            if (settings != null && settings.Count > 0 && settings["Senha"].ToString() != string.Empty && settings["Login"].ToString() != string.Empty)
            {
                buttonLogin.IsEnabled           = false;
                buttonCadastro.IsEnabled        = false;
                buttonSemCadastro.IsEnabled     = false;
                progresBarCarregando.Visibility = System.Windows.Visibility.Visible;
                ls = new LeagueWS.LeagueServiceClient();
                ls.loginCompleted += ls_loginCompleted;
                ls.loginAsync(settings["Login"].ToString(), settings["Senha"].ToString());
                while (wait)
                {
                    await Task.Delay(10);
                }
                buttonSemCadastro.Visibility = System.Windows.Visibility.Collapsed;
            }
        }
Beispiel #9
0
 private void buttonComment_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (textBoxComentario.Text != string.Empty)
         {
             LeagueWS.championcomments cc = new LeagueWS.championcomments();
             cc.idUsuario    = GlobalData.UserLogged;
             cc.comentario   = textBoxComentario.Text;
             cc.idChampion   = Convert.ToInt32(NavigationContext.QueryString["id"]);
             lsInsertComment = new LeagueWS.LeagueServiceClient();
             lsInsertComment.inserirComentarioCampeaoCompleted += ls_inserirComentarioCampeaoCompleted;
             lsInsertComment.inserirComentarioCampeaoAsync(cc);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Não foi possivel efetuar o comentario.Detalhes:\n" + ex.Message);
     }
 }
 private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
 {
     textBlockSummonerName.Text = NavigationContext.QueryString["summoner"];
     if (NavigationContext.QueryString["validador"] == string.Empty)
     {
         string dicionario = "ACDEFGHIJKMPTWXYZ123478";
         Random rand       = new Random();
         textBlockValidateNumber.Text = string.Empty;
         for (int i = 0; i < 6; i++)
         {
             textBlockValidateNumber.Text += dicionario[rand.Next(dicionario.Count())];
         }
         LeagueWS.LeagueServiceClient ls = new LeagueWS.LeagueServiceClient();
         ls.preCadastroCompleted += ls_preCadastroCompleted;
         ls.preCadastroAsync(textBlockSummonerName.Text, textBlockValidateNumber.Text);
     }
     else
     {
         textBlockValidateNumber.Text = NavigationContext.QueryString["validador"];
     }
 }
Beispiel #11
0
        private async void buttonCadastro_Click(object sender, RoutedEventArgs e)
        {
            if (nomeInvocador.Text == string.Empty)
            {
                MessageBox.Show("Digite o nome do invocador antes de se cadastrar.");
            }
            else
            {
                summoner = new SummonerDto();
                try
                {
                    summoner = await summoner.SearchSummoner(nomeInvocador.Text);

                    ls = new LeagueWS.LeagueServiceClient();
                    ls.encontrarUsuarioCompleted += Ls_encontrarUsuarioCompleted;
                    ls.encontrarUsuarioAsync(nomeInvocador.Text);
                }
                catch (Exception)
                {
                    MessageBox.Show("Erro ao procurar invocador.");
                }
            }
        }
Beispiel #12
0
 private void buttonFinalizarCadastro_Click(object sender, RoutedEventArgs e)
 {
     ls = new LeagueWS.LeagueServiceClient();
     ls.encontrarUsuarioCompleted += Ls_encontrarUsuarioCompleted;
     ls.encontrarUsuarioAsync(NavigationContext.QueryString["summoner"]);
 }
Beispiel #13
0
 private void buttonFinalizarCadastro_Click(object sender, RoutedEventArgs e)
 {
     ls = new LeagueWS.LeagueServiceClient();
     ls.encontrarUsuarioCompleted += Ls_encontrarUsuarioCompleted;
     ls.encontrarUsuarioAsync(NavigationContext.QueryString["summoner"]);
 }
 private void buttonSaveCounter_Click(object sender, RoutedEventArgs e)
 {
     gridChooseCounter.Visibility = Visibility.Collapsed;
     foreach(CounterControl cc in listBoxCounterChose.Items)
     {
         if (cc.IsSelected)
         {
             LeagueWS.championcounter counterWS = new LeagueWS.championcounter();
             counterWS.idCounter = cc.Champion.Id;
             counterWS.idChampion = Convert.ToInt16(NavigationContext.QueryString["id"]);
             lsInsertCounter = new LeagueWS.LeagueServiceClient();
             lsInsertCounter.inserirCounterCompleted += ls_inserirCounterCompleted;
             lsInsertCounter.inserirCounterAsync(counterWS);
         }
     }
     
 }
 private void buttonComment_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (textBoxComentario.Text != string.Empty)
         {
             LeagueWS.championcomments cc = new LeagueWS.championcomments();
             cc.idUsuario = GlobalData.UserLogged;
             cc.comentario = textBoxComentario.Text;
             cc.idChampion = Convert.ToInt32(NavigationContext.QueryString["id"]);
             lsInsertComment = new LeagueWS.LeagueServiceClient();
             lsInsertComment.inserirComentarioCampeaoCompleted += ls_inserirComentarioCampeaoCompleted;
             lsInsertComment.inserirComentarioCampeaoAsync(cc);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Não foi possivel efetuar o comentario.Detalhes:\n" + ex.Message);
     }
     
 }
 private void CarregarCounters()
 {
     listBoxCounters.Items.Clear();
     lsCounter = new LeagueWS.LeagueServiceClient();
     lsCounter.encontrarCounterPorCampeaoCompleted += ls_encontrarCounterPorCampeaoCompleted;
     lsCounter.encontrarCounterPorCampeaoAsync(Convert.ToInt32(NavigationContext.QueryString["id"]));
 }