public override async void Activated(object args) { base.Activated(args); var proxy = TinyIoCContainer.Current.Resolve <IGetChargesServiceProxy>(); using (EnterBusy()) { var result = await proxy.GetServicesAsync(); if (!(result.HasErrors)) { foreach (var item in result.Services) { if (item.Id == MFundiRuntime.ServiceTypeID) { Cost = item.Cost.ToString(); return; } } } else { errors.CopyFrom(result); } if (errors.HasErrors) { await Host.ShowAlertAsync(errors); } } }
private async void Submit(CommandExecutionContext context) { if (context == null) { context = new CommandExecutionContext(); } ErrorBucket errors = new ErrorBucket(); Validate(errors); if (!(errors.HasErrors)) { var proxy = TinyIoCContainer.Current.Resolve <INewPassServiceProxy>(); using (EnterBusy()) { var result = await proxy.VerifyAsync(PhoneNumber, Password, Confirm, Code); // ok? if (!(result.HasErrors)) { if (result.Status != "success") { errors.CopyFrom(result); } else { await Host.ShowAlertAsync(result.Message); Host.ShowView(typeof(IRegisterPageViewModel)); } } else { errors.CopyFrom(result); } if (errors.HasErrors) { await Host.ShowAlertAsync(errors.GetErrorsAsString()); } } } else { await Host.ShowAlertAsync(errors.GetErrorsAsString()); } }
//verify number private async void Submit(CommandExecutionContext context) { if (context == null) { context = new CommandExecutionContext(); } if (string.IsNullOrEmpty(SelectedLocation)) { await Host.ShowAlertAsync(res.GetString("cmbSelectLocation/PlaceholderText")); } else { var proxy = TinyIoCContainer.Current.Resolve <IUpdateLocationServiceProxy>(); using (EnterBusy()) { var result = await proxy.UpdateLocationAsync(SelectedLocation); ErrorBucket errors = new ErrorBucket(); // ok? if (!(result.HasErrors)) { if (result.Status != "success") { errors.CopyFrom(result); } else { await Host.ShowAlertAsync(result.Message); ApplicationData.Current.LocalSettings.Values["Location"] = SelectedLocation; Host.ShowView(typeof(IHomePageViewModel)); } } else { errors.CopyFrom(result); } if (errors.HasErrors) { await Host.ShowAlertAsync(errors.GetErrorsAsString()); } } } }
private async void ForgotPassword(CommandExecutionContext context) { if (context == null) { context = new CommandExecutionContext(); } if (string.IsNullOrEmpty(PhoneNumber) || PhoneNumber.Length < 12) { await Host.ShowAlertAsync(res.GetString("InvalidPhone")); } else { var proxy = TinyIoCContainer.Current.Resolve <IForgotPassServiceProxy>(); using (EnterBusy()) { var result = await proxy.VerifyAsync(PhoneNumber); ErrorBucket errors = new ErrorBucket(); // ok? if (!(result.HasErrors)) { if (result.Status != "success") { errors.CopyFrom(result); } else { localSettings.Values["VerifyPhone"] = PhoneNumber; await Host.ShowAlertAsync(result.Message); Host.ShowView(typeof(INewPassPageViewModel)); } } else { errors.CopyFrom(result); } if (errors.HasErrors) { await Host.ShowAlertAsync(errors.GetErrorsAsString()); } } } }
public async Task LoadLocations() { ErrorBucket errors = new ErrorBucket(); var proxy = TinyIoCContainer.Current.Resolve <IGetLocationsServiceProxy>(); // call... using (EnterBusy()) { var result = await proxy.GetLocationsAsync(); if (!(result.HasErrors)) { foreach (var item in result.Locations) { Locations.Add(item.name); locations.Add(item.name); } } else { errors.CopyFrom(result); } } // errors? if (errors.HasErrors) { await Host.ShowAlertAsync(errors); } }
private async Task GetCurrentTickets() { ErrorBucket errors = new ErrorBucket(); var proxy = TinyIoCContainer.Current.Resolve <IGetPendingTicketsServiceProxy>(); using (EnterBusy()) { await Host.ToggleProgressBar(true, res.GetString("Loading")); var result = await proxy.GetTicketAsync(); if (!(result.HasErrors)) { foreach (var item in result.tickets) { Items.Add(item); } } else { errors.CopyFrom(result); } await Host.ToggleProgressBar(false); if (errors.HasErrors) { await Host.ShowAlertAsync(errors.GetErrorsAsString()); } } }
private async Task GetMaid() { ErrorBucket errors = new ErrorBucket(); var proxy = TinyIoCContainer.Current.Resolve <IGetMaidsServiceProxy>(); using (EnterBusy()) { await Host.ToggleProgressBar(true, "Fetching expert profile ..."); var result = await proxy.GetMaidAsync(); if (!(result.HasErrors)) { name = result.Maid.name; id_number = result.Maid.id_number; phone = result.Maid.phone; id = result.Maid.id; bitmap = new BitmapImage(); if (!string.IsNullOrEmpty(result.Maid.photo)) { //Bitmap images use a URI or a stream as their source, so let's convert our base64 image string to a stream using (var stream = new MemoryStream(Convert.FromBase64String(result.Maid.photo))) { //Bitmaps in WinRT use an IRandomAccessStream as their source await bitmap.SetSourceAsync(stream.AsRandomAccessStream()); } //Bitmap is ready for binding to source } age = result.Maid.age.ToString(); badge = result.Maid.badge; ticketID = result.Maid.ticketID; MFundiRuntime.TicketID = result.Maid.ticketID.ToString(); //save TicketID to use to mark task as done ApplicationData.Current.LocalSettings.Values["TicketID"] = result.Maid.ticketID.ToString(); System.Diagnostics.Debug.WriteLine("TicketID: " + ticketID.ToString()); if (result.Maid.expert_type == "Full Time") { Count = result.Maid.remaining; System.Diagnostics.Debug.WriteLine(Count); } } else { errors.CopyFrom(result); } if (errors.HasErrors) { await Host.ShowAlertAsync(errors); } await Host.ToggleProgressBar(false); } }
public override void Initialize(IViewModelHost host) { base.Initialize(host); ErrorBucket errors = new ErrorBucket(); Items = new ObservableCollection <TicketItem>(); SelectedTicket = new TicketItem(); SubmitCommand = new DelegateCommand(async(e) => { TicketID = (int)e; MFundiRuntime.TicketID = TicketID.ToString(); var proxy = TinyIoCContainer.Current.Resolve <ITaskCompleteServiceProxy>(); using (EnterBusy()) { var result = await proxy.TaskCompleteAsync(TicketID); if (!(result.HasErrors)) { if (result.Status != "success") { errors.CopyFrom(result); } else { var toast = new ToastNotificationBuilder(new string[] { result.Message }); toast.Update(); Host.ShowView(typeof(IEvaluationPageViewModel)); } } else { errors.CopyFrom(result); } if (errors.HasErrors) { await Host.ShowAlertAsync(errors.GetErrorsAsString()); } } }); }
//verify number private async void Verify(CommandExecutionContext context) { ErrorBucket errors = new ErrorBucket(); if (context == null) { context = new CommandExecutionContext(); } if (string.IsNullOrEmpty(PhoneNumber) || PhoneNumber.Length < 12) { await Host.ShowAlertAsync(res.GetString("InvalidPhone")); } else { var proxy = TinyIoCContainer.Current.Resolve <IVerifyServiceProxy>(); using (EnterBusy()) { var result = await proxy.VerifyAsync(PhoneNumber); // ok? if (!(result.HasErrors)) { if (result.Status != "success") { errors.CopyFrom(result); } } else { errors.CopyFrom(result); } if (errors.HasErrors) { await Host.ShowAlertAsync(errors.GetErrorsAsString()); } } } }
private async Task GetProfile() { ErrorBucket errors = new ErrorBucket(); var proxy = TinyIoCContainer.Current.Resolve <IGetMyProfileServiceProxy>(); // call... using (EnterBusy()) { var result = await proxy.GetProfileAsync(); if (!(result.HasErrors)) { FullName = result.Profile.name; Location = result.Profile.location; PhoneNumber = result.Profile.phone; Email = result.Profile.email; localSettings.Values["Location"] = Location; localSettings.Values["FullName"] = FullName; localSettings.Values["PhoneNumber"] = PhoneNumber; localSettings.Values["Email"] = Email; string Photo = ""; if (string.IsNullOrEmpty(result.Profile.photo)) { Photo = "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8xAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH4AkBBQEEd4GDhQAAJJ5JREFUeNrtndtTW8kRh2fmXHUXEkiAsfENu+x1bbzZVG3ylIdUqpK/OJVKbTa7VRunzC62wfYajA0GBAghdNeRdM6ZyUPDsSyEELogaWa+J1sG+Vz6N9Pd09ODy+UykkhEhYz6AiSSUSIFIBEaKQCJ0EgBSIRGCkAiNFIAEqGRApAIjRSARGikACRCIwUgERopAInQSAFIhEYKYJRgjBFC7IxRX46IqKO+AHFhjNm2bZqmoigIIdd1XdcFGYAwJNeAFMAIYIzpuv7p06dnz57F4/FoNBqPx2OxWDAY1HWdMeY4DqUUSSUMHymAYcEY62C+lNJ3797VarXDw8NUKoUx1nU9HA7PzMzMzs5OT0/7/X6EkOM4rutijKUShgSWG2IGDqWUEKKqquM4bf/VNM319fVnz54ZhuG5/owx8IIIIYFAIJlM3rx5c3Z21jRN13Xhq6QMBo4UwMAAU1YURVVV27aPj4+j0aiqqs3RLaVU1/V8Pv/Pf/4Thvbmb/D+CkrAGIfD4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JSapinPaZNwDzRLbI0BGGOGYcgjwCQiYJqm9+fPAtA0ze/393PotkQy/hBCTNP0Bvr/A2UzgS2O1HA6AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE2LTA5LTAxVDA1OjAxOjA0LTA0OjAwJzqBdwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNi0wOS0wMVQwNTowMTowNC0wNDowMFZnOcsAAAAASUVORK5CYII="; } else { Photo = result.Profile.photo; localSettings.Values["Photo"] = Photo; } bitmap = new BitmapImage(); //Bitmap images use a URI or a stream as their source, so let's convert our base64 image string to a stream using (var stream = new MemoryStream(Convert.FromBase64String(result.Profile.photo))) { //Bitmaps in WinRT use an IRandomAccessStream as their source await bitmap.SetSourceAsync(stream.AsRandomAccessStream()); } } else { errors.CopyFrom(result); } // errors? if (errors.HasErrors) { await Host.ShowAlertAsync(errors); } } }
//login private async void DoLogin(CommandExecutionContext context) { if (context == null) { context = new CommandExecutionContext(); } ErrorBucket errors = new ErrorBucket(); Validate(errors); // ok? if (!(errors.HasErrors)) { // get a handler... var proxy = TinyIoCContainer.Current.Resolve <ISignInServiceProxy>(); // call... using (EnterBusy()) { await Host.ToggleProgressBar(true, res.GetString("SigningIn")); var result = await proxy.SignInAsync(PhoneNumber, Password); if (!(result.HasErrors)) { //assign new token to global class MFundiRuntime.LogonToken = result.token; // save the logontoken localSettings.Values["LogonToken"] = result.token; //fetch pendingtickets & navigate to home await GetCurrentTickets(); // navigate to home page... Host.ShowView(typeof(IHomePageViewModel)); } else { errors.CopyFrom(result); } await Host.ToggleProgressBar(false); } } // errors? if (errors.HasErrors) { await Host.ShowAlertAsync(errors); } }
////mark task done dialog //private async Task TaskDone() //{ // MessageDialog dialog = new MessageDialog("Please Mark Task as done", "Task Complete"); // dialog.Commands.Add(new UICommand("Cancel")); // dialog.Commands.Add(new UICommand("Confirm", async delegate (IUICommand command) // { // await SetDone(); // })); // await dialog.ShowAsync(); //} ////server call toset task done #TODO //private async Task SetDone() //{ // ErrorBucket errors = new ErrorBucket(); // var proxy = TinyIoCContainer.Current.Resolve<ITaskCompleteServiceProxy>(); // using (EnterBusy()) // { // var result = await proxy.TaskCompleteAsync(); // // ok? // if (!(result.HasErrors)) // { // if (result.Status != "success") // { // errors.CopyFrom(result); // } // else // { // var toast = new ToastNotificationBuilder(new string[] { result.Message }); // toast.Update(); // if (ApplicationData.Current.LocalSettings.Values.ContainsKey("DailyTicketID")) // { // if (string.IsNullOrEmpty(MFundiRuntime.TicketID)) // MFundiRuntime.TicketID = ApplicationData.Current.LocalSettings.Values["DailyTicketID"].ToString(); // //remove ticketid as is done // ApplicationData.Current.LocalSettings.Values.Remove("DailyTicketID"); // } // Host.ShowView(typeof(IEvaluationPageViewModel)); // } // } // else // { // errors.CopyFrom(result); // } // if (errors.HasErrors) // await Host.ShowAlertAsync(errors.GetErrorsAsString()); // } //} //logout private async Task LogOut() { ErrorBucket errors = new ErrorBucket(); var proxy = TinyIoCContainer.Current.Resolve <ILogOutServiceProxy>(); using (EnterBusy()) { await Host.ToggleProgressBar(true, "Signing Out ..."); var result = await proxy.LogOutAsync(); if (!(result.HasErrors)) { localSettings.Values.Remove("LogonToken"); if (localSettings.Values.ContainsKey("DailyTicketID")) { localSettings.Values.Remove("DailyTicketID"); } if (localSettings.Values.ContainsKey("TicketID")) { localSettings.Values.Remove("TicketID"); } localSettings.Values.Remove("Location"); localSettings.Values.Remove("FullName"); localSettings.Values.Remove("PhoneNumber"); localSettings.Values.Remove("Email"); localSettings.Values.Remove("Photo"); MFundiRuntime.LogonToken = null; await Host.ToggleProgressBar(true, "Signed Out Successfully"); Host.ShowView(typeof(IRegisterPageViewModel)); } else { errors.CopyFrom(result); } await Host.ToggleProgressBar(false); } // errors? if (errors.HasErrors) { await Host.ShowAlertAsync(errors); } }
private async void Evaluate(CommandExecutionContext context) { ErrorBucket errors = new ErrorBucket(); // if we don't have a context, create one... if (context == null) { context = new CommandExecutionContext(); } if (Rating < 0.5 || Review == null) { await Host.ShowAlertAsync(res.GetString("Rating")); } else { //servicecall var proxy = TinyIoCContainer.Current.Resolve <IEvaluateServiceProxy>(); // call... using (EnterBusy()) { await Host.ToggleProgressBar(true, res.GetString("SendingComments")); var result = await proxy.EvaluateAsync(Rating, Review, MFundiRuntime.TicketID); if (!(result.HasErrors)) { //remove dailyticketid to remove mark as done icon ApplicationData.Current.LocalSettings.Values.Remove("DailyTicketID"); await Host.ShowAlertAsync(result.Message); Host.ShowView(typeof(IHomePageViewModel)); } else { errors.CopyFrom(result); } await Host.ToggleProgressBar(false); } if (errors.HasErrors) { await Host.ShowAlertAsync(errors); } } }
private async void Hire(CommandExecutionContext context) { // if we don't have a context, create one... if (context == null) { context = new CommandExecutionContext(); } ErrorBucket errors = new ErrorBucket(); //servicecall var proxy = TinyIoCContainer.Current.Resolve <IHireServiceProxy>(); // call... using (EnterBusy()) { await Host.ToggleProgressBar(true, res.GetString("ConfirmExpert")); var result = await proxy.HireAsync(ticketID); if (!(result.HasErrors)) { var toast = new ToastNotificationBuilder(new string[] { result.Message }); toast.Update(); //hired maid so clear ticketid and code ApplicationData.Current.LocalSettings.Values.Remove("Code"); ApplicationData.Current.LocalSettings.Values.Remove("TicketID"); Host.ShowView(typeof(IHomePageViewModel)); } else { errors.CopyFrom(result); } await Host.ToggleProgressBar(false); } if (errors.HasErrors) { await Host.ShowAlertAsync(errors); } }
//register private async void DoRegister(CommandExecutionContext context) { ErrorBucket errors = new ErrorBucket(); // if we don't have a context, create one... if (context == null) { context = new CommandExecutionContext(); } // validate... ValidateSignUp(errors); // ok? if (!(errors.HasErrors)) { // get a handler... var proxy = TinyIoCContainer.Current.Resolve <IRegisterServiceProxy>(); await Host.ToggleProgressBar(true, res.GetString("SigningUp")); var result = await proxy.RegisterAsync(FullName, PhoneNumber, Password, SelectedLocation, Code, Email); // ok? if (!(result.HasErrors)) { if (result.status == "success") { await Host.ToggleProgressBar(true, string.Format(res.GetString("registered"), FullName)); //assign new token to global class MFundiRuntime.LogonToken = result.token; // save logontoken localSettings.Values["LogonToken"] = result.token; //save Location localSettings.Values["Location"] = SelectedLocation; localSettings.Values["FullName"] = FullName; localSettings.Values["PhoneNumber"] = PhoneNumber; localSettings.Values["Email"] = Email; await Host.ToggleProgressBar(false); Host.ShowView(typeof(IHomePageViewModel)); } else { await Host.ToggleProgressBar(false); errors.AddError(result.status); await Host.ShowAlertAsync(errors); } } else { errors.CopyFrom(result); await Host.ToggleProgressBar(false); } } // errors? if (errors.HasErrors) { await Host.ShowAlertAsync(errors); } }