public MainViewModel() { //Singleton instance = this; //Create observable collections Menu = new ObservableCollection <MenuItemViewModel>(); Customers = new ObservableCollection <CustomerItemViewModel>(); Properties = new ObservableCollection <PropertyItemViewModel>(); navigationService = new NavigationService(); //Create views CurrentCustomer = new CustomerItemViewModel(0); NewCustomer = new CustomerItemViewModel(0); NewLogin = new LoginItemViewModel(); CurrentProperty = new PropertyItemViewModel(0); NewProperty = new PropertyItemViewModel(0); //Insert services apiService = new ApiService(); dataService = new DataService(); netService = new NetService(); //Load data LoadMenu(); LoadCustomers(); LoadProperties(); }
private async void CustomerNew() { CustomerItemViewModel customerItemViewModel = new CustomerItemViewModel(0); var mainViewModel = MainViewModel.GetInstance(); mainViewModel.SetCurrentCustomer(customerItemViewModel); await navigationService.Navigate("NewCustomerPage"); }
private async void GoTo(string pageName) { switch (pageName) { case "NewCustomerPage": NewCustomer = new CustomerItemViewModel(0); break; default: break; } await navigationService.Navigate(pageName); }
private async void CustomerDetail() { CustomerItemViewModel customerItemViewModel = new CustomerItemViewModel(PropertyTypeId) { Bathrooms = Bathrooms, Bedrooms = Bedrooms, Elevator = Elevator, Mail = Mail, Floor = Floor, Fourthuseful = Fourthuseful, Gatedcommunity = Gatedcommunity, Id = Id, LastName = LastName, Mts = Mts, Name = Name, Observation = Observation, Parking = Parking, Phone = Phone, Telephone = Telephone, Price = Price, PropertyTypeId = PropertyTypeId, Province = Province }; //var propertyTipeFind = customerItemViewModel.PropertiesType.Where(tp => tp.PropertyTypeId == PropertyTypeId).FirstOrDefault(); //var result = new PropertyType // { // PropertyTypeId = propertyTipeFind.PropertyTypeId, // Name = propertyTipeFind.Name // }; //customerItemViewModel.PropertyTypeSelectedItem = result; // PropertyTypeSelectedItem = result; var mainViewModel = MainViewModel.GetInstance(); mainViewModel.SetCurrentCustomer(customerItemViewModel); await navigationService.Navigate("CustomerDetailPage"); }
public void SetCurrentCustomer(CustomerItemViewModel customerItemViewModel) { CurrentCustomer = customerItemViewModel; }