コード例 #1
0
ファイル: TSPicker.cs プロジェクト: sangchul1011/TizenFX
        public void PickerApplyStyle()
        {
            tlog.Debug(tag, $"PickerApplyStyle START");

            var testingTarget = new MyPicker();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <Picker>(testingTarget, "Should return Picker instance.");

            try
            {
                ViewStyle style = new ViewStyle()
                {
                    Size = new Size(30, 80),
                };
                testingTarget.ApplyStyle(style);
            }
            catch (Exception e)
            {
                tlog.Debug(tag, e.Message.ToString());
                Assert.Fail("Caught Exception : Failed!");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"PickerApplyStyle END (OK)");
        }
コード例 #2
0
ファイル: TSPicker.cs プロジェクト: sangchul1011/TizenFX
        public async Task PickerOnRelayout()
        {
            tlog.Debug(tag, $"PickerOnRelayout START");

            var testingTarget = new MyPicker()
            {
                Size            = new Size(100, 200),
                BackgroundColor = Color.Green,
            };

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <Picker>(testingTarget, "Should return Picker instance.");

            NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(testingTarget);

            testingTarget.Size            = new Size(50, 100);
            testingTarget.BackgroundColor = Color.Blue;

            await Task.Delay(200);

            NUIApplication.GetDefaultWindow().GetDefaultLayer().Remove(testingTarget);

            testingTarget.Dispose();
            tlog.Debug(tag, $"PickerOnRelayout END (OK)");
        }
コード例 #3
0
        public MainPage()
        {
            InitializeComponent();

            MyPicker picker = new MyPicker
            {
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Center,
                WidthRequest      = 73,
                HeightRequest     = 25,
                //BackgroundColor = Color.Black
                TextColor = Color.Black
            };

            List <string> myList = new List <string>();

            myList.Add("OPTIONS 1");
            myList.Add("OPTIONS 2");
            myList.Add("OPTIONS 3");
            myList.Add("OPTIONS 4");
            myList.Add("OPTIONS 5");

            foreach (string str in myList)
            {
                picker.Items.Add(str);
            }

            this.Content = picker;


            picker.SelectedIndexChanged += Picker_SelectedIndexChanged;

            picker.Focused   += Picker_Focused;
            picker.Unfocused += Picker_Unfocused;
        }
コード例 #4
0
        private void SetFontSize(MyPicker Content)
        {
            Typeface font  = Typeface.CreateFromAsset(Forms.Context.Assets, "MyriadProRegular.ttf");
            TextView label = (TextView)Control;

            label.Typeface        = font;
            this.Control.TextSize = Content.FontSize;
        }
コード例 #5
0
        protected override void OnElementChanged(ElementChangedEventArgs <Picker> e)
        {
            base.OnElementChanged(e);

            element = (MyPicker)this.Element;

            if (Control != null && this.Element != null && !string.IsNullOrEmpty(element.Image))
            {
                Control.Background = AddPickerStyles(element.Image);
            }
        }
コード例 #6
0
 protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Picker> e)
 {
     base.OnElementChanged(e);
     if (e.NewElement != null)
     {
         MyPicker Content = e.NewElement as MyPicker;
         SetTextColor(Content);
         SetFontSize(Content);
         SetXAlign(Content);
     }
 }
コード例 #7
0
        protected override void OnElementChanged(ElementChangedEventArgs <Picker> e)
        {
            base.OnElementChanged(e);

            if (Control == null && Element == null)
            {
                return;
            }

            MyPicker entry = Element as MyPicker;

            DrawLine(Control, entry.LineColor.ToAndroid());
        }
コード例 #8
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Picker> e)
        {
            base.OnElementChanged(e);
            if (e.NewElement != null)
            {
                MyPicker Content = e.NewElement as MyPicker;
                SetPlaceholderColor(Content);
                SetTextColor(Content);
                SetFontSize(Content);
                SetXAlign(Content);

                ShapeDrawable shape = new ShapeDrawable(new RectShape());
                shape.Paint.Color       = Xamarin.Forms.Color.Transparent.ToAndroid();
                shape.Paint.StrokeWidth = 5;
                shape.Paint.SetStyle(Paint.Style.Stroke);
                this.Control.SetBackground(shape);
            }
        }
コード例 #9
0
        protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);
            MyPicker Content = sender as MyPicker;

            Control.BorderStyle = UITextBorderStyle.None;

            if (e.PropertyName == MyPicker.TextColorProperty.PropertyName)
            {
                SetTextColor(Content);
            }
            if (e.PropertyName == MyPicker.FontSizeProperty.PropertyName)
            {
                SetFontSize(Content);
            }
            if (e.PropertyName == MyPicker.HorizontalTextAlignmentProperty.PropertyName)
            {
                SetXAlign(Content);
            }
        }
コード例 #10
0
ファイル: TSPicker.cs プロジェクト: sangchul1011/TizenFX
        public void PickerOnInitialize()
        {
            tlog.Debug(tag, $"PickerOnInitialize START");

            var testingTarget = new MyPicker();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <Picker>(testingTarget, "Should return Picker instance.");

            try
            {
                testingTarget.OnInitialize();
            }
            catch (Exception e)
            {
                tlog.Debug(tag, e.Message.ToString());
                Assert.Fail("Caught Exception : Failed!");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"PickerOnInitialize END (OK)");
        }
コード例 #11
0
			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 ();
				};
			}
コード例 #12
0
 private void SetTextColor(MyPicker Content)
 {
     this.Control.SetTextColor(Content.TextColor.ToAndroid());
 }
コード例 #13
0
 private void SetPlaceholderColor(MyPicker Content)
 {
     this.Control.SetHintTextColor(Content.PlaceholderColor.ToAndroid());
 }
コード例 #14
0
 private void SetFontSize(MyPicker Content)
 {
     Control.Font = UIFont.FromName("Myriad Pro", Content.FontSize);
 }
コード例 #15
0
 private void SetTextColor(MyPicker Content)
 {
     this.Control.TextColor = Content.TextColor.ToUIColor();
 }
コード例 #16
0
		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);
		}
コード例 #17
0
		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;
		}
コード例 #18
0
 private void SetXAlign(MyPicker Content)
 {
     this.Control.TextAlignment = AndroidUtilits.ToUITextAlignment(Content.HorizontalTextAlignment);
 }