private void AutoSuggestBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
        {
            // Set sender.Text. You can use args.SelectedItem to build your text string.
            sender.Text = args.SelectedItem.ToString();

            List <Jugador> Busca = new List <Jugador>();

            foreach (Jugador Candy in AdminJugs.GetJugadores())
            {
                if (Candy.ToString().Contains(ASBBuscar.Text))
                {
                    Busca.Add(Candy);
                }
            }
            sender.ItemsSource = Busca;

            if (Busca.Count > 0)
            {
                //GVVerJugs.ItemsSource = Busca;

                if (ListaJugadores.Count != Busca.Count)
                {
                    ListaJugadores        = Busca;
                    GVVerJugs.ItemsSource = ListaJugadores;
                }
            }
            else
            {
                ListaJugadores        = AdminJugs.GetJugadores();
                GVVerJugs.ItemsSource = ListaJugadores;
            }
        }
        //AutosuggestBox
        private void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            // Only get results when it was a user typing,
            // otherwise assume the value got filled in by TextMemberPath
            // or the handler for SuggestionChosen.
            if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
            {
                //Set the ItemsSource to be your filtered dataset
                List <Jugador> Busca = new List <Jugador>();
                foreach (Jugador Candy in AdminJugs.GetJugadores())
                {
                    if (Candy.ToString().Contains(ASBBuscar.Text))
                    {
                        Busca.Add(Candy);
                    }
                }
                sender.ItemsSource = Busca;

                if (Busca.Count > 0)
                {
                    //GVVerJugs.ItemsSource = Busca;

                    if (ListaJugadores.Count != Busca.Count)
                    {
                        ListaJugadores        = Busca;
                        GVVerJugs.ItemsSource = ListaJugadores;
                    }
                }
                else
                {
                    ListaJugadores        = AdminJugs.GetJugadores();
                    GVVerJugs.ItemsSource = ListaJugadores;
                }
            }
        }
        private void Button_Click_Registrar(object sender, RoutedEventArgs e)
        {
            if (TxtNombre.Text.Trim().Equals(""))
            {
                TxtNombre.PlaceholderText = "Escribe un nombre";
                TxtNombre.Text            = "";
            }
            else if (CBSkin.SelectedIndex < 0)
            {
                CBSkin.PlaceholderText = "Elige una Skin";
            }
            else if (CBRango.SelectedIndex < 0)
            {
                CBRango.PlaceholderText = "Elige el Rango del usuario";
            }
            else
            {
                DateTimeOffset fecha = DPFecha.Date;
                try
                {
                    int dinero = 0;
                    try
                    {
                        dinero = Int32.Parse(TxtDinero.Text);
                    }
                    catch {
                    }

                    Jugador Nuevo = new Jugador(TxtNombre.Text, "Assets/" + CBSkin.SelectedItem.ToString() + ".Skin.png", (Rango)(CBRango.SelectedItem),
                                                dinero, fecha.Day, fecha.Month, fecha.Year);
                    if (editando == null)
                    {
                        AdminJugs.GetJugadores().Add(Nuevo);
                    }
                    else
                    {
                        int index = AdminJugs.GetJugadores().IndexOf(editando);
                        AdminJugs.GetJugadores().Insert(index, Nuevo);
                        AdminJugs.GetJugadores().Remove(editando);
                    }
                    AdminJugs.GuardarJugadores();
                    Frame.Navigate(typeof(NuevoJugRegistrado), (editando == null ? 0 : 1) + Nuevo.Nombre);
                    Frame.BackStack.RemoveAt(Frame.BackStack.Count - 1);
                }
                catch (Exception error)
                {
                    BtnAgregar.Background = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 255, 0, 0));
                    BtnAgregar.Content    = error.Message;
                }
            }
        }
        private async void MostrarConfirmarBorrar(int index)
        {
            Jugador       objetivo        = ListaJugadores.ElementAt(index);
            ContentDialog confirmarDialog = new ContentDialog
            {
                Title               = "¿Borrar definitivamente a " + objetivo.Nombre + "?",
                Content             = "Esta acción no podrá deshacerse y el cambio se guardará inmediatamente.",
                PrimaryButtonText   = "Borrar definitivamente",
                SecondaryButtonText = "Cancelar"
            };

            ContentDialogResult result = await confirmarDialog.ShowAsync();

            if (result.Equals(ContentDialogResult.Primary))
            {
                AdminJugs.GetJugadores().Remove(objetivo);
                AdminJugs.GuardarJugadores();
                GVVerJugs.ItemsSource = AdminJugs.GetJugadores();
                Frame.Navigate(typeof(VerJugadores), null, new SuppressNavigationTransitionInfo());
                Frame.BackStack.RemoveAt(Frame.BackStack.Count - 1);
            }
        }
 public VerJugadores()
 {
     this.InitializeComponent();
     ListaJugadores = AdminJugs.GetJugadores();
 }