protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); this.RegisterManagers(); this.SetContentView(Resource.Layout.Main); this.UiMetadataWebApi = new UiMetadataWebApi { FormMetadataUrl = "http://10.0.2.2:58337/api/form/metadata", MetadataUrl = "http://10.0.2.2:58337/api/form/metadata", RunFormUrl = "http://10.0.2.2:58337/api/form/run" }; // this.FormWrapper = new CustomFormWrapper(this, this.AppLayouts, Resource.Id.main_content_frame); this.MyFormHandler = new MyFormHandler(this.UiMetadataWebApi, new ManagersCollection(), this.FormWrapper); var appPreference = new AppSharedPreference(Application.Context); if (string.IsNullOrEmpty(appPreference.GetSharedKey("Cookies"))) { var metadata = this.MyFormHandler.GetFormMetadata("login"); this.FormWrapper.UpdateView(this.MyFormHandler, new FormParameter(metadata)); } else { var i = new Intent(this, typeof(FormsActivity)); this.StartActivity(i); } }
public MyFormHandler( IFormWrapper formWrapper, UiMetadataWebApi uiMetadataWebApi, ManagersCollection managersCollection, Dictionary <string, FormMetadata> allForms) { this.AllFormsMetadata = allForms; this.UiMetadataWebApi = uiMetadataWebApi; this.FormWrapper = formWrapper; this.UserDefaults = NSUserDefaults.StandardUserDefaults; this.ManagersCollection = managersCollection ?? new ManagersCollection(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); this.SetContentView(Resource.Layout.Magic); this.UiMetadataWebApi = new UiMetadataWebApi { FormMetadataUrl = "http://10.0.2.2:58337/api/form/metadata", MetadataUrl = "http://10.0.2.2:58337/api/form/metadata", RunFormUrl = "http://10.0.2.2:58337/api/form/run" }; this.RegisterManagers(); this.ProgressBar = this.FindViewById <ProgressBar>(Resource.Id.progressBar); this.FormWrapper = new CustomFormWrapper(this, this.AppLayouts); this.MyFormHandler = new MyFormHandler(this.UiMetadataWebApi, this.ManagersCollection, this.FormWrapper, this.AllForms); this.InitializeDrawerLayout(); if (this.AppLayouts.Count == 0) { this.AppLayouts.Add(new MyFormFragment(this)); } var refresher = this.FindViewById <SwipeRefreshLayout>(Resource.Id.refresher); #pragma warning disable 618 refresher.SetColorScheme(Resource.Color.blue); #pragma warning restore 618 refresher.Refresh += delegate { this.GetAllFormsMetadata(); this.RefreshDrawerList(); var wrapper = this.AppLayouts[this.AppLayouts.Count - 1]; this.FormWrapper.UpdateView(wrapper.MyFormHandler, wrapper.FormParameter, wrapper.SubmitAction); this.AppLayouts.RemoveAt(this.AppLayouts.Count - 1); refresher.Refreshing = false; }; this.FetchMetadata(); }