-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
214 additions
and
20 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
28 changes: 28 additions & 0 deletions
28
src/HyPlayer.App/Interfaces/Services/INavigationViewService.cs
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,28 @@ | ||
using Microsoft.UI.Xaml.Controls; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace HyPlayer.Interfaces.Services | ||
{ | ||
interface INavigationViewService | ||
{ | ||
IList<object>? MenuItems | ||
{ | ||
get; | ||
} | ||
|
||
object? SettingsItem | ||
{ | ||
get; | ||
} | ||
|
||
void Initialize(NavigationView navigationView); | ||
|
||
void UnregisterEvents(); | ||
|
||
NavigationViewItem? GetSelectedItem(Type pageType); | ||
} | ||
} |
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,66 @@ | ||
using HyPlayer.Helpers; | ||
using HyPlayer.Interfaces.Services; | ||
using HyPlayer.ViewModels; | ||
using Microsoft.UI.Xaml.Controls; | ||
using Microsoft.UI.Xaml.Navigation; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace HyPlayer.Services | ||
{ | ||
class NavigationViewService : INavigationViewService | ||
{ | ||
private readonly INavigationService _navigationService; | ||
private readonly IPageService _pageService; | ||
private NavigationView? _navigationView; | ||
|
||
public NavigationViewService(INavigationService navigationService, IPageService pageService) | ||
{ | ||
_navigationService = navigationService; | ||
_pageService = pageService; | ||
} | ||
|
||
public IList<object>? MenuItems => _navigationView.MenuItems; | ||
|
||
public object? SettingsItem => _navigationView.SettingsItem; | ||
|
||
public NavigationViewItem? GetSelectedItem(Type pageType) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void Initialize(NavigationView navigationView) | ||
{ | ||
_navigationView = navigationView; | ||
navigationView.ItemInvoked += OnItemInvoked; | ||
navigationView.BackRequested += OnBackRequested; | ||
} | ||
|
||
public void UnregisterEvents() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
private void OnBackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args) => _navigationService.GoBack(); | ||
|
||
private void OnItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args) | ||
{ | ||
if (args.IsSettingsInvoked) | ||
{ | ||
_navigationService.NavigateTo(typeof(SettingsViewModel).FullName!); | ||
} | ||
else | ||
{ | ||
var selectedItem = args.InvokedItemContainer as NavigationViewItem; | ||
|
||
if (selectedItem?.GetValue(NavigationHelper.NavigateToProperty) is string pageKey) | ||
{ | ||
_navigationService.NavigateTo(pageKey); | ||
} | ||
} | ||
} | ||
} | ||
} |
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,14 @@ | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using HyPlayer.Interfaces.ViewModels; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace HyPlayer.ViewModels | ||
{ | ||
public partial class SettingsViewModel : ObservableObject, IScopedViewModel | ||
{ | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<local:SettingsPageBase | ||
x:Class="HyPlayer.Views.Pages.SettingsPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:HyPlayer.Views.Pages" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | ||
|
||
<Grid> | ||
|
||
</Grid> | ||
</local:SettingsPageBase> |
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,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
using Microsoft.UI.Xaml; | ||
using Microsoft.UI.Xaml.Controls; | ||
using Microsoft.UI.Xaml.Controls.Primitives; | ||
using Microsoft.UI.Xaml.Data; | ||
using Microsoft.UI.Xaml.Input; | ||
using Microsoft.UI.Xaml.Media; | ||
using Microsoft.UI.Xaml.Navigation; | ||
using HyPlayer.Interfaces.Views; | ||
using HyPlayer.ViewModels; | ||
|
||
// To learn more about WinUI, the WinUI project structure, | ||
// and more about our project templates, see: http://aka.ms/winui-project-info. | ||
|
||
namespace HyPlayer.Views.Pages | ||
{ | ||
/// <summary> | ||
/// An empty page that can be used on its own or navigated to within a Frame. | ||
/// </summary> | ||
public sealed partial class SettingsPage : SettingsPageBase | ||
{ | ||
public SettingsPage() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
} | ||
|
||
public class SettingsPageBase : AppPageWithScopedViewModelBase<SettingsViewModel> | ||
{ | ||
|
||
} | ||
} |