public ExpenseView() { InitializeComponent(); BindingContext = viewModel = new SelectedExpenseViewModel(); }
public ExpenseEdit(SelectedExpenseViewModel viewModel) { InitializeComponent(); BindingContext = this.viewModel = viewModel; var database2 = new SQLiteConnection(path2); var database3 = new SQLiteConnection(path3); var database4 = new SQLiteConnection(path4); Contractors = new ObservableCollection <Contractor>(); Locations = new ObservableCollection <Locations>(); Invoices = new ObservableCollection <Invoice>(); var contractors = database2.Table <Contractor>().OrderBy(x => x.Id).ToList(); var locations = database3.Table <Locations>().OrderBy(x => x.Id).ToList(); var invoices = database4.Table <Invoice>().OrderBy(x => x.Id).ToList(); foreach (Contractor contractor in contractors) { Contractors.Add(contractor); } Contractor vacant = new Contractor(); { vacant.CompanyName = "None"; vacant.ContractorType = "None"; vacant.Description = "Empty"; vacant.PhoneNumber = "N/A"; vacant.Id = 100000; } Contractors.Add(vacant); ContractorPicker.ItemsSource = Contractors; foreach (Locations location in locations) { Locations.Add(location); } Locations vacant3 = new Locations(); { vacant3.Image = "/Assets/Icon4-72.png"; vacant3.Address = "None"; vacant3.City = "Empty"; vacant3.Latitude = 0; vacant3.Longitude = 0; vacant3.Name = "None"; vacant3.RentAmount = 0; vacant3.Suite = "N/A"; vacant3.Tenant = "None"; vacant3.Zipcode = "N/A"; vacant3.Id = 100001; } Locations.Add(vacant3); LocationPicker.ItemsSource = Locations; foreach (Invoice invoice in invoices) { Invoices.Add(invoice); } Invoice vacant4 = new Invoice(); { vacant4.Description = "None"; vacant4.Image = "/Assets/Icon5-72.png"; vacant4.Id = 100002; } Invoices.Add(vacant4); InvoicePicker.ItemsSource = Invoices; }
public ExpenseView(SelectedExpenseViewModel viewModel) { InitializeComponent(); BindingContext = this.viewModel = viewModel; }