-
-
Notifications
You must be signed in to change notification settings - Fork 805
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend navigation aware pages with
INavigableView<T>
interface
- Loading branch information
1 parent
a792c0c
commit 838cd35
Showing
21 changed files
with
245 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// This Source Code Form is subject to the terms of the MIT License. | ||
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT. | ||
// Copyright (C) Leszek Pomianowski and WPF UI Contributors. | ||
// All Rights Reserved. | ||
|
||
using Wpf.Ui.Common.Interfaces; | ||
using Wpf.Ui.Demo.Services.Contracts; | ||
using Wpf.Ui.Mvvm.Contracts; | ||
|
||
namespace Wpf.Ui.Demo.ViewModels; | ||
|
||
public class DashboardViewModel : Wpf.Ui.Mvvm.ViewModelBase, INavigationAware | ||
{ | ||
private readonly INavigationService _navigationService; | ||
|
||
private readonly ITestWindowService _testWindowService; | ||
|
||
public DashboardViewModel(INavigationService navigationService, ITestWindowService testWindowService) | ||
{ | ||
_navigationService = navigationService; | ||
_testWindowService = testWindowService; | ||
} | ||
|
||
protected override void OnViewCommand(object parameter = null) | ||
{ | ||
if (parameter is not string parameterString) | ||
return; | ||
|
||
if (parameterString.StartsWith("navigate_to")) | ||
OnNavigateCommand(parameterString); | ||
|
||
if (parameterString.StartsWith("open_window")) | ||
OnOpenWindowCommand(parameterString); | ||
} | ||
|
||
public void OnNavigatedTo() | ||
{ | ||
System.Diagnostics.Debug.WriteLine($"INFO | {typeof(DashboardViewModel)} navigated", "Wpf.Ui.Demo"); | ||
} | ||
|
||
public void OnNavigatedFrom() | ||
{ | ||
System.Diagnostics.Debug.WriteLine($"INFO | {typeof(DashboardViewModel)} navigated", "Wpf.Ui.Demo"); | ||
} | ||
|
||
private void OnNavigateCommand(string parameter) | ||
{ | ||
switch (parameter) | ||
{ | ||
case "navigate_to_input": | ||
_navigationService.Navigate(typeof(Views.Pages.Input)); | ||
return; | ||
|
||
case "navigate_to_controls": | ||
_navigationService.Navigate(typeof(Views.Pages.Controls)); | ||
return; | ||
|
||
case "navigate_to_colors": | ||
_navigationService.Navigate(typeof(Views.Pages.Colors)); | ||
return; | ||
|
||
case "navigate_to_icons": | ||
_navigationService.Navigate(typeof(Views.Pages.Icons)); | ||
return; | ||
} | ||
} | ||
|
||
private void OnOpenWindowCommand(string parameter) | ||
{ | ||
switch (parameter) | ||
{ | ||
case "open_window_store": | ||
_testWindowService.Show<Views.Windows.StoreWindow>(); | ||
return; | ||
|
||
case "open_window_manager": | ||
_testWindowService.Show<Views.Windows.TaskManagerWindow>(); | ||
return; | ||
|
||
case "open_window_editor": | ||
_testWindowService.Show<Views.Windows.EditorWindow>(); | ||
return; | ||
|
||
case "open_window_settings": | ||
_testWindowService.Show<Views.Windows.SettingsWindow>(); | ||
return; | ||
|
||
case "open_window_experimental": | ||
_testWindowService.Show<Views.Windows.ExperimentalWindow>(); | ||
return; | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.