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.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.Navigation;
- using System.Windows.Shapes;
- using System.Collections.ObjectModel;
- using KolonistenService;
- namespace WpfApplication1
- {
- /// <summary>
- /// Interaction logic for ucStats.xaml
- /// </summary>
- public partial class ucStats : UserControl
- {
- ObservableCollection<SpelerResource> _ResourceCollection = new ObservableCollection<SpelerResource>();
- public ObservableCollection<SpelerResource> ResourceCollection { get { return _ResourceCollection; } }
- Speler Speler { get; set; }
- public ucStats(Speler s,Color c)
- {
- InitializeComponent();
- setImages();
- Speler = s;
- SpelerNaam.Content = s.Naam;
- SpelerKleur.Fill = new SolidColorBrush(c);
- ResourceCollection.Add(SpelerResource.instance);
- }
- private void setImages()
- {
- ImageSourceConverter c = new ImageSourceConverter();
- String p = Environment.CurrentDirectory;
- Graan.Source = (ImageSource)(c.ConvertFromString(p + "\\Resources\\Graan.png"));
- Erts.Source = (ImageSource)(c.ConvertFromString(p + "\\Resources\\Erts.png"));
- Hout.Source = (ImageSource)(c.ConvertFromString(p + "\\Resources\\Hout.png"));
- Steen.Source = (ImageSource)(c.ConvertFromString(p + "\\Resources\\Steen.png"));
- Wol.Source = (ImageSource)(c.ConvertFromString(p + "\\Resources\\Wol.png"));
- }
- public void setResources(int G, int E, int H, int S, int W)
- {
- ResourceCollection[0] = SpelerResource.setResources(G,E,H,S,W);
- lvwResources.Items.Refresh();
- }
- public class SpelerResource
- {
- public int Graan { get; set; }
- public int Erts { get; set; }
- public int Hout { get; set; }
- public int Steen { get; set; }
- public int Wol { get; set; }
- public static SpelerResource instance = new SpelerResource();
- private SpelerResource() { }
- public static SpelerResource setResources(int G, int E, int H, int S, int W)
- {
- instance.Graan = G; instance.Erts = E; instance.Hout = H; instance.Steen = S; instance.Wol = W;
- return instance;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment