public void EnterMenuOption(int Id) { RecuerdoViewModel.DeleteInstance(); ((MasterDetailPage)App.Current.MainPage).IsPresented = false; switch (Id) { case 1: ((MasterDetailPage)App.Current.MainPage).Detail.Navigation.PushAsync(new MainRecuerdoView()); break; //case 2: // ((MasterDetailPage)App.Current.MainPage).Detail.Navigation.PushAsync(new TabbedPageHomeView()); // break; case 2: ((MasterDetailPage)App.Current.MainPage).Detail.Navigation.PushAsync(new CarouView()); break; case 4: App.Current.MainPage = new LoginView(); break; default: break; } }
public static void DeleteInstance() { if (instance != null) { instance = null; } }
public async static void ObtenerRecuerdosAsyn(RecuerdoModel recuerdo) { using (HttpClient client = new HttpClient()) { var uri = new Uri("http://b3c3c3e6.ngrok.io/api/Recuerdo/ObtenerRecuerdo"); recuerdo.Id_Usuario = HomeViewModel._idusuario; var json = JsonConvert.SerializeObject(new { recuerdo.Id_Usuario }); var content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = await client.PostAsync(uri, content).ConfigureAwait(false); string ans = await response.Content.ReadAsStringAsync(); RecuerdoViewModel.GetInstance().LstRecuerdo = JsonConvert.DeserializeObject <ObservableCollection <RecuerdoModel> >(ans); for (int i = 0; i < RecuerdoViewModel.GetInstance().LstRecuerdo.Count; i++) { Stream stream = new MemoryStream(RecuerdoViewModel.GetInstance().LstRecuerdo[i].Foto); RecuerdoViewModel.GetInstance().LstRecuerdo[i].FotoSource = ImageSource.FromStream(() => { return(stream); }); } } }
public static RecuerdoViewModel GetInstance() { if (instance == null) { instance = new RecuerdoViewModel(); } return(instance); }