Created
April 10, 2016 19:01
-
-
Save BrianJVarley/065773d71b1b5a0df8952779e7266178 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 Parking_Tag_Picker_WRT.ViewModel | |
| { | |
| public class TagRequestViewModel : INotifyPropertyChanged | |
| { | |
| public RelayCommand TagRequestCommand | |
| { | |
| get; | |
| private set; | |
| } | |
| public TagRequestViewModel() | |
| { | |
| LoadCommands(); | |
| } | |
| private async void LoadCommands() | |
| { | |
| TagRequestCommand = new RelayCommand(async () => | |
| { | |
| await SendParkingTagSMSRequest(); | |
| } ,CanSendCommand ); | |
| } | |
| private bool CanSendCommand() | |
| { | |
| if (SelectedParkDuration != null && RegNumber != string.Empty && SelectedZone.ZoneName != null) | |
| { | |
| return true; | |
| } | |
| return false; | |
| } | |
| private string _selectedCouncilId; | |
| public string SelectedCouncilId | |
| { | |
| get | |
| { | |
| return _selectedCouncilId; | |
| } | |
| set | |
| { | |
| if (_selectedCouncilId != value) | |
| { | |
| _selectedCouncilId = value; | |
| RaisePropertyChanged("SelectedCouncilId"); | |
| } | |
| } | |
| } | |
| private string _regNumber; | |
| public string RegNumber | |
| { | |
| get | |
| { | |
| return this._regNumber; | |
| } | |
| set | |
| { | |
| if (_regNumber != value) | |
| { | |
| _regNumber = value; | |
| RaisePropertyChanged("RegNumber"); | |
| } | |
| } | |
| } | |
| private ZoneInfo _selectedZone; | |
| public ZoneInfo SelectedZone | |
| { | |
| get | |
| { | |
| return this._selectedZone; | |
| } | |
| set | |
| { | |
| if (_selectedZone != value) | |
| { | |
| _selectedZone = value; | |
| RaisePropertyChanged("SelectedZone"); | |
| } | |
| } | |
| } | |
| private TimeSpan? _selectedParkDuration; | |
| public TimeSpan? SelectedParkDuration | |
| { | |
| get | |
| { | |
| return this._selectedParkDuration; | |
| } | |
| set | |
| { | |
| if (_selectedParkDuration != value) | |
| { | |
| _selectedParkDuration = value; | |
| RaisePropertyChanged("SelectedParkDuration"); | |
| } | |
| } | |
| } | |
| public async Task SendParkingTagSMSRequest() | |
| { | |
| await SMSTaskExtensions.SendParkingTagSMSRequest(SelectedZone, RegNumber, SelectedParkDuration); | |
| } | |
| public event PropertyChangedEventHandler PropertyChanged; | |
| public void RaisePropertyChanged(string prop) | |
| { | |
| if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(prop)); } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment