mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-07 23:45:05 +00:00
MapMenuItem
This commit is contained in:
parent
616b2bf3f7
commit
3f16d1d637
10 changed files with 54 additions and 82 deletions
30
MapUiTools/Shared/MapMenuItem.cs
Normal file
30
MapUiTools/Shared/MapMenuItem.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
using System.Threading.Tasks;
|
||||
|
||||
namespace MapControl.UiTools
|
||||
{
|
||||
public abstract partial class MapMenuItem
|
||||
{
|
||||
public abstract Task ExecuteAsync(MapBase map);
|
||||
|
||||
protected abstract bool GetIsChecked(MapBase map);
|
||||
|
||||
protected virtual bool GetIsEnabled(MapBase map) => true;
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
if (DataContext is MapBase map)
|
||||
{
|
||||
IsEnabled = GetIsEnabled(map);
|
||||
IsChecked = GetIsChecked(map);
|
||||
}
|
||||
}
|
||||
|
||||
private async void Execute()
|
||||
{
|
||||
if (DataContext is MapBase map)
|
||||
{
|
||||
await ExecuteAsync(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue