From 69e4027cf95c93325598d855771fcaf7348666c3 Mon Sep 17 00:00:00 2001
From: Paul-Winpenny <92634321+Paul-Winpenny@users.noreply.github.com>
Date: Wed, 18 Dec 2024 12:44:13 +0000
Subject: [PATCH] Requesting the new map is now a button in the top left of the
 page

---
 App/RobobinApp/ViewModels/MainPageViewModel.cs | 8 +++++++-
 App/RobobinApp/Views/MainPage.xaml             | 2 +-
 App/RobobinApp/Views/MainPage_Android.xaml     | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/App/RobobinApp/ViewModels/MainPageViewModel.cs b/App/RobobinApp/ViewModels/MainPageViewModel.cs
index 910c53d1..7b06e166 100644
--- a/App/RobobinApp/ViewModels/MainPageViewModel.cs
+++ b/App/RobobinApp/ViewModels/MainPageViewModel.cs
@@ -29,6 +29,7 @@ namespace RobobinApp.ViewModels
         public ObservableCollection<Graph> Graphs { get; }
         public ICommand SelectGraphCommand { get; }
         public ICommand ToggleModeCommand { get; }
+        public ICommand GetNewGraphCommand { get; }
         public Graph Graph
         {
             get => _selectedGraph;
@@ -55,6 +56,7 @@ namespace RobobinApp.ViewModels
             ConnectToRobobinCommand = new Command(async () => await OnConnectToRobobin());
 
             ToggleModeCommand = new Command(async () => await OnToggleMode());
+            GetNewGraphCommand = new Command(async () => await GetNewGraph());
             var graphNodes1 = new List<Node>
 
 {
@@ -110,7 +112,11 @@ namespace RobobinApp.ViewModels
             Graph = Graphs.First();
         }
 
-    
+        private async Task GetNewGraph()
+        {
+            await App.WifiManager.SendMessageAsync("REQMAP");
+        }
+
         public static (float magnitude, float angle)[,] CalculatePolarConnections(List<Node> nodes, bool[,] connections)
         {
             int nodeCount = nodes.Count;
diff --git a/App/RobobinApp/Views/MainPage.xaml b/App/RobobinApp/Views/MainPage.xaml
index 76368439..4665f205 100644
--- a/App/RobobinApp/Views/MainPage.xaml
+++ b/App/RobobinApp/Views/MainPage.xaml
@@ -33,7 +33,7 @@
                              VerticalOptions="FillAndExpand"
                              Grid.Column="0" Grid.Row="0">
             <HorizontalStackLayout HorizontalOptions="Start" VerticalOptions="End">
-                <Button Text="Get Graph" Command="{Binding ConnectToRobobinCommand}"/>
+                <Button Text="Get Graph" Command="{Binding GetNewGraphCommand}"/>
                 <Button Text="Setup" Command="{Binding ConnectToRobobinCommand}"/>
             </HorizontalStackLayout>
             <sides:ModeBox />
diff --git a/App/RobobinApp/Views/MainPage_Android.xaml b/App/RobobinApp/Views/MainPage_Android.xaml
index 697e545f..2fa12d5e 100644
--- a/App/RobobinApp/Views/MainPage_Android.xaml
+++ b/App/RobobinApp/Views/MainPage_Android.xaml
@@ -28,7 +28,7 @@
                                  HorizontalOptions="FillAndExpand" 
                                  VerticalOptions="Start">
                 <HorizontalStackLayout HorizontalOptions="Start" VerticalOptions="End">
-                    <Button Text="Admin" Command="{Binding ConnectToRobobinCommand}"/>
+                    <Button Text="Get Graph" Command="{Binding GetNewGraphCommand}"/>
                     <Button Text="Setup" Command="{Binding ConnectToRobobinCommand}"/>
                     <Button Text="Info" Command= "{Binding GoToHelpPage}"/>
                     <Button Text="Switch Mode (Follow/Call)" Command="{Binding ToggleModeCommand}"/>
-- 
GitLab