public void OnClaim(ApplianceViewModel avm) { UriBuilder fullUri = new UriBuilder("http://lndr.me/receive.json"); fullUri.Query = String.Format("key={0}&id={1}&email={2}",_("ServerKey"),avm.Id,_("DefaultEMail")); // initialize a new WebRequest HttpWebRequest lndrRequest = (HttpWebRequest)WebRequest.Create(fullUri.Uri); // set up the state object for the async request LndrUpdateState lndrUpdateState = new LndrUpdateState(); lndrUpdateState.AsyncRequest = lndrRequest; // start the asynchronous request lndrRequest.BeginGetResponse(new AsyncCallback(HandleUpdateResponse), lndrUpdateState); }
/// <summary> /// Creates and adds a few ItemViewModel objects into the Items collection. /// </summary> public void LoadData() { // Sample data; replace with real data //AddAppliance(new ApplianceViewModel() { Appliance = ApplianceViewModel.ApplianceType.WASHER, Id = 1, Name = "Washer 1", Busy = false, FreeAt = DateTime.Now }); //AddAppliance(new ApplianceViewModel() { Appliance = ApplianceViewModel.ApplianceType.WASHER, Id = 2, Name = "Washer 2", Busy = true, FreeAt = DateTime.Now.AddHours(1.2) }); //AddAppliance(new ApplianceViewModel() { Appliance = ApplianceViewModel.ApplianceType.DRYER, Id = 3, Name = "Dryer 1", Busy = true, FreeAt = DateTime.Now.AddMinutes(42) }); //AddAppliance(new ApplianceViewModel() { Appliance = ApplianceViewModel.ApplianceType.DRYER, Id = 4, Name = "Dryer 2", Busy = false, FreeAt = DateTime.Now }); this.IsDataLoaded = false; Clear(); UriBuilder fullUri = new UriBuilder(_("ServerBaseURI") + _("ServerStatusEndpoint")); fullUri.Query = String.Format("key={0}", _("ServerKey")); // initialize a new WebRequest HttpWebRequest lndrRequest = (HttpWebRequest)WebRequest.Create(fullUri.Uri); // set up the state object for the async request LndrUpdateState lndrUpdateState = new LndrUpdateState(); lndrUpdateState.AsyncRequest = lndrRequest; // start the asynchronous request lndrRequest.BeginGetResponse(new AsyncCallback(HandleIndexResponse), lndrUpdateState); }