Skip to content

Commit

Permalink
Added the possibility to navigate to the ConnectionPage (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Peyronnet committed Mar 19, 2021
1 parent 92ce457 commit f151d88
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions InternetTest/InternetTest/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ MIT License
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
using InternetTest.Classes;
using System;
using System.Collections.Generic;
using System.Configuration;
Expand All @@ -36,5 +37,11 @@ namespace InternetTest
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
Global.ConnectionPage = new(); // Create a new ConnectionPage

base.OnStartup(e);
}
}
}
6 changes: 6 additions & 0 deletions InternetTest/InternetTest/Classes/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ MIT License
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
using InternetTest.Pages;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -35,6 +36,11 @@ namespace InternetTest.Classes
/// </summary>
public static class Global
{
/// <summary>
/// The <see cref="Pages.ConnectionPage"/>.
/// </summary>
public static ConnectionPage ConnectionPage { get; set; }

/// <summary>
/// The current version of InternetTest.
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions InternetTest/InternetTest/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public MainWindow()
private void InitUI()
{
HelloTxt.Text = Global.GetHiSentence; // Set the "Hello" message
PageContent.Content = Global.ConnectionPage; // Go to the home page

CheckButton(ConnectionBtn); // Check the start page button
}
Expand Down Expand Up @@ -112,6 +113,8 @@ private void ConnectionBtn_Click(object sender, RoutedEventArgs e)
{
ResetAllCheckStatus(); // Reset the background and foreground of all buttons
CheckButton(ConnectionBtn); // Check the "Settings" button

PageContent.Navigate(Global.ConnectionPage); // Navigate
}

private void LocalizeIPBtn_Click(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit f151d88

Please sign in to comment.