I18NCommander/I18N Commander/UI MAUI/AppShell.xaml.cs

34 lines
1.2 KiB
C#

using System.ComponentModel;
namespace UI_MAUI;
public partial class AppShell : Shell, INotifyPropertyChanged
{
private bool isOpen = DeviceInfo.Idiom == DeviceIdiom.Phone || DeviceInfo.Idiom == DeviceIdiom.Tablet;
public double CurrentFlyoutWidth => this.isOpen ? 200 : 90;
public string TextLoadProject => this.isOpen ? "Load Project" : string.Empty;
public string TextSettings => this.isOpen ? "Settings" : string.Empty;
public string TextTranslations => this.isOpen ? "Translations" : string.Empty;
public string TextToggle => this.isOpen ? "Toggle menu" : string.Empty;
public AppShell()
{
this.InitializeComponent();
}
private void MenuItemToggle_OnClicked(object sender, EventArgs e)
{
this.isOpen = !this.isOpen;
this.OnPropertyChanged(nameof(this.CurrentFlyoutWidth));
this.OnPropertyChanged(nameof(this.TextSettings));
this.OnPropertyChanged(nameof(this.TextTranslations));
this.OnPropertyChanged(nameof(this.TextLoadProject));
this.OnPropertyChanged(nameof(this.TextToggle));
this.InvalidateMeasure();
}
}