コード例 #1
0
 private void userContextMenuRemovePoints_Click(object sender, RoutedEventArgs e)
 {
     MenuItem menuItem = sender as MenuItem;
     if (menuItem != null)
     {
         PgUser user = menuItem.CommandParameter as PgUser;
         if (user != null)
         {
             HomeTab.InputValueDialog inputDialog = new InputValueDialog();
             var result = inputDialog.ShowDialog();
             if (result == false)
                 return;
             var pointsCount = Convert.ToInt32(inputDialog.Value);
             _lobbySession.RemovePoints(user, pointsCount);
         }
         listBoxMembership.Items.Refresh();
     }
 }
コード例 #2
0
 private void userContextMenuCreditPoints_Click(object sender, RoutedEventArgs e)
 {
     MenuItem menuItem = sender as MenuItem;
     if (menuItem != null)
     {
         PgUser user = menuItem.CommandParameter as PgUser;
         if (user != null)
         {
             HomeTab.InputValueDialog inputDialog = new InputValueDialog();
             var result = inputDialog.ShowDialog();
             if (result == false)
                 return;
             var pointsCount = 0;
             try
             {
                 pointsCount = Convert.ToInt32(inputDialog.Value);
             }
             catch
             {
                 MessageBox.Show(this, "The operation ss not completed. Bad data format.");
                 return;
             }
             _lobbySession.CreditPoints(user, pointsCount);
         }
         listBoxMembership.Items.Refresh();
     }
 }