forked from VladislavAntonyuk/MauiSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainPage.xaml.cs
33 lines (29 loc) · 971 Bytes
/
MainPage.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
namespace MauiPaint;
using System.Windows.Input;
public partial class MainPage : ContentPage
{
public MainPage(MainPageViewModel mainPageViewModel, IDeviceInfo deviceInfo)
{
InitializeComponent();
if (deviceInfo.Platform == DevicePlatform.Android || deviceInfo.Platform == DevicePlatform.iOS)
{
AddToolbarItem("New", mainPageViewModel.NewCommand);
AddToolbarItem("Open", mainPageViewModel.OpenCommand);
AddToolbarItem("Save Project", mainPageViewModel.SaveCommand);
AddToolbarItem("Save Image", mainPageViewModel.SaveImageCommand);
AddToolbarItem("Toggle Theme", mainPageViewModel.ToggleThemeCommand);
AddToolbarItem("Help", mainPageViewModel.HelpCommand);
AddToolbarItem("About", mainPageViewModel.AboutCommand);
}
BindingContext = mainPageViewModel;
}
void AddToolbarItem(string text, ICommand command)
{
var toolbarItem = new ToolbarItem()
{
Text = text,
Command = command
};
ToolbarItems.Add(toolbarItem);
}
}