Révision 4afea73d

Voir les différences:

GES_PAC/Resources/Styles/Styles.xaml
490 490
        <Setter Property="VisualStateManager.VisualStateGroups">
491 491
            <VisualStateGroupList>
492 492
                <VisualStateGroup x:Name="CommonStates">
493
                    <VisualState x:Name="Normal">
493
                    <VisualState x:Name="Pressed">
494 494
                        <VisualState.Setters>
495
                            <Setter Property="BackgroundColor" Value="White"/>
496
                            <Setter Property="TextColor" Value="Black"/>
495
                            <Setter Property="Opacity" Value="0.6" />
497 496
                        </VisualState.Setters>
498 497
                    </VisualState>
499
                    <VisualState x:Name="Pressed">
498
                    <VisualState x:Name="Normal">
500 499
                        <VisualState.Setters>
501
                            <Setter Property="BackgroundColor" Value="#E0E0E0"/>
502
                            <Setter Property="TextColor" Value="Gray"/>
500
                            <Setter Property="Opacity" Value="1" />
503 501
                        </VisualState.Setters>
504 502
                    </VisualState>
505 503
                </VisualStateGroup>
GES_PAC/View/ChambersView.xaml
3 3
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4 4
             xmlns:vm="clr-namespace:GES_PAC.ViewModel"
5 5
             xmlns:tools="clr-namespace:GES_PAC.View.Tools"
6

  
6 7
             x:Class="GES_PAC.View.ChambersView"
7 8
             x:DataType="vm:ChambersViewModel">
8 9

  
......
24 25
                        <Border Stroke="Black" StrokeThickness="2" BackgroundColor="Transparent" HorizontalOptions="Center" StrokeShape="RoundRectangle 10">
25 26

  
26 27
                            <Grid
27
                                BackgroundColor="LightGray"
28
                                Padding="5"
29
                                RowSpacing="0"
30
                                ColumnSpacing="5"
31
                                WidthRequest="250"
32
                                HeightRequest="500">
28
    BackgroundColor="LightGray"
29
    Padding="5"
30
    RowSpacing="0"
31
    ColumnSpacing="5"
32
    WidthRequest="250"
33
    HeightRequest="500">
33 34

  
34 35
                                <Grid.ColumnDefinitions>
35 36
                                    <ColumnDefinition Width="Auto"/>
......
47 48
                                </Grid.RowDefinitions>
48 49

  
49 50
                                <!-- Boutons Gauche -->
50
                                <Button Grid.Row="5" Grid.Column="0" Text="1" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="1" BackgroundColor="{Binding ChamberColors[0]}"/>
51
                                <Button Grid.Row="4" Grid.Column="0" Text="3" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="3" BackgroundColor="{Binding ChamberColors[2]}"/>
52
                                <Button Grid.Row="3" Grid.Column="0" Text="5" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="5" BackgroundColor="{Binding ChamberColors[4]}"/>
53
                                <Button Grid.Row="2" Grid.Column="0" Text="7" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="7" BackgroundColor="{Binding ChamberColors[6]}"/>
54
                                <Button Grid.Row="1" Grid.Column="0" Text="9" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="9" BackgroundColor="{Binding ChamberColors[8]}"/>
55
                                <Button Grid.Row="0" Grid.Column="0" Text="11" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="11" BackgroundColor="{Binding ChamberColors[10]}"/>
51
                                <Grid Grid.Row="5" Grid.Column="0">
52
                                    <Button Text="1" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="1" BackgroundColor="{Binding ChamberColors[0]}" />
53
                                    <Label Text="{Binding ChamberNumbers[0]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" />
54
                                </Grid>
55
                                <Grid Grid.Row="4" Grid.Column="0">
56
                                    <Button Text="3" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="3" BackgroundColor="{Binding ChamberColors[2]}" />
57
                                    <Label Text="{Binding ChamberNumbers[2]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" />
58
                                </Grid>
59
                                <Grid Grid.Row="3" Grid.Column="0">
60
                                    <Button Text="5" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="5" BackgroundColor="{Binding ChamberColors[4]}" />
61
                                    <Label Text="{Binding ChamberNumbers[4]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" />
62
                                </Grid>
63
                                <Grid Grid.Row="2" Grid.Column="0">
64
                                    
65
                                    <Button Text="7" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="7" BackgroundColor="{Binding ChamberColors[6]}" />
66
                                    <Label Text="{Binding ChamberNumbers[6]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" />
67
                                </Grid>
68
                                <Grid Grid.Row="1" Grid.Column="0">
69
                                    <Button Text="9" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="9" BackgroundColor="{Binding ChamberColors[8]}" />
70
                                    <Label Text="{Binding ChamberNumbers[8]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" />
71
                                </Grid>
72
                                <Grid Grid.Row="0" Grid.Column="0">
73
                                    <Button Text="11" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="11" BackgroundColor="{Binding ChamberColors[10]}" />
74
                                    <Label Text="{Binding ChamberNumbers[10]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" />
75
                                </Grid>
56 76

  
57 77
                                <!-- Boutons Droite -->
58
                                <Button Grid.Row="5" Grid.Column="2" Text="2" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="2" BackgroundColor="{Binding ChamberColors[1]}"/>
59
                                <Button Grid.Row="4" Grid.Column="2" Text="4" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="4" BackgroundColor="{Binding ChamberColors[3]}"/>
60
                                <Button Grid.Row="3" Grid.Column="2" Text="6" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="6" BackgroundColor="{Binding ChamberColors[5]}"/>
61
                                <Button Grid.Row="2" Grid.Column="2" Text="8" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="8" BackgroundColor="{Binding ChamberColors[7]}"/>
62
                                <Button Grid.Row="1" Grid.Column="2" Text="10" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="10" BackgroundColor="{Binding ChamberColors[9]}"/>
63
                                <Button Grid.Row="0" Grid.Column="2" Text="12" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="12" BackgroundColor="{Binding ChamberColors[11]}"/>
78
                                <Grid Grid.Row="5" Grid.Column="2">
79
                                    <Button Text="2" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="2" BackgroundColor="{Binding ChamberColors[1]}" />
80
                                    <Label Text="{Binding ChamberNumbers[1]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" />
81
                                </Grid>
82
                                <Grid Grid.Row="4" Grid.Column="2">
83
                                    <Button Text="4" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="4" BackgroundColor="{Binding ChamberColors[3]}" />
84
                                    <Label Text="{Binding ChamberNumbers[3]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" />
85
                                </Grid>
86
                                <Grid Grid.Row="3" Grid.Column="2">
87
                                    <Button Text="6" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="6" BackgroundColor="{Binding ChamberColors[5]}" />
88
                                    <Label Text="{Binding ChamberNumbers[5]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" />
89
                                </Grid>
90
                                <Grid Grid.Row="2" Grid.Column="2">
91
                                    <Button Text="8" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="8" BackgroundColor="{Binding ChamberColors[7]}" />
92
                                    <Label Text="{Binding ChamberNumbers[7]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" />
93
                                </Grid>
94
                                <Grid Grid.Row="1" Grid.Column="2">
95
                                    <Button Text="10" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="10" BackgroundColor="{Binding ChamberColors[9]}" />
96
                                    <Label Text="{Binding ChamberNumbers[9]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" />
97
                                </Grid>
98
                                <Grid Grid.Row="0" Grid.Column="2">
99
                                    <Button Text="12" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="12" BackgroundColor="{Binding ChamberColors[11]}" />
100
                                    <Label Text="{Binding ChamberNumbers[11]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" />
101
                                </Grid>
64 102

  
65 103
                                <!-- Couloir central -->
66 104
                                <BoxView Grid.Column="1" Grid.RowSpan="6" HeightRequest="500" WidthRequest="75" Color="Gray"/>
67 105
                            </Grid>
106

  
68 107
                        </Border>
69 108

  
70 109
                        <!-- Arrow -->
GES_PAC/ViewModel/ChambersViewModel.cs
21 21
        public Dictionary<int, int> NumberMeasure { get; set; }
22 22

  
23 23
        public ObservableCollection<Color> ChamberColors { get; } = [];
24
        public ObservableCollection<int> ChamberNumbers { get; } = [];
24 25

  
25 26
        #endregion
26 27

  
......
28 29
        public ChambersViewModel()
29 30
        {
30 31
            NumberMeasure = JourneeViewModel.Instance.GetCurrentDay().GetCurrentSet().GetMeasureNumber();
31
            UpdateChamberColors();
32
            UpdateChamberDatas();
32 33

  
33 34
            OnClickChamberCommand = new Command<string>(async (idStr) =>
34 35
            {
......
42 43
        private async Task GoToEnterAnimal(int id)
43 44
        {
44 45
            IsBusy = true;
45
            await Shell.Current.GoToAsync($"{nameof(EnterAnimalView)}?chamberId={id}");
46

  
47
            if (!NumberMeasure.ContainsValue(id))
48
                await Shell.Current.GoToAsync($"{nameof(EnterAnimalView)}?chamberId={id}");
49
            else
50
                await Shell.Current.GoToAsync($"{nameof(CreateMeasureView)}?chamberId={id}");
51

  
46 52
            IsBusy = false;
47 53
        }
48 54

  
49
        private void UpdateChamberColors()
55
        private void UpdateChamberDatas()
50 56
        {
51 57
            ChamberColors.Clear();
52 58
            for (int i = 1; i <= 12; i++)
53 59
            {
54 60
                int count = NumberMeasure.TryGetValue(i, out var val) ? val : 0;
55 61
                ChamberColors.Add(count > 0 ? Colors.LightGreen : Colors.White);
62
                ChamberNumbers.Add(count);
56 63
            }
57 64
        }
58 65
        #endregion

Formats disponibles : Unified diff