示例#1
0
        void ChoosePhone(ListViewItem item)
        {
            string modelKey   = item.Tag.ToString();
            string modelImage = modelKey;

            if (modelKey.StartsWith("iPhone"))
            {
                modelImage = modelKey.Split('-')[0];
            }
            phonePictureBox.Image = (Image)Properties.Resources.ResourceManager.GetObject(modelImage);

            phone = new PhoneModel(modelKey);
            phoneNameLabel.Text     = phone.Name;
            priceLabel.Text         = "Giá: " + phone.Price;
            batteryLabel.Text       = "Dung lượng pin: " + phone.BatteryCapacity;
            screenSizeLabel.Text    = "Kích thước màn hình: " + phone.ScreenSize;
            resolutionLabel.Text    = "Độ phân giải: " + phone.Resolution;
            colorLabel.Text         = "Màu sắc: " + phone.Color;
            OSLabel.Text            = "HĐH: " + phone.OS;
            CPULabel.Text           = "CPU: " + phone.CPU;
            RAMLabel.Text           = "RAM: " + phone.RAMCapacity;
            storageLabel.Text       = "Bộ nhớ trong: " + phone.StorageCapacity;
            frontCamLabel.Text      = "Camera trước: " + phone.FrontCamera;
            rearCamLabel.Text       = "Camera sau: " + phone.RearCamera;
            materialLabel.Text      = "Chất liệu: " + phone.Material;
            otherfeaturesLabel.Text = "Các tính năng khác: " + phone.OtherFeatures;

            if (consultOptions.IsConsulting() && ModelScorePercentage.ContainsKey(modelKey))
            {
                float scorePercentage = ModelScorePercentage[modelKey];
                Color color           = GetHighlightColor(Color.GreenYellow, scorePercentage);
                if (scorePercentage >= 0.5)
                {
                    suggestedLabel.Visible   = true;
                    suggestedLabel.BackColor = color;
                }
                else
                {
                    suggestedLabel.Visible = false;
                }

                suitableButton.Visible   = true;
                suitableButton.BackColor = color;
                suitableButton.Text      = "Mức độ phù hợp:\r\n" + ((int)(scorePercentage * 100)).ToString() + " %";
            }
            else
            {
                suggestedLabel.Visible = false;
                suitableButton.Visible = false;
            }
        }
示例#2
0
        void ResetAllPhones()
        {
            ShowPhones(PhoneModel.GetAllModels());

            ignoreUpdate = true;

            manufacComboBox.SelectedIndex       = 0;
            priceComboBox.SelectedIndex         = 0;
            materialComboBox.SelectedIndex      = 0;
            colorComboBox.SelectedIndex         = 0;
            OSComboBox.SelectedIndex            = 0;
            screenSizeComboBox.SelectedIndex    = 0;
            frontCamComboBox.SelectedIndex      = 0;
            rearCamComboBox.SelectedIndex       = 0;
            batteryComboBox.SelectedIndex       = 0;
            storageComboBox.SelectedIndex       = 0;
            RAMComboBox.SelectedIndex           = 0;
            otherFeaturesComboBox.SelectedIndex = 0;

            genderComboBox.SelectedIndex = 0;
            ageComboBox.SelectedIndex    = 0;
            foreach (int i in hobbyCheckedListBox.CheckedIndices)
            {
                hobbyCheckedListBox.SetItemChecked(i, false);
            }
            foreach (int i in majorCheckedListBox.CheckedIndices)
            {
                majorCheckedListBox.SetItemChecked(i, false);
            }
            foreach (int i in demandCheckedListBox.CheckedIndices)
            {
                demandCheckedListBox.SetItemChecked(i, false);
            }

            ignoreUpdate = false;

            suggestedLabel.Visible = false;
            suitableButton.Visible = false;
        }