Created
August 19, 2019 23:05
-
-
Save Sa1Gur/4e527beaa0f1ce3d88c96247c2ffcec8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
... | |
namespace In2TeamsSplitter.ViewModels | |
{ | |
class TeamMatesViewModel : INotifyPropertyChanged | |
{ | |
... | |
public TeamMatesViewModel() | |
{ | |
AddNewTeamMateCommand = new Command(() => AddNewTeamMate()); | |
... | |
} | |
public Command AddNewTeamMateCommand { get; } | |
private void AddNewTeamMate() | |
{ | |
try | |
{ | |
if (string.IsNullOrEmpty(AddName)) throw new Exception("Valid name required"); | |
int _ = conn.Insert(new TeamMateItem { Name = AddName, Level = AddLevel }); | |
TeamMateSquad.Add(new TeamMateItem { Name = AddName, Level = AddLevel }); | |
AddName = string.Empty; | |
AddLevel = uint.MinValue; | |
} | |
catch (Exception ex) | |
{ | |
Application.Current.MainPage.DisplayAlert("error", $"Failed to add {AddName}. Error: {ex.Message}", "Ok"); | |
} | |
} | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment