forked from dotnet/maui-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding not implemented alerts, starting order types
- Loading branch information
1 parent
facec07
commit 8c50fca
Showing
10 changed files
with
96 additions
and
7 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
6.0/Apps/PointOfSale/src/PointOfSale/Models/EnumExtensions.cs
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System.ComponentModel; | ||
using System.Reflection; | ||
|
||
public static class EnumExtensions | ||
{ | ||
public static string GetDescription<T>(this T enumerationValue) | ||
where T : struct | ||
{ | ||
Type type = enumerationValue.GetType(); | ||
if (!type.IsEnum) | ||
{ | ||
throw new ArgumentException("EnumerationValue must be of Enum type", "enumerationValue"); | ||
} | ||
|
||
//Tries to find a DescriptionAttribute for a potential friendly name | ||
//for the enum | ||
MemberInfo[] memberInfo = type.GetMember(enumerationValue.ToString()); | ||
if (memberInfo != null && memberInfo.Length > 0) | ||
{ | ||
object[] attrs = memberInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false); | ||
|
||
if (attrs != null && attrs.Length > 0) | ||
{ | ||
//Pull out the description value | ||
return ((DescriptionAttribute)attrs[0]).Description; | ||
} | ||
} | ||
//If we have no description attribute, just return the ToString of the enum | ||
return enumerationValue.ToString(); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.ComponentModel; | ||
using System.Reflection; | ||
|
||
namespace PointOfSale.Models | ||
{ | ||
public enum OrderType | ||
{ | ||
[Description("Dine In")] | ||
DineIn, | ||
[Description("Carry Out")] | ||
CarryOut, | ||
[Description("Delivery")] | ||
Delivery | ||
} | ||
} | ||
|
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
12 changes: 12 additions & 0 deletions
12
6.0/Apps/PointOfSale/src/PointOfSale/Pages/DashboardViewModel.cs
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace PointOfSale.Pages; | ||
|
||
[INotifyPropertyChanged] | ||
public partial class DashboardViewModel | ||
{ | ||
[RelayCommand] | ||
async Task ViewAll() | ||
{ | ||
await App.Current.MainPage.DisplayAlert("Not Implemented", "Wouldn't it be nice tho?", "Okay"); | ||
} | ||
} | ||
|
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
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