Advertisement
Tidall

cs

Dec 7th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.28 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Shapes;
  14. using System.ComponentModel;
  15. using System.Threading;
  16. using Oregon_Trail.Classes;
  17.  
  18. namespace Oregon_Trail.Windows
  19. {
  20.     /// <summary>
  21.     /// Interaction logic for Store.xaml
  22.     /// </summary>
  23.     public partial class Store : Window, INotifyPropertyChanged
  24.     {
  25.         public event PropertyChangedEventHandler PropertyChanged;
  26.  
  27.         protected void OnPropertyChanged(string property)
  28.         {
  29.             PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
  30.         }
  31.  
  32.         private string textwintext;
  33.         public string Textwintext
  34.         {
  35.             get
  36.             {
  37.                 return textwintext;
  38.             }
  39.  
  40.             set
  41.             {
  42.                 textwintext = value; OnPropertyChanged("Textwintext");
  43.             }
  44.         }
  45.  
  46.         private string moneyTotal;
  47.         public string MoneyTotal
  48.         {
  49.             get
  50.             {
  51.                 return moneyTotal;
  52.             }
  53.  
  54.             set
  55.             {
  56.                 moneyTotal = value; OnPropertyChanged("MoneyTotal");
  57.             }
  58.         }
  59.  
  60.         private string descriptionbox;
  61.         public string Descriptionbox
  62.         {
  63.             get
  64.             {
  65.                 return descriptionbox;
  66.             }
  67.  
  68.             set
  69.             {
  70.                 descriptionbox = value; OnPropertyChanged("DescriptionBox");
  71.             }
  72.         }
  73.  
  74.         private string reccbox;
  75.         public string Reccbox
  76.         {
  77.             get
  78.             {
  79.                 return reccbox;
  80.             }
  81.  
  82.             set
  83.             {
  84.                 reccbox = value; OnPropertyChanged("Reccbox");
  85.             }
  86.         }
  87.  
  88.         private string billbox;
  89.         public string Billbox
  90.         {
  91.             get
  92.             {
  93.                 return billbox;
  94.             }
  95.  
  96.             set
  97.             {
  98.                 billbox = value; OnPropertyChanged("Billbox");
  99.             }
  100.         }
  101.  
  102.         public static List<string> Storelist = new List<string>();
  103.  
  104.         public Store()
  105.         {
  106.             InitializeComponent();
  107.            
  108.             for(int i = 0; i < db.GeneralStoreList.Count; i++)
  109.             {
  110.                 string item = db.GeneralStoreList[i].ItemName;
  111.                 Storelist.Add(item);
  112.             }
  113.             ItemsList.ItemsSource = Storelist;
  114.  
  115.             Textwintext = "You have $1,200.00 to spend before you start your trip. You dont have to spend it all now.";
  116.         }
  117.  
  118.         /*What needs to happen:
  119.          *
  120.          * -Get name of current selected object
  121.          * -Get info of selected object
  122.          * -assign info to properties
  123.          */
  124.         public static int listnum;
  125.  
  126.         private void ItemsList_SelectionChanged(object sender, SelectionChangedEventArgs e)
  127.         {
  128.             if(ItemsList.SelectedIndex > 0)
  129.             {
  130.                 string selected = ItemsList.SelectedItem.ToString();
  131.                 MessageBox.Show(selected);
  132.  
  133.                 switch (selected)
  134.                 {
  135.                     case "Oxen":
  136.                         listnum = 0;
  137.                         break;
  138.                     case "Mules":
  139.                         listnum = 1;
  140.                         break;
  141.                     case "Clothes":
  142.                         listnum = 2;
  143.                         break;
  144.                     case "Food":
  145.                         listnum = 3;
  146.                         break;
  147.                     case "Ammunition":
  148.                         listnum = 4;
  149.                         break;
  150.                 }
  151.  
  152.                 string desc, recc, price;
  153.  
  154.                 desc = db.GeneralStoreList[listnum].ItemDesc;
  155.                 recc = db.GeneralStoreList[listnum].ItemRecc;
  156.                 price = db.GeneralStoreList[listnum].ItemPrice.ToString();
  157.  
  158.                 Descriptionbox = desc;
  159.                 Reccbox = recc;
  160.                 Billbox = price;
  161.             }
  162.         }
  163.     }
  164. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement