Guest User

Untitled

a guest
Jul 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Data;
  8. using System.Windows.Documents;
  9. using System.Windows.Input;
  10. using System.Windows.Media;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Navigation;
  13. using System.Windows.Shapes;
  14. using System.Collections.ObjectModel;
  15. using KolonistenService;
  16.  
  17. namespace WpfApplication1
  18. {
  19. /// <summary>
  20. /// Interaction logic for ucStats.xaml
  21. /// </summary>
  22. public partial class ucStats : UserControl
  23. {
  24. ObservableCollection<SpelerResource> _ResourceCollection = new ObservableCollection<SpelerResource>();
  25. public ObservableCollection<SpelerResource> ResourceCollection { get { return _ResourceCollection; } }
  26.  
  27. Speler Speler { get; set; }
  28.  
  29. public ucStats(Speler s,Color c)
  30. {
  31. InitializeComponent();
  32. setImages();
  33. Speler = s;
  34. SpelerNaam.Content = s.Naam;
  35. SpelerKleur.Fill = new SolidColorBrush(c);
  36. ResourceCollection.Add(SpelerResource.instance);
  37. }
  38. private void setImages()
  39. {
  40. ImageSourceConverter c = new ImageSourceConverter();
  41. String p = Environment.CurrentDirectory;
  42. Graan.Source = (ImageSource)(c.ConvertFromString(p + "\\Resources\\Graan.png"));
  43. Erts.Source = (ImageSource)(c.ConvertFromString(p + "\\Resources\\Erts.png"));
  44. Hout.Source = (ImageSource)(c.ConvertFromString(p + "\\Resources\\Hout.png"));
  45. Steen.Source = (ImageSource)(c.ConvertFromString(p + "\\Resources\\Steen.png"));
  46. Wol.Source = (ImageSource)(c.ConvertFromString(p + "\\Resources\\Wol.png"));
  47. }
  48. public void setResources(int G, int E, int H, int S, int W)
  49. {
  50. ResourceCollection[0] = SpelerResource.setResources(G,E,H,S,W);
  51. lvwResources.Items.Refresh();
  52.  
  53. }
  54. public class SpelerResource
  55. {
  56. public int Graan { get; set; }
  57. public int Erts { get; set; }
  58. public int Hout { get; set; }
  59. public int Steen { get; set; }
  60. public int Wol { get; set; }
  61.  
  62. public static SpelerResource instance = new SpelerResource();
  63.  
  64. private SpelerResource() { }
  65. public static SpelerResource setResources(int G, int E, int H, int S, int W)
  66. {
  67. instance.Graan = G; instance.Erts = E; instance.Hout = H; instance.Steen = S; instance.Wol = W;
  68. return instance;
  69. }
  70. }
  71. }
  72. }
Add Comment
Please, Sign In to add comment