コード例 #1
0
 //Cancelar Button functionality -- Remove everything from the dictionary
 private void Borrar_Jugada(object sender, RoutedEventArgs e)
 {
     if (this.listaDeNumeros.previewDictionary.Count > 0)
     {
         Jugada_Puntos.Clear();
         UpdateItemsOnListaPreviaDeNumeros();
     }
 }
コード例 #2
0
 //Minus Button functionality -- Remove only selected item from the  dictionary
 private void Eliminar_Numero(object sender, RoutedEventArgs e)
 {
     if (this.listaDeNumeros.previewDictionary.Count > 0)
     {
         var keys = string.Join(",", VistaPrevia.SelectedItems.OfType <KeyValuePair <string, int> >().Select(x => x.Key.ToString()));
         Jugada_Puntos.Remove(keys);
         UpdateItemsOnListaPreviaDeNumeros();
     }
 }
コード例 #3
0
        //Update the list view of the dictionary after an item has been added or removed
        public void UpdateItemsOnListaPreviaDeNumeros()
        {
            VistaPrevia.ItemsSource = Jugada_Puntos;
            VistaPrevia.Items.Refresh();
            VistaPrevia.SelectedIndex = VistaPrevia.Items.Count - 1;
            VistaPrevia.ScrollIntoView(VistaPrevia.SelectedItem);
            int    itemsTotal = Jugada_Puntos.Sum(v => v.Value);
            string price      = (itemsTotal.ToString() + ".00 € ");

            totalSum.Text = price;
        }