Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
- using System.ComponentModel;
- using System.Threading;
- using Oregon_Trail.Classes;
- namespace Oregon_Trail.Windows
- {
- /// <summary>
- /// Interaction logic for Store.xaml
- /// </summary>
- public partial class Store : Window, INotifyPropertyChanged
- {
- public event PropertyChangedEventHandler PropertyChanged;
- protected void OnPropertyChanged(string property)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
- }
- private string textwintext;
- public string Textwintext
- {
- get
- {
- return textwintext;
- }
- set
- {
- textwintext = value; OnPropertyChanged("Textwintext");
- }
- }
- private string moneyTotal;
- public string MoneyTotal
- {
- get
- {
- return moneyTotal;
- }
- set
- {
- moneyTotal = value; OnPropertyChanged("MoneyTotal");
- }
- }
- private string descriptionbox;
- public string Descriptionbox
- {
- get
- {
- return descriptionbox;
- }
- set
- {
- descriptionbox = value; OnPropertyChanged("DescriptionBox");
- }
- }
- private string reccbox;
- public string Reccbox
- {
- get
- {
- return reccbox;
- }
- set
- {
- reccbox = value; OnPropertyChanged("Reccbox");
- }
- }
- private string billbox;
- public string Billbox
- {
- get
- {
- return billbox;
- }
- set
- {
- billbox = value; OnPropertyChanged("Billbox");
- }
- }
- public static List<string> Storelist = new List<string>();
- public Store()
- {
- InitializeComponent();
- for(int i = 0; i < db.GeneralStoreList.Count; i++)
- {
- string item = db.GeneralStoreList[i].ItemName;
- Storelist.Add(item);
- }
- ItemsList.ItemsSource = Storelist;
- Textwintext = "You have $1,200.00 to spend before you start your trip. You dont have to spend it all now.";
- }
- /*What needs to happen:
- *
- * -Get name of current selected object
- * -Get info of selected object
- * -assign info to properties
- */
- public static int listnum;
- private void ItemsList_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- if(ItemsList.SelectedIndex > 0)
- {
- string selected = ItemsList.SelectedItem.ToString();
- MessageBox.Show(selected);
- switch (selected)
- {
- case "Oxen":
- listnum = 0;
- break;
- case "Mules":
- listnum = 1;
- break;
- case "Clothes":
- listnum = 2;
- break;
- case "Food":
- listnum = 3;
- break;
- case "Ammunition":
- listnum = 4;
- break;
- }
- string desc, recc, price;
- desc = db.GeneralStoreList[listnum].ItemDesc;
- recc = db.GeneralStoreList[listnum].ItemRecc;
- price = db.GeneralStoreList[listnum].ItemPrice.ToString();
- Descriptionbox = desc;
- Reccbox = recc;
- Billbox = price;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement