public PlaceOrder() { Title = "TVTS - Order a Car"; manager = CarItemManager.DefaultManager; CreateUI (manager); }
public SoldCars() { InitializeComponent(); manager = CarItemManager.DefaultManager; var instructionStack = new StackLayout () { BackgroundColor = Color.FromHex(ThemeColors.PrimaryDark), Padding=new Thickness (15, 15, 15, 15)}; var instructionLabel = new Label () { Text = "Click on an Entry for Details", FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)), TextColor=Color.FromHex(ThemeColors.TextIcons) }; instructionStack.Children.Add (instructionLabel); var scrollview = new ScrollView { Content = new StackLayout { Children = { instructionStack, todoList }, }, }; var outerStack = new StackLayout(); outerStack.Children.Add(scrollview); Content = outerStack; }
public RepairDepartment() { InitializeComponent(); manager = CarItemManager.DefaultManager; var repairButton = new Button() { Text = "Repair Car", }; var stack = new StackLayout(){ Children = { repairButton } }; var scrollview = new ScrollView { Content = new StackLayout { Children = { stack, todoList }, }, }; var outerStack = new StackLayout(); outerStack.Children.Add(scrollview); Content = outerStack; }
public CurrentOrders() { InitializeComponent(); manager = CarItemManager.DefaultManager; var orderButton = new Button () {Text="Order a New Car", HeightRequest=80}; var instructionStack = new StackLayout () { BackgroundColor = Color.FromHex(ThemeColors.PrimaryDark), Padding=new Thickness (15, 15, 15, 15)}; orderButton.Clicked += async (sender, e) => { await Navigation.PushModalAsync (new PlaceOrder()); await RefreshItems(true, true); }; // Filter Select var filterSelectStack = new StackLayout () {Padding=new Thickness (15, 15, 15, 15), Orientation=StackOrientation.Vertical, VerticalOptions=LayoutOptions.StartAndExpand, BackgroundColor=Color.FromHex(ThemeColors.TextIcons)}; var outerStack = new StackLayout(){Orientation=StackOrientation.Vertical, VerticalOptions=LayoutOptions.StartAndExpand, BackgroundColor=Color.FromHex(ThemeColors.PrimaryDark)}; var instructionLabel = new Label () { Text = "Click on an Entry for Details", FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)), TextColor=Color.FromHex(ThemeColors.TextIcons) }; instructionStack.Children.Add (instructionLabel); outerStack.Children.Add (instructionStack); var scrollview = new ScrollView { Content = new StackLayout { Children = { filterSelectStack, todoList }, BackgroundColor=Color.FromHex(ThemeColors.TextIcons) }, }; outerStack.Children.Add (scrollview); var buttonStack = new StackLayout () {BackgroundColor=Color.FromHex(ThemeColors.Primary), Children = {orderButton}, Orientation=StackOrientation.Vertical, VerticalOptions=LayoutOptions.EndAndExpand }; outerStack.Children.Add (buttonStack); Content = outerStack; }
public SearchInventory() { InitializeComponent(); manager = CarItemManager.DefaultManager; var instructionStack = new StackLayout () { BackgroundColor = Color.FromHex(ThemeColors.PrimaryDark), Padding=new Thickness (15, 15, 15, 15)}; // Filter Select var filterSelectStack = new StackLayout () {Padding=new Thickness (15, 15, 15, 15), Orientation=StackOrientation.Vertical, VerticalOptions=LayoutOptions.StartAndExpand, BackgroundColor=Color.FromHex(ThemeColors.TextIcons)}; var outerStack = new StackLayout(){Orientation=StackOrientation.Vertical, VerticalOptions=LayoutOptions.StartAndExpand, BackgroundColor=Color.FromHex(ThemeColors.PrimaryDark)}; var instructionLabel = new Label () { Text = "Select a Filter, and Refresh Page", FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)), TextColor=Color.FromHex(ThemeColors.TextIcons) }; instructionStack.Children.Add (instructionLabel); outerStack.Children.Add (instructionStack); searchEntry.TextChanged += (sender, e) => { searchEntryContent = e.NewTextValue; Debug.WriteLine("Search Content: " + searchEntryContent); }; var searchPicker = new MyPicker(); filterSelectStack.Children.Add(searchPicker); foreach (string i in searchParam) { searchPicker.Items.Add(i); } searchPicker.SelectedIndexChanged += (sender, args) => { if (searchParam.ElementAt(searchPicker.SelectedIndex) == "Audio System" || searchParam.ElementAt(searchPicker.SelectedIndex) == "Average MPG" || searchParam.ElementAt(searchPicker.SelectedIndex) == "Car Status" || searchParam.ElementAt(searchPicker.SelectedIndex) == "Current Dealership" || searchParam.ElementAt(searchPicker.SelectedIndex) == "Customer Name" || searchParam.ElementAt(searchPicker.SelectedIndex) == "Customer Phone" || searchParam.ElementAt(searchPicker.SelectedIndex) == "Paint Color" || searchParam.ElementAt(searchPicker.SelectedIndex) == "Price" || searchParam.ElementAt(searchPicker.SelectedIndex) == "Trim" || searchParam.ElementAt(searchPicker.SelectedIndex) == "VIN" || searchParam.ElementAt(searchPicker.SelectedIndex) == "Year" || searchParam.ElementAt(searchPicker.SelectedIndex) == "Model") { searchEntry.IsVisible = true; searchEntry.TextChanged += SearchEntry_TextChanged; } else if (searchParam.ElementAt(searchPicker.SelectedIndex) == "Default") { HideEntry(); queryCriteria = "SearchInventory"; } else { HideEntry(); queryCriteria = searchParam.ElementAt(searchPicker.SelectedIndex); } }; filterSelectStack.Children.Add (searchPicker); filterSelectStack.Children.Add (searchEntry); var scrollview = new ScrollView { Content = new StackLayout { Children = { filterSelectStack, todoList }, BackgroundColor=Color.FromHex(ThemeColors.TextIcons) }, }; outerStack.Children.Add (scrollview); Content = outerStack; }
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); }
void CreateUI(CarItemManager manager) { // StackLayot stacklayout var stackLayout = new StackLayout(); var generalInfoSection = new Label(); stackLayout.Children.Add(generalInfoSection); var generalInfoText = new Label(); stackLayout.Children.Add(generalInfoText); stackLayout.Children.Add(new BoxView { Color = Color.FromHex("B6B6B6"), HeightRequest = 1, HorizontalOptions = LayoutOptions.FillAndExpand }); var customerInformationSection = new Label(); stackLayout.Children.Add(customerInformationSection); var inventoryOrder = new Label (); stackLayout.Children.Add(inventoryOrder); var inventoryOrderPicker = new MyPicker(); stackLayout.Children.Add(inventoryOrderPicker); var customerName = new Entry(); stackLayout.Children.Add(customerName); customerName.IsVisible = false; var customerPhone = new Entry(); stackLayout.Children.Add(customerPhone); customerPhone.IsVisible = false; stackLayout.Children.Add(new BoxView { Color = Color.FromHex("B6B6B6"), HeightRequest = 1, HorizontalOptions = LayoutOptions.FillAndExpand }); var carDetailsSection = new Label(); stackLayout.Children.Add(carDetailsSection); var carYear = new Entry(); stackLayout.Children.Add(carYear); var carModel = new Entry(); stackLayout.Children.Add(carModel); var carPrice = new Entry(); stackLayout.Children.Add(carPrice); var carEngine = new Entry(); stackLayout.Children.Add(carEngine); var automaticTransmission = new Label(); stackLayout.Children.Add(automaticTransmission); var automaticTransPicker = new MyPicker(); stackLayout.Children.Add(automaticTransPicker); var powersteeringLabel = new Label(); stackLayout.Children.Add(powersteeringLabel); var powersteeringPicker = new MyPicker(); stackLayout.Children.Add(powersteeringPicker); var antilockbrakesLabel = new Label(); stackLayout.Children.Add(antilockbrakesLabel); var antilockbrakesPicker = new MyPicker(); stackLayout.Children.Add(antilockbrakesPicker); var onboardComputerLabel = new Label(); stackLayout.Children.Add(onboardComputerLabel); var onboardComputerPicker = new MyPicker(); stackLayout.Children.Add(onboardComputerPicker); var serviceLightLabel = new Label(); stackLayout.Children.Add(serviceLightLabel); var serviceLightPicker = new MyPicker(); stackLayout.Children.Add(serviceLightPicker); var airbagLabel = new Label(); stackLayout.Children.Add(airbagLabel); var airbagPicker = new MyPicker(); stackLayout.Children.Add(airbagPicker); var fuelcutoffLabel = new Label(); stackLayout.Children.Add(fuelcutoffLabel); var fuelcutoffPicker = new MyPicker(); stackLayout.Children.Add(fuelcutoffPicker); var metallicPaintLabel = new Label(); stackLayout.Children.Add(metallicPaintLabel); var metallicPaintPicker = new MyPicker(); stackLayout.Children.Add(metallicPaintPicker); var paintColor = new Entry(); stackLayout.Children.Add(paintColor); var wheelTypeLabel = new Label(); stackLayout.Children.Add(wheelTypeLabel); var wheelTypePicker = new MyPicker(); stackLayout.Children.Add(wheelTypePicker); var audioSystemLabel = new Entry(); stackLayout.Children.Add(audioSystemLabel); var averageMPGLabel = new Entry(); stackLayout.Children.Add(averageMPGLabel); var keylessEntryLabel = new Label(); stackLayout.Children.Add(keylessEntryLabel); var keylessEntryPicker = new MyPicker(); stackLayout.Children.Add(keylessEntryPicker); var airconditioningLabel = new Label(); stackLayout.Children.Add(airconditioningLabel); var airconditioningPicker = new MyPicker(); stackLayout.Children.Add(airconditioningPicker); var remoteStartLabel = new Label(); stackLayout.Children.Add(remoteStartLabel); var remoteStartPicker = new MyPicker(); stackLayout.Children.Add(remoteStartPicker); var cruiseControlLabel = new Label(); stackLayout.Children.Add(cruiseControlLabel); var cruiseControlPicker = new MyPicker(); stackLayout.Children.Add(cruiseControlPicker); var trimLabel = new Label(); stackLayout.Children.Add(trimLabel); var trimPicker = new MyPicker(); stackLayout.Children.Add(trimPicker); var warrantyLabel = new Label(); stackLayout.Children.Add(warrantyLabel); var warrantyPicker = new MyPicker(); stackLayout.Children.Add(warrantyPicker); var rearBrakeStyleLabel = new Label(); stackLayout.Children.Add(rearBrakeStyleLabel); var rearBrakeStylePicker = new MyPicker(); stackLayout.Children.Add(rearBrakeStylePicker); var frontBrakeStyleLabel = new Label(); stackLayout.Children.Add(frontBrakeStyleLabel); var frontBrakeStylePicker = new MyPicker(); stackLayout.Children.Add(frontBrakeStylePicker); stackLayout.Children.Add(new BoxView { Color = Color.FromHex("B6B6B6"), HeightRequest = 1, HorizontalOptions = LayoutOptions.FillAndExpand }); stackLayout.Padding = new Thickness(15, 15, 15, 15); // StackLayout Ordered var OrderedStack = new StackLayout(); var orderCarButton = new Button { Text = "Order Car", HeightRequest=90 }; OrderedStack.Children.Add(stackLayout); var activityIndicator = new ActivityIndicator() { IsEnabled = true ,IsVisible = false, IsRunning = false }; OrderedStack.Children.Add (activityIndicator); var orderCarConfirmation = new Label(); OrderedStack.Children.Add(orderCarConfirmation); orderCarConfirmation.IsVisible = false; var orderCarConfirmationInstruction = new Label(); OrderedStack.Children.Add(orderCarConfirmationInstruction); orderCarConfirmationInstruction.IsVisible = false; OrderedStack.Children.Add (orderCarButton); orderCarConfirmation.Text = "Car Ordered. VIN#: " + car.VIN; orderCarConfirmationInstruction.Text = "Please write down number for reference"; //buttonStack.BackgroundColor = Color.FromHex (ThemeColors.TextIcons); stackLayout.BackgroundColor = Color.FromHex(ThemeColors.TextIcons); OrderedStack.BackgroundColor = Color.FromHex(ThemeColors.PrimaryDark); orderCarConfirmation.BackgroundColor = Color.FromHex(ThemeColors.PrimaryDark); orderCarConfirmationInstruction.BackgroundColor = Color.FromHex(ThemeColors.PrimaryDark); orderCarConfirmation.TextColor = Color.FromHex(ThemeColors.PrimaryDark); orderCarConfirmation.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)); orderCarConfirmationInstruction.TextColor = Color.FromHex(ThemeColors.PrimaryDark); orderCarConfirmationInstruction.FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)); var scrollview = new ScrollView { Content = new StackLayout { Children = { OrderedStack }, }, }; var outerStack = new StackLayout(); outerStack.Children.Add(scrollview); Content = outerStack; // General Info generalInfoSection.Text = "General Info"; generalInfoSection.FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)); generalInfoSection.TextColor = Color.FromHex(ThemeColors.Primary); generalInfoText.Text = "Add Car to Inventory. Please enter all of the following fields to ensure a proper car order, and inventory entry. All cars in invetory must be from 2010 or newer, and are North American models."; generalInfoText.TextColor = Color.FromHex(ThemeColors.PrimaryText); //Customer Info customerInformationSection.Text = "Customer Information"; customerInformationSection.FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)); customerInformationSection.TextColor = Color.FromHex(ThemeColors.Primary); //customerID.Text = "Customer ID#: " + car.CustomerID; inventoryOrder.Text = "Will this be an order for a customer or dealership?"; foreach (string i in customerOrDealerList) { inventoryOrderPicker.Items.Add(i); } inventoryOrderPicker.SelectedIndexChanged += (sender, args) => { if (inventoryOrderPicker.SelectedIndex == 1) { //customerID.IsVisible = true; customerName.IsVisible = true; customerPhone.IsVisible = true; car.CarStatus = "OnOrder"; } else { customerName.IsVisible = false; customerPhone.IsVisible = false; car.CarStatus = "OnLot"; } Debug.WriteLine("CustomerName: " + car.CustomerName); }; customerName.PlaceholderColor = Color.FromHex(ThemeColors.SecondaryText); customerName.Placeholder = "Enter Customer Name"; customerName.TextChanged += (sender, e) => { car.CustomerName = e.NewTextValue; Debug.WriteLine("Customer Name: " + car.CustomerName); }; customerPhone.PlaceholderColor = Color.FromHex(ThemeColors.SecondaryText); customerPhone.Placeholder = "Enter Customer's Phone Number 555-555-5555"; customerPhone.TextChanged += (sender, e) => { car.CustomerPhone = e.NewTextValue; Debug.WriteLine("Customer Number: " + car.CustomerPhone); }; customerPhone.Keyboard = Keyboard.Numeric; //Car Details carDetailsSection.Text = "Car Details"; carDetailsSection.FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)); carDetailsSection.TextColor = Color.FromHex(ThemeColors.Primary); // ---------------------------- carYear.PlaceholderColor = Color.FromHex(ThemeColors.SecondaryText); carYear.Placeholder = "Enter Year of Manufacture"; carYear.TextChanged += (sender, e) => { car.Year = e.NewTextValue; Debug.WriteLine("Car Year: " + car.Year); }; carYear.Keyboard = Keyboard.Numeric; // ---------------------------- carModel.PlaceholderColor = Color.FromHex(ThemeColors.SecondaryText); carModel.Placeholder = "Enter Model"; carModel.TextChanged += (sender, e) => { car.Model = e.NewTextValue; Debug.WriteLine("Car Model: " + car.Model); }; // ---------------------------- carPrice.Placeholder = "Enter Price"; carPrice.TextChanged += (sender, e) => { car.Price = e.NewTextValue; Debug.WriteLine("Car Price: " + car.Price); }; carPrice.Keyboard = Keyboard.Numeric; // ---------------------------- averageMPGLabel.Placeholder = "Enter Miles Per Gallon"; averageMPGLabel.TextChanged += (sender, e) => { car.AverageMilesPerGallon = e.NewTextValue; Debug.WriteLine("averageMPGLabel MPG: " + car.AverageMilesPerGallon); }; // ---------------------------- carEngine.PlaceholderColor = Color.FromHex(ThemeColors.SecondaryText); carEngine.Placeholder = "Enter Engine Type ie. 4-Cylinder"; carEngine.TextChanged += (sender, e) => { car.EngineType = e.NewTextValue; Debug.WriteLine("Engine Type: " + car.EngineType); }; // ---------------------------- automaticTransmission.Text = "Does the car have an automatic transmission?"; automaticTransmission.TextColor = Color.FromHex(ThemeColors.PrimaryText); foreach (string i in yesNoList) { automaticTransPicker.Items.Add(i); } automaticTransPicker.SelectedIndexChanged += (sender, args) => { if (automaticTransPicker.SelectedIndex == 0) car.AutomaticTransmission = false; else car.AutomaticTransmission = true; Debug.WriteLine("Automatic Trans: " + car.AutomaticTransmission); }; // ---------------------------- powersteeringLabel.Text = "Does the car have powersteering?"; powersteeringLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText); foreach (string i in yesNoList) { powersteeringPicker.Items.Add(i); } powersteeringPicker.SelectedIndexChanged += (sender, args) => { if (powersteeringPicker.SelectedIndex == 0) car.PowerSteering = false; else car.PowerSteering = true; Debug.WriteLine("Powersteering: " + car.PowerSteering); }; // ---------------------------- antilockbrakesLabel.Text = "Does the car have antilock brakes?"; antilockbrakesLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText); foreach (string i in yesNoList) { antilockbrakesPicker.Items.Add(i); } antilockbrakesPicker.SelectedIndexChanged += (sender, args) => { if (antilockbrakesPicker.SelectedIndex == 0) car.AntiLockBrakes = false; else car.AntiLockBrakes = true; Debug.WriteLine("Antilock Brakes: " + car.AntiLockBrakes); }; // ---------------------------- onboardComputerLabel.Text = "Does the car have an onboard computer?"; onboardComputerLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText); foreach (string i in yesNoList) { onboardComputerPicker.Items.Add(i); } onboardComputerPicker.SelectedIndexChanged += (sender, args) => { if (onboardComputerPicker.SelectedIndex == 0) car.OnBoardComputer = false; else car.OnBoardComputer = true; Debug.WriteLine("OnBoard Computer: " + car.OnBoardComputer); }; // ---------------------------- serviceLightLabel.Text = "Does the car have a service light indicator?"; serviceLightLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText); foreach (string i in yesNoList) { serviceLightPicker.Items.Add(i); } serviceLightPicker.SelectedIndexChanged += (sender, args) => { if (serviceLightPicker.SelectedIndex == 0) car.ServiceIndicator = false; else car.ServiceIndicator = true; Debug.WriteLine("ServiceLight: " + car.ServiceIndicator); }; // ---------------------------- airbagLabel.Text = "Does the car have airbags?"; airbagLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText); foreach (string i in yesNoList) { airbagPicker.Items.Add(i); } airbagPicker.SelectedIndexChanged += (sender, args) => { if (airbagPicker.SelectedIndex == 0) car.Airbags = false; else car.Airbags = true; Debug.WriteLine("Airbags: " + car.Airbags); }; // ---------------------------- fuelcutoffLabel.Text = "Does the car have fuel cutoff?"; fuelcutoffLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText); foreach (string i in yesNoList) { fuelcutoffPicker.Items.Add(i); } fuelcutoffPicker.SelectedIndexChanged += (sender, args) => { if (fuelcutoffPicker.SelectedIndex == 0) car.FuelCutoff = false; else car.FuelCutoff = true; Debug.WriteLine("Fuel Cutoff: " + car.FuelCutoff); }; // ---------------------------- metallicPaintLabel.Text = "Does the car have metallic paint?"; metallicPaintLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText); foreach (string i in yesNoList) { metallicPaintPicker.Items.Add(i); } metallicPaintPicker.SelectedIndexChanged += (sender, args) => { if (metallicPaintPicker.SelectedIndex == 0) car.MetallicPaint = false; else car.MetallicPaint = true; Debug.WriteLine("Metallic Paint: " + car.MetallicPaint); }; // ---------------------------- paintColor.Placeholder = "Enter Paint Color"; paintColor.TextChanged += (sender, e) => { car.PaintColor = e.NewTextValue;}; // ---------------------------- wheelTypeLabel.Text = "What wheel style does the car have?"; wheelTypeLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText); List<string> wheelArray = new List<string> { "Star Spoke", "Alloy" }; foreach (string i in wheelArray) { wheelTypePicker.Items.Add(i); } wheelTypePicker.SelectedIndexChanged += (sender, args) => { if (wheelTypePicker.SelectedIndex == 0) car.AlloyWheels = false; else car.AlloyWheels = true; Debug.WriteLine("Alloy Wheels: " + car.MetallicPaint); }; // ---------------------------- audioSystemLabel.PlaceholderColor = Color.FromHex(ThemeColors.SecondaryText); audioSystemLabel.Placeholder = "Enter Audiosystem Details"; audioSystemLabel.TextChanged += (sender, e) => { car.AudioSystem = e.NewTextValue; Debug.WriteLine("Audio System: " + car.AudioSystem); }; // ---------------------------- keylessEntryLabel.Text = "Does the car have wireless entry?"; keylessEntryLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText); foreach (string i in yesNoList) { keylessEntryPicker.Items.Add(i); } keylessEntryPicker.SelectedIndexChanged += (sender, args) => { if (keylessEntryPicker.SelectedIndex == 0) car.KeylessEntry = false; else car.KeylessEntry = true; Debug.WriteLine("Keyless Entry: " + car.KeylessEntry); }; // ---------------------------- airconditioningLabel.Text = "Does the car have air conditioning?"; airconditioningLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText); foreach (string i in yesNoList) { airconditioningPicker.Items.Add(i); } airconditioningPicker.SelectedIndexChanged += (sender, args) => { if (airconditioningPicker.SelectedIndex == 0) car.AirConditioning = false; else car.AirConditioning = true; Debug.WriteLine("A/C: " + car.AirConditioning); }; // ---------------------------- remoteStartLabel.Text = "Does the car have remote start?"; remoteStartLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText); foreach (string i in yesNoList) { remoteStartPicker.Items.Add(i); } remoteStartPicker.SelectedIndexChanged += (sender, args) => { if (remoteStartPicker.SelectedIndex == 0) car.RemoteStart = false; else car.RemoteStart = true; Debug.WriteLine("Remote Start: " + car.RemoteStart); }; // ---------------------------- cruiseControlLabel.Text = "Does the car have cruise control?"; cruiseControlLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText); foreach (string i in yesNoList) { cruiseControlPicker.Items.Add(i); } cruiseControlPicker.SelectedIndexChanged += (sender, args) => { if (cruiseControlPicker.SelectedIndex == 0) car.CruiseControl = false; else car.CruiseControl = true; Debug.WriteLine("Cruise Control " + car.CruiseControl); }; // ---------------------------- trimLabel.Text = "Which Trim?"; trimLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText); List<string> trimList = new List<string> { "LE", "XLE", "SE", "Special Edition", "XSE", "Hybrid LE", "Hybrid SE", "Hybrid XLE" }; foreach (string i in trimList) { trimPicker.Items.Add(i); } trimPicker.SelectedIndexChanged += (sender, args) => { car.Trim = trimList.ElementAt(trimPicker.SelectedIndex); Debug.WriteLine("Trim: " + car.Trim); }; // ---------------------------- warrantyLabel.Text = "Warranty Package"; warrantyLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText); List<string> warrantyList = new List<string> { "Standard", "Premium 100k 10 Year" }; foreach (string i in warrantyList) { warrantyPicker.Items.Add(i); } warrantyPicker.SelectedIndexChanged += (sender, args) => { if (warrantyPicker.SelectedIndex == 0) car.WarrantyProgramType = "Standard"; else car.WarrantyProgramType = "Premium 100k 10 Year"; Debug.WriteLine("Warranty: " + car.WarrantyProgramType); }; // ---------------------------- rearBrakeStyleLabel.Text = "Rear Brake Type"; rearBrakeStyleLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText); List<string> brakeList = new List<string> { "Drum", "Disk" }; foreach (string i in brakeList) { rearBrakeStylePicker.Items.Add(i); } rearBrakeStylePicker.SelectedIndexChanged += (sender, args) => { if (rearBrakeStylePicker.SelectedIndex == 0) car.RearBrakes = "Drum"; else car.RearBrakes = "Disk"; Debug.WriteLine("Rear Brake Type: " + car.RearBrakes); }; // ---------------------------- frontBrakeStyleLabel.Text = "Front Brake Type"; frontBrakeStyleLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText); foreach (string i in brakeList) { frontBrakeStylePicker.Items.Add(i); } frontBrakeStylePicker.SelectedIndexChanged += (sender, args) => { if (frontBrakeStylePicker.SelectedIndex == 0) car.FrontBrakes = "Drum"; else car.FrontBrakes = "Disk"; Debug.WriteLine("Front Brake Type: " + car.FrontBrakes); }; orderCarButton.Clicked += async (sender, e) => { car.DeliveryDateToNewDealer = DateTime.Now;; activityIndicator.IsRunning = true; activityIndicator.IsVisible = true; orderCarButton.IsEnabled = false; await AddItem(car); activityIndicator.IsVisible = false; activityIndicator.IsRunning = false; orderCarConfirmation.Text = "Car Ordered. VIN#: " + car.VIN; orderCarConfirmationInstruction.Text = "Please write down number for reference"; orderCarConfirmation.IsVisible = true; orderCarConfirmationInstruction.IsVisible = true; stackLayout.BackgroundColor = Color.FromHex (ThemeColors.TextIcons); OrderedStack.BackgroundColor = Color.FromHex (ThemeColors.PrimaryDark); orderCarConfirmation.BackgroundColor = Color.FromHex (ThemeColors.PrimaryDark); orderCarConfirmationInstruction.BackgroundColor = Color.FromHex (ThemeColors.PrimaryDark); orderCarConfirmation.TextColor = Color.FromHex (ThemeColors.Accent); orderCarConfirmation.FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label)); orderCarConfirmationInstruction.TextColor = Color.FromHex (ThemeColors.TextIcons); orderCarConfirmationInstruction.FontSize = Device.GetNamedSize (NamedSize.Micro, typeof(Label)); orderCarButton.Focus (); }; }
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); }