示例#1
0
 /// <summary>
 /// Event handler for when the user selects an item in the list
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void LbAllItems_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if (lbAllItems.SelectedIndex > -1)
         {
             clsItemsLogic.Item clickedItem = (clsItemsLogic.Item)e.AddedItems[0];
             setSelectedItem(clickedItem);
         }
     }
     catch (Exception ex)
     {
         HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                     MethodInfo.GetCurrentMethod().Name, ex.Message);
     }
 }
示例#2
0
 /// <summary>
 /// View logic for when an item is selected.
 /// </summary>
 /// <param name="item">Item Struct containing the current item</param>
 private void setSelectedItem(clsItemsLogic.Item item)
 {
     try
     {
         currentItem            = item;
         lblItemCodeVal.Content = item.ItemCode;
         tbDescVal.Text         = item.ItemDesc;
         tbCostVal.Text         = item.Cost.ToString();
         btnSave.IsEnabled      = true;
     }
     catch (Exception ex)
     {
         HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                     MethodInfo.GetCurrentMethod().Name, ex.Message);
     }
 }
示例#3
0
 /// <summary>
 /// clears the selected Item
 /// </summary>
 private void clearSelectedItem()
 {
     try
     {
         var empty = new clsItemsLogic.Item();
         lbAllItems.SelectedIndex = -1;
         lblItemCodeVal.Content   = "";
         tbCostVal.Text           = "";
         tbDescVal.Text           = "";
         setSelectedItem(empty);
     }
     catch (Exception ex)
     {
         HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                     MethodInfo.GetCurrentMethod().Name, ex.Message);
     }
 }