public DisplayDetailsPage (TodoItem car, CarItemManager manager) { InitializeComponent (); var year = new Label () { Text = car.Year }; var make = new Label () { Text = car.Make }; var model = new Label () { Text = car.Model }; yearMakeModelLayout.Children.Add (year); yearMakeModelLayout.Children.Add (make); yearMakeModelLayout.Children.Add (model); yearMakeModelLayout.BackgroundColor = Color.FromHex (ThemeColors.Primary); // ---------------------------- List<string> statusList = new List<string> { "OnOrder", "OnLot", "RepairDepot", "Sold" }; var statusEntryLabel = new Label (); var statusPicker = new MyPicker (); entryStack.Children.Add (statusEntryLabel); entryStack.Children.Add (statusPicker); statusEntryLabel.Text = "New Status"; entryStack.BackgroundColor = Color.FromHex (ThemeColors.TextIcons); statusEntryLabel.TextColor = Color.FromHex(ThemeColors.Primary); foreach (string i in statusList) { statusPicker.Items.Add(i); } statusPicker.SelectedIndexChanged += (sender, args) => { car.CarStatus = statusList.ElementAt(statusPicker.SelectedIndex); }; // var nameEntry = new Entry {Placeholder="Enter Customers Name"}; // entryStack.Children.Add (nameEntry); // var phoneEntry = new Entry {Placeholder="Enter Customers Phone Number"}; // entryStack.Children.Add (phoneEntry); // var priceEntry = new Entry {Placeholder="Enter Car Price"}; // entryStack.Children.Add (priceEntry); // nameEntry.IsVisible = false; // phoneEntry.IsVisible = false; // priceEntry.IsVisible = false; // // if (car.CustomerName == null) { // nameEntry.IsVisible = true; // } // // if (car.CustomerPhone == null) { // phoneEntry.IsVisible = true; // } // if (car.Price == null) { // priceEntry.IsVisible = true; // } // // nameEntry.TextChanged += (sender, e) => { car.CustomerName = e.NewTextValue; }; // phoneEntry.TextChanged += (sender, e) => { car.CustomerName = e.NewTextValue; }; // priceEntry.TextChanged += (sender, e) => { car.CustomerName = e.NewTextValue; }; mainStack.BackgroundColor = Color.FromHex (ThemeColors.Primary); tableStack.BackgroundColor = Color.FromHex (ThemeColors.Primary); var changeStatusButton = new Button () { Text="Change Status"}; changeStatusButton.Clicked += async (sender, e) => { await manager.SaveTaskAsync(car); await Navigation.PopModalAsync(); }; var cancelChangeButton = new Button () { Text="Cancel Status Change", Command = new Command(() => Navigation.PopModalAsync())}; buttonStack.Children.Add (changeStatusButton); buttonStack.Children.Add (cancelChangeButton); year.FontAttributes = FontAttributes.Bold; year.FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)); year.TextColor = Color.FromHex(ThemeColors.TextIcons); make.FontAttributes = FontAttributes.Bold; make.FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)); make.TextColor = Color.FromHex(ThemeColors.TextIcons); model.FontAttributes = FontAttributes.Bold; model.FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)); model.TextColor = Color.FromHex(ThemeColors.TextIcons); var tableView = new TableView { Intent = TableIntent.Form, BackgroundColor = Color.FromHex(ThemeColors.TextIcons), Root = new TableRoot () { new TableSection { new KeyValueCell ("Airbags:", car.Airbags.ToString()), new KeyValueCell ("AirConditioning:", car.AirConditioning.ToString()), new KeyValueCell ("Alloy Wheels:", car.AlloyWheels.ToString()), new KeyValueCell ("AntiLockBrakes:", car.AntiLockBrakes.ToString()), new KeyValueCell ("Audio System:", car.AudioSystem), new KeyValueCell ("Automatic Transmission:", car.AutomaticTransmission.ToString()), new KeyValueCell ("Average MPG:", car.AverageMilesPerGallon), new KeyValueCell ("Car Status:", car.CarStatus), new KeyValueCell ("Cruise Control:", car.CruiseControl.ToString()), new KeyValueCell ("Current Dealer:", car.CurrentDealer), new KeyValueCell ("Owner's Name:", car.CustomerName), new KeyValueCell ("Owner's Number:", car.CustomerPhone), new KeyValueCell ("On Delivery To:", car.DeliveringTo), new KeyValueCell ("Engine:", car.EngineType), new KeyValueCell ("Estimated Delivery Date:", car.EstimatedDeliveryDate), new KeyValueCell ("Front Brakes:", car.FrontBrakes), new KeyValueCell ("Fuel Cutoff:", car.FuelCutoff.ToString()), new KeyValueCell ("Keyless Entry:", car.KeylessEntry.ToString()), new KeyValueCell ("Metallic Paint:", car.MetallicPaint.ToString()), new KeyValueCell ("OnBoard Computer:", car.OnBoardComputer.ToString()), new KeyValueCell ("Paint Color:", car.PaintColor), new KeyValueCell ("Powersteering:", car.PowerSteering.ToString()), new KeyValueCell ("Price:", car.Price), new KeyValueCell ("Rear Brakes:", car.RearBrakes), new KeyValueCell ("Remote Start:", car.RemoteStart.ToString()), new KeyValueCell ("Service Indicator:", car.ServiceIndicator.ToString()), new KeyValueCell ("Star Spoke Wheels:", car.StarSpoke.ToString()), new KeyValueCell ("Trim:", car.Trim), new KeyValueCell ("VIN:", car.VIN), new KeyValueCell ("Warranty Program:", car.WarrantyProgramType), }, } }; tableStack.Children.Add (tableView); }
public RepairDetailsPage(TodoItem car, CarItemManager manager) { InitializeComponent(); Debug.WriteLine(car.OtherRepair); var year = new Label() { Text = car.Year }; var make = new Label() { Text = car.Make }; var model = new Label() { Text = car.Model }; yearMakeModelLayout.Children.Add(year); yearMakeModelLayout.Children.Add(make); yearMakeModelLayout.Children.Add(model); yearMakeModelLayout.BackgroundColor = Color.FromHex(ThemeColors.Primary); mainStack.BackgroundColor = Color.FromHex(ThemeColors.Primary); var payCarRepairButton = new Button() { Text = "Pay Car Repair" }; // May need to create new SaveTaskAsync function in CarItemManager payCarRepairButton.Clicked += async (sender, e) => { additionalRepairEntry += "\n"; car.OtherRepair += additionalRepairEntry; await manager.SaveTaskAsync(car); await Navigation.PopModalAsync(); }; var cancelCarRepairButton = new Button() { Text = "Cancel Car Repair", Command = new Command(() => Navigation.PopModalAsync()) }; repairPurchaseStack.Children.Add(payCarRepairButton); repairPurchaseStack.Children.Add(cancelCarRepairButton); year.FontAttributes = FontAttributes.Bold; year.FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)); year.TextColor = Color.FromHex(ThemeColors.TextIcons); make.FontAttributes = FontAttributes.Bold; make.FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)); make.TextColor = Color.FromHex(ThemeColors.TextIcons); model.FontAttributes = FontAttributes.Bold; model.FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)); model.TextColor = Color.FromHex(ThemeColors.TextIcons); var milageLabel = new Label() { Text = "Milage", HorizontalOptions = LayoutOptions.StartAndExpand, BackgroundColor = Color.FromHex(ThemeColors.TextIcons), FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), TextColor = Color.FromHex(ThemeColors.Primary), FontAttributes = FontAttributes.Bold, }; var standardRepairsLabel = new Label() { Text = "Standard Repairs", HorizontalOptions = LayoutOptions.CenterAndExpand, BackgroundColor = Color.FromHex(ThemeColors.TextIcons), FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), TextColor = Color.FromHex(ThemeColors.Primary), FontAttributes = FontAttributes.Bold, }; var switchLabel = new Label() { Text = "Switch", HorizontalOptions = LayoutOptions.EndAndExpand, BackgroundColor = Color.FromHex(ThemeColors.TextIcons), FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), TextColor = Color.FromHex(ThemeColors.Primary), FontAttributes = FontAttributes.Bold, }; topStack.Children.Add(milageLabel); topStack.Children.Add(standardRepairsLabel); topStack.Children.Add(switchLabel); var tableView = new TableView { HasUnevenRows = true, Intent = TableIntent.Form, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromHex(ThemeColors.TextIcons), Root = new TableRoot() { new TableSection { new KeyValueCell(car, "10k:", car.TenThousand, "• Oil Change\n• Tire Rotation", car.OtherRepair), new KeyValueCell(car, "25k:", car.TwentyFiveThousand, "• Oil Change\n• Tire Rotation\n• Loose Fuel Caps", car.OtherRepair), new KeyValueCell(car, "50k:", car.FiftyThousand, "• Oil Change\n• Tire Rotation\n• Replacing Intake Manifold Gaskets\n• Replacing Engine Coolant Temperature Sensor", car.OtherRepair), new KeyValueCell(car, "100k:", car.OneHundredThousand, "• Oil Change\n• Tire Rotation\n• Replacing Exhaust Gas Recirculation valve\n• Replacing Engine Coolant Temperature Sensor", car.OtherRepair), new KeyValueCell(car, "150k:", car.OneFiftyThousand, "• Oil Change\n• Tire Rotation\n• Fix Defective Battery\n• Replacing Catalytic Converter", car.OtherRepair), //new KeyValueCell(car, "200k:", car.TwoHundredThousand, "• Oil Change\n• Tire Rotation\n• Fix Defective Motor\n• Loose Fuel Caps", car.OtherRepair) }, } }; tableStack.Children.Add(tableView); var extraRepairsEntry = new Entry { Placeholder="Enter extra repairs", BackgroundColor = Color.FromHex(ThemeColors.TextIcons), TextColor = Color.FromHex(ThemeColors.Primary), }; extraRepairsStack.Children.Add(extraRepairsEntry); outerStack.BackgroundColor = Color.FromHex(ThemeColors.TextIcons); var boxLabel = new Label() { Text="Previously Completed Unscheduled Repairs:", BackgroundColor = Color.FromHex(ThemeColors.PrimaryDark), TextColor = Color.FromHex(ThemeColors.Accent), FontAttributes = FontAttributes.Bold, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), }; boxStack.BackgroundColor = Color.FromHex(ThemeColors.PrimaryDark); completedRepairs.BackgroundColor = Color.FromHex(ThemeColors.PrimaryDark); extraRepairsEntry.TextChanged += (sender, e) => { if (additionalRepairEntry != null) { additionalRepairEntry = e.NewTextValue; } }; completedRepairs.Text = car.OtherRepair; completedRepairs.TextColor = Color.FromHex (ThemeColors.TextIcons); boxStack.Children.Add(boxLabel); }