Révision 957bebf1 GES_PAC/View/Controls/ChamberButtonView.xaml.cs
GES_PAC/View/Controls/ChamberButtonView.xaml.cs | ||
---|---|---|
8 | 8 |
public static readonly BindableProperty ChamberIdProperty = |
9 | 9 |
BindableProperty.Create(nameof(ChamberId), typeof(int), typeof(ChamberButtonView), default(int), propertyChanged: OnChamberIdChanged); |
10 | 10 |
|
11 |
public static readonly BindableProperty TimerProperty =
|
|
12 |
BindableProperty.Create(nameof(Timer), typeof(TimerPublisher), typeof(ChamberButtonView), propertyChanged: OnTimerChanged);
|
|
11 |
public static readonly BindableProperty ParentViewModelProperty =
|
|
12 |
BindableProperty.Create(nameof(ParentViewModel), typeof(ChambersViewModel), typeof(ChamberButtonView), propertyChanged: OnParentChanged);
|
|
13 | 13 |
|
14 |
public TimerPublisher? Timer
|
|
14 |
public ChambersViewModel? ParentViewModel
|
|
15 | 15 |
{ |
16 |
get => (TimerPublisher?)GetValue(TimerProperty);
|
|
17 |
set => SetValue(TimerProperty, value);
|
|
16 |
get => (ChambersViewModel?)GetValue(ParentViewModelProperty);
|
|
17 |
set => SetValue(ParentViewModelProperty, value);
|
|
18 | 18 |
} |
19 | 19 |
|
20 | 20 |
public int ChamberId |
... | ... | |
31 | 31 |
{ |
32 | 32 |
base.OnBindingContextChanged(); |
33 | 33 |
|
34 |
if (BindingContext is not ChamberButtonViewModel && ChamberId != 0 && Timer != null)
|
|
34 |
if (BindingContext is not ChamberButtonViewModel && ChamberId != 0 && ParentViewModel != null)
|
|
35 | 35 |
{ |
36 |
var vm = new ChamberButtonViewModel(ChamberId, Timer);
|
|
36 |
var vm = new ChamberButtonViewModel(ChamberId, ParentViewModel);
|
|
37 | 37 |
BindingContext = vm; |
38 | 38 |
vm.UpdateProperties(); |
39 | 39 |
} |
... | ... | |
48 | 48 |
vm.UpdateChamberId(id); |
49 | 49 |
} |
50 | 50 |
} |
51 |
private static void OnTimerChanged(BindableObject bindable, object oldValue, object newValue)
|
|
51 |
private static void OnParentChanged(BindableObject bindable, object oldValue, object newValue)
|
|
52 | 52 |
{ |
53 | 53 |
if (bindable is ChamberButtonView view) |
54 | 54 |
{ |
Formats disponibles : Unified diff