Subversion Repository Public Repository

Nextrek

Diff Revisions 659 vs 660 for /Android/SmartCharging/SmartCharging_WP/SmartCharging/ChargeRating.xaml.cs

Diff revisions: vs.
  @@ -19,9 +19,68 @@
19 19 {
20 20 public sealed partial class ChargeRating : UserControl
21 21 {
22 + public static readonly DependencyProperty EditableProperty = DependencyProperty.Register("Editable", typeof(bool), typeof(ChargeRating), null);
23 + public bool Editable
24 + {
25 + get
26 + {
27 + return (bool)this.GetValue(EditableProperty);
28 + }
29 + set
30 + {
31 + this.SetValue(EditableProperty, value);
32 + }
33 + }
34 + public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(double), typeof(ChargeRating), null);
35 + public double Value
36 + {
37 + get
38 + {
39 + return (double)this.GetValue(ValueProperty);
40 + }
41 + set
42 + {
43 + this.SetValue(ValueProperty, value);
44 + }
45 + }
46 +
47 +
22 48 public ChargeRating()
23 49 {
24 50 this.InitializeComponent();
25 51 }
52 +
53 +
54 + private void Image_Tapped_1(object sender, TappedRoutedEventArgs e)
55 + {
56 + this.setRatingValue(1);
57 + }
58 +
59 + private void Image_Tapped_2(object sender, TappedRoutedEventArgs e)
60 + {
61 + this.setRatingValue(2);
62 + }
63 +
64 + private void Image_Tapped_3(object sender, TappedRoutedEventArgs e)
65 + {
66 + this.setRatingValue(3);
67 + }
68 +
69 + private void Image_Tapped_4(object sender, TappedRoutedEventArgs e)
70 + {
71 + this.setRatingValue(4);
72 + }
73 +
74 + private void Image_Tapped_5(object sender, TappedRoutedEventArgs e)
75 + {
76 + this.setRatingValue(5);
77 + }
78 +
79 + private void setRatingValue(int value){
80 + if (this.Editable)
81 + {
82 + this.Value = value;
83 + }
84 + }
26 85 }
27 86 }