public MailMainModel(Page page) : base(page) { Messages = new ObservableCollection<MailViewCellModel>(); var accountMan = new AccountManager.AccountManager(); var account = accountMan.LoadAccount().Result; var json = LacunaExpanseAPIWrapper.Inbox.ViewInbox(account.SessionID); var apiService = new ApiService(account.Server); var service = new RefitApiService(apiService); var result = service.InboxAsync(Priority.Background, json).Result;//.ConfigureAwait (false); if (result != null) { foreach(var m in result.result.messages) { var model = new MailViewCellModel { BodyPreview = m.body_preview, From = m.from, MessageID = m.id, Subject = m.subject }; Messages.Add(model); } } else { } }
async void Login(RefitApiService service) { var result = await service.EmpireAsync(Priority.Background, requestString);//.ConfigureAwait (false); if (result != null) ResultString = result.result.session_id; else ResultString = "An Error Occured";//resultLbl.Text = result.ToString() ; }
async void Login(RefitApiService service, string requestString) { var result = await service.EmpireAsync(Priority.Background, requestString);//.ConfigureAwait (false); if(result != null) { if (!String.IsNullOrEmpty(result.result.session_id)) { await Navigation.PushAsync(new MailMainView()); } } else { } //if (result != null) // ResultString = result.result.session_id; //else // ResultString = "An Error Occured";//resultLbl.Text = result.ToString() ; }
public DemoPageModel() { var apiService = new ApiService(TekConfApiUrl); var service = new RefitApiService(apiService); Login(service); }