-
Notifications
You must be signed in to change notification settings - Fork 3
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
3 changed files
with
107 additions
and
29 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 |
---|---|---|
@@ -1,29 +1,41 @@ | ||
using Windows.System; | ||
using CommunityToolkit.WinUI.Controls; | ||
using Microsoft.UI.Xaml; | ||
using Moder.Core.Services.Config; | ||
using Moder.Core.ViewsModels.Menus; | ||
using Windows.System; | ||
|
||
namespace Moder.Core.Views.Menus; | ||
|
||
public sealed partial class SettingsControlView | ||
{ | ||
public SettingsControlViewModel ViewModel => (SettingsControlViewModel)DataContext; | ||
public SettingsControlView(SettingsControlViewModel settingsViewModel) | ||
{ | ||
InitializeComponent(); | ||
private readonly GlobalSettingService _globalSettingService; | ||
public SettingsControlViewModel ViewModel => (SettingsControlViewModel)DataContext; | ||
|
||
public SettingsControlView(SettingsControlViewModel settingsViewModel, GlobalSettingService globalSettingService) | ||
{ | ||
_globalSettingService = globalSettingService; | ||
InitializeComponent(); | ||
|
||
DataContext = settingsViewModel; | ||
} | ||
|
||
DataContext = settingsViewModel; | ||
} | ||
private async void OnRootPathCardClicked(object sender, RoutedEventArgs e) | ||
{ | ||
var card = (SettingsCard)sender; | ||
await Launcher.LaunchFolderPathAsync(card.Description.ToString()); | ||
} | ||
|
||
private async void OnRootPathCardClicked(object sender, RoutedEventArgs e) | ||
{ | ||
var card = (SettingsCard)sender; | ||
await Launcher.LaunchFolderPathAsync(card.Description.ToString()); | ||
} | ||
private async void OnGitHubUrlCardClicked(object sender, RoutedEventArgs e) | ||
{ | ||
var card = (SettingsCard)sender; | ||
await Launcher.LaunchUriAsync(new Uri(card.Description.ToString() ?? throw new InvalidOperationException())); | ||
} | ||
|
||
private async void OnGitHubUrlCardClicked(object sender, RoutedEventArgs e) | ||
{ | ||
var card = (SettingsCard)sender; | ||
await Launcher.LaunchUriAsync(new Uri(card.Description.ToString() ?? throw new InvalidOperationException())); | ||
} | ||
} | ||
/// <summary> | ||
/// 如果有更改,保存更改 | ||
/// </summary> | ||
public void SaveChanged() | ||
{ | ||
_globalSettingService.SaveChanged(); | ||
} | ||
} |