Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed mime types button not updating after install/uninstall #241

Merged
merged 4 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public class MainWindowViewModel : BaseModel
private float _volumeBeforeMute;
private string _backendText;

private bool _areMimeTypesRegistered = FileAssociationHelper.AreMimeTypesRegistered;
private bool _canUpdate = true;
private Cursor _cursor;
private string _title;
Expand Down Expand Up @@ -804,10 +805,15 @@ public bool ManageFileTypesVisible
{
get => FileAssociationHelper.IsTypeAssociationSupported;
}

public bool AreMimeTypesRegistered
{
get => FileAssociationHelper.AreMimeTypesRegistered;
get => _areMimeTypesRegistered;
set {
_areMimeTypesRegistered = value;

OnPropertyChanged();
}
}

public ObservableCollectionExtended<ApplicationData> Applications
Expand Down
6 changes: 4 additions & 2 deletions src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,17 @@ private void ScanAmiiboMenuItem_AttachedToVisualTree(object sender, VisualTreeAt

private async void InstallFileTypes_Click(object sender, RoutedEventArgs e)
{
if (FileAssociationHelper.Install())
ViewModel.AreMimeTypesRegistered = FileAssociationHelper.Install();
if (ViewModel.AreMimeTypesRegistered)
await ContentDialogHelper.CreateInfoDialog(LocaleManager.Instance[LocaleKeys.DialogInstallFileTypesSuccessMessage], string.Empty, LocaleManager.Instance[LocaleKeys.InputDialogOk], string.Empty, string.Empty);
else
await ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance[LocaleKeys.DialogInstallFileTypesErrorMessage]);
}

private async void UninstallFileTypes_Click(object sender, RoutedEventArgs e)
{
if (FileAssociationHelper.Uninstall())
ViewModel.AreMimeTypesRegistered = !FileAssociationHelper.Uninstall();
if (!ViewModel.AreMimeTypesRegistered)
await ContentDialogHelper.CreateInfoDialog(LocaleManager.Instance[LocaleKeys.DialogUninstallFileTypesSuccessMessage], string.Empty, LocaleManager.Instance[LocaleKeys.InputDialogOk], string.Empty, string.Empty);
else
await ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance[LocaleKeys.DialogUninstallFileTypesErrorMessage]);
Expand Down