コード例 #1
0
        private void cbOperatorDynamic_SelectedIndexChanged(int rCount)
        {
            Control[] op = pnlConditions.Controls.Find("cbOperator" + rCount, true);
            Control[] tb = pnlConditions.Controls.Find("tbValue" + rCount, true);

            if (op.Length <= 0)
            {
                throw new ArgumentException("No control with name cbOperator" + rCount + " was found!");
            }

            if (tb.Length <= 0)
            {
                throw new ArgumentException("No control with name tbValue" + rCount + " was found!");
            }

            MaterialComboBox cbOperatorDynamic = (MaterialComboBox)op[0];
            MaterialTextBox  tbValueDynamic    = (MaterialTextBox)tb[0];

            if (cbOperatorDynamic.SelectedItem.ToString() == "true" || cbOperatorDynamic.SelectedItem.ToString() == "false")
            {
                tbValueDynamic.Text    = "N/A";
                tbValueDynamic.Enabled = false;
            }
            else
            {
                tbValueDynamic.Text    = "";
                tbValueDynamic.Enabled = true;
            }
        }
コード例 #2
0
        //TODO: Kann zusammengefasst werden !

        public static MaterialComboBox CreateComboboxItems <T>(List <T> datasource, MaterialComboBox cb, string displayAttr, string valueAttr)
        {
            cb.DataSource    = datasource;
            cb.DisplayMember = displayAttr;
            cb.ValueMember   = valueAttr;
            return(cb);
        }
コード例 #3
0
 public static MaterialComboBox CreateStreckenCbItems(IDatabaseConnector db, MaterialComboBox cb)
 {
     cb.DataSource    = db.ZeigeAlleStrecken();
     cb.DisplayMember = "Name";
     cb.ValueMember   = "StreckenID";
     return(cb);
 }
コード例 #4
0
        public void Save(ArcticFoxConfiguration.Profile profile)
        {
            profile.Flags.IsEnabled = ProfileEnabledCheckBox.Checked;
            profile.Name            = ProfileNameTextBox.Text;
            profile.Power           = (ushort)(PowerUpDown.Value * 10);
            profile.PreheatType     = PreheatTypeComboBox.GetSelectedItem <ArcticFoxConfiguration.PreheatType>();
            if (profile.PreheatType == ArcticFoxConfiguration.PreheatType.Watts)
            {
                profile.PreheatPower = (ushort)(PreheatPowerUpDown.Value * 10);
            }
            else if (profile.PreheatType == ArcticFoxConfiguration.PreheatType.Percents)
            {
                profile.PreheatPower = (ushort)PreheatPowerUpDown.Value;
            }
            else if (profile.PreheatType == ArcticFoxConfiguration.PreheatType.Curve)
            {
                profile.SelectedCurve = (byte)PowerCurveComboBox.SelectedIndex;
            }
            profile.PreheatTime  = (byte)(PreheatTimeUpDown.Value * 100);
            profile.PreheatDelay = (byte)PreheatDelayUpDown.Value;

            profile.Flags.IsCelcius             = TemperatureTypeComboBox.GetSelectedItem <bool>();
            profile.Temperature                 = (ushort)TemperatureUpDown.Value;
            profile.Flags.IsTemperatureDominant = TemperatureDominantCheckBox.Checked;

            var mode = ModeComboBox.GetSelectedItem <Mode>();

            profile.Flags.Material = mode == Mode.TemperatureControl
                                ? MaterialComboBox.GetSelectedItem <ArcticFoxConfiguration.Material>()
                                : ArcticFoxConfiguration.Material.VariWatt;

            profile.TCR        = (ushort)TCRUpDown.Value;
            profile.Resistance = (ushort)(ResistanceUpDown.Value * 1000);
            profile.Flags.IsResistanceLocked = ResistanceLockedCheckBox.Checked;
        }
コード例 #5
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            foreach (Control c in this.Controls)
            {
                if (c is MaterialTextBox)
                {
                    c.ResetText();
                }
                if (c is MaterialMultiLineTextBox)
                {
                    c.Text = "{ }";
                }
                if (c is MaterialComboBox)
                {
                    MaterialComboBox cb = (MaterialComboBox)c;

                    if (cb.Name == "cbType")
                    {
                        cb.SelectedItem = cb.Items[0];
                    }
                    else
                    {
                        cb.SelectedItem = null;
                    }

                    cb.Invalidate();
                }
            }

            foreach (Control c in pnlConditions.Controls)
            {
                if (c is MaterialTextBox)
                {
                    c.ResetText();
                }
                if (c is MaterialComboBox)
                {
                    MaterialComboBox cb = (MaterialComboBox)c;

                    cb.SelectedItem = null;
                    cb.Invalidate();
                }
            }

            pnlConditions.AutoScrollPosition = new Point(0, 0);
            pnlConditions.Controls.Clear();

            pnlConditions.Controls.Add(cbCondition);
            pnlConditions.Controls.Add(cbDataType);
            pnlConditions.Controls.Add(tbProperty);
            pnlConditions.Controls.Add(cbOperator);
            pnlConditions.Controls.Add(tbValue);

            rowCount = 1;
        }
コード例 #6
0
        private void TCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                MaterialComboBox TCB = sender as MaterialComboBox;
                if (TCB.Name == "TACB")
                {
                    if (TCB.SelectedItem.ToString() == TBCB.SelectedItem.ToString())
                    {
                        if (TCB.SelectedItem.ToString() == "INCH")
                        {
                            TBCB.SelectedItem = "CM";
                        }
                        else if (TCB.SelectedItem.ToString() == "CM")
                        {
                            TBCB.SelectedItem = "PX";
                        }
                        else if (TCB.SelectedItem.ToString() == "PX")
                        {
                            TBCB.SelectedItem = "INCH";
                        }
                    }
                }
                else
                {
                    if (TCB.SelectedItem.ToString() == TACB.SelectedItem.ToString())
                    {
                        if (TCB.SelectedItem.ToString() == "INCH")
                        {
                            TACB.SelectedItem = "PX";
                        }
                        else if (TCB.SelectedItem.ToString() == "CM")
                        {
                            TACB.SelectedItem = "INCH";
                        }
                        else if (TCB.SelectedItem.ToString() == "PX")
                        {
                            TACB.SelectedItem = "CM";
                        }
                    }
                }

                Refresh();

                CFTB.Hint = "Core Formula [" + TACB.SelectedItem.ToString() + " - " + TBCB.SelectedItem.ToString() + "]";
                CFTB.Text = Values.GetValue("Typography", TACB.SelectedItem.ToString(), TBCB.SelectedItem.ToString());
            }
            catch
            {
                //
            }
        }
コード例 #7
0
        public void Initialize([NotNull] ArcticFoxConfiguration configuration, int profileIndex)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            m_configuration = configuration;
            m_profile       = configuration.General.Profiles[profileIndex];

            ProfileEnabledCheckBox.Checked = m_profile.Flags.IsEnabled;
            ProfileNameTextBox.Text        = m_profile.Name;
            PowerUpDown.Maximum            = configuration.Info.MaxDevicePower / 10m;
            PowerUpDown.SetValue(m_profile.Power / 10m);

            var selectedPreheatType = PreheatTypeComboBox.SelectedItem as NamedItemContainer <ArcticFoxConfiguration.PreheatType>;

            if (selectedPreheatType != null && selectedPreheatType.Data == m_profile.PreheatType)
            {
                PreheatTypeComboBox_SelectedValueChanged(null, EventArgs.Empty);
            }
            else
            {
                PreheatTypeComboBox.SelectItem(m_profile.PreheatType);
            }

            PowerCurveComboBox.SelectItem(m_profile.SelectedCurve);
            PreheatTimeUpDown.SetValue(m_profile.PreheatTime / 100m);
            PreheatDelayUpDown.SetValue(m_profile.PreheatDelay);

            ResistanceLockedCheckBox_CheckedChanged(null, EventArgs.Empty);

            TemperatureTypeComboBox.SelectItem(m_profile.Flags.IsCelcius);
            TemperatureUpDown.SetValue(m_profile.Temperature);
            TemperatureDominantCheckBox.Checked = m_profile.Flags.IsTemperatureDominant;

            if (m_profile.Flags.Material == ArcticFoxConfiguration.Material.VariWatt)
            {
                MaterialComboBox.SelectedIndex = 0;
                ModeComboBox.SelectItem(Mode.Power);
            }
            else
            {
                MaterialComboBox.SelectItem(m_profile.Flags.Material);
                ModeComboBox.SelectItem(Mode.TemperatureControl);
            }

            TCRUpDown.SetValue(m_profile.TCR);
            ResistanceUpDown.SetValue(m_profile.Resistance / 1000m);
            ResistanceLockedCheckBox.Checked = m_profile.Flags.IsResistanceLocked;
        }
コード例 #8
0
ファイル: CRYPTO.cs プロジェクト: moayyaed/Conforyon
        private void TCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                MaterialComboBox TCB = sender as MaterialComboBox;
                if (TCB.Name == "TACB")
                {
                    if (TACB.SelectedItem.ToString() == "TEXT" && TBCB.SelectedItem.ToString() == "TEXT")
                    {
                        TBCB.SelectedItem = "BASE64";
                    }
                    else if (TACB.SelectedItem.ToString() == "BASE64")
                    {
                        TBCB.SelectedItem = "TEXT";
                    }
                }
                else
                {
                    if (TBCB.SelectedItem.ToString() == "BASE64" && TACB.SelectedItem.ToString() == "BASE64")
                    {
                        TACB.SelectedItem = "TEXT";
                    }
                    else if (TBCB.SelectedItem.ToString() == "TEXT")
                    {
                        TACB.SelectedItem = "BASE64";
                    }
                    else
                    {
                        TACB.SelectedItem = "TEXT";
                    }
                }

                Refresh();

                if ((TACB.SelectedItem.ToString() == "TEXT" || TACB.SelectedItem.ToString() == "BASE64") && (TBCB.SelectedItem.ToString() == "TEXT" || TBCB.SelectedItem.ToString() == "BASE64"))
                {
                    TTB.Enabled  = true;
                    CRCB.Enabled = false;
                }
                else
                {
                    TTB.Enabled  = false;
                    CRCB.Enabled = true;
                }
            }
            catch
            {
                //
            }
        }
コード例 #9
0
        private void TCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                MaterialComboBox TCB = sender as MaterialComboBox;
                if (TCB.Name == "TACB")
                {
                    TBCB.SelectedIndex = TACB.SelectedIndex;
                }
                else
                {
                    TACB.SelectedIndex = TBCB.SelectedIndex;
                }

                Refresh();

                if (TACB.SelectedItem.ToString() == "HEX")
                {
                    CRTB.ReadOnly = true;
                    CRTB.Location = new Point(123, 48);
                    CGTB.ReadOnly = true;
                    CGTB.Location = new Point(185, 48);
                    CBTB.ReadOnly = true;
                    CBTB.Location = new Point(247, 48);
                    CHTB.ReadOnly = false;
                    CHTB.Location = new Point(3, 48);
                    CTB.Location  = new Point(3, 107);
                    CYB.Location  = new Point(191, 107);
                }
                else
                {
                    CRTB.ReadOnly = false;
                    CRTB.Location = new Point(3, 48);
                    CGTB.ReadOnly = false;
                    CGTB.Location = new Point(65, 48);
                    CBTB.ReadOnly = false;
                    CBTB.Location = new Point(127, 48);
                    CHTB.ReadOnly = true;
                    CHTB.Location = new Point(217, 48);
                    CTB.Location  = new Point(35, 107);
                    CYB.Location  = new Point(238, 107);
                }
            }
            catch
            {
                //
            }
        }
コード例 #10
0
        private void TFRCurveEditButton_Click(object sender, EventArgs e)
        {
            var curveIndex = (int)MaterialComboBox.GetSelectedItem <ArcticFoxConfiguration.Material>() - 5;
            var tfrTable   = m_configuration.Advanced.TFRTables[curveIndex];

            using (var editor = new TFRProfileWindow(tfrTable))
            {
                if (editor.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                m_host.UpdateTFRCurveNames();
                m_host.UpdateTFRCurvePreview(curveIndex);
            }
        }
コード例 #11
0
        private MaterialComboBox CloneComboBox(MaterialComboBox original)
        {
            MaterialComboBox copy = new MaterialComboBox();

            copy.AutoResize        = original.AutoResize;
            copy.DrawMode          = original.DrawMode;
            copy.DropDownHeight    = original.DropDownHeight;
            copy.DropDownStyle     = original.DropDownStyle;
            copy.DropDownWidth     = original.DropDownWidth;
            copy.Font              = original.Font;
            copy.ForeColor         = original.ForeColor;
            copy.FormattingEnabled = original.FormattingEnabled;
            copy.Hint              = original.Hint;
            copy.IntegralHeight    = original.IntegralHeight;
            copy.ItemHeight        = original.ItemHeight;
            copy.Items.AddRange(original.Items.Cast <Object>().ToArray());
            copy.MaxDropDownItems = original.MaxDropDownItems;
            copy.Size             = original.Size;
            return(copy);
        }
コード例 #12
0
ファイル: UNICODE.cs プロジェクト: moayyaed/Conforyon
        private void TCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                MaterialComboBox TCB = sender as MaterialComboBox;
                if (TCB.Name == "TACB")
                {
                    TBCB.SelectedIndex = TACB.SelectedIndex;
                }
                else
                {
                    TACB.SelectedIndex = TBCB.SelectedIndex;
                }

                Refresh();
            }
            catch
            {
                //
            }
        }
コード例 #13
0
        private void btnAddRow_Click(object sender, EventArgs e)
        {
            pnlConditions.AutoScrollPosition = new Point(0, 0);

            MaterialComboBox condition = CloneComboBox(cbCondition);
            MaterialComboBox dataType  = CloneComboBox(cbDataType);
            MaterialComboBox op        = CloneComboBox(cbOperator);

            MaterialTextBox property = CloneTextBox(tbProperty);
            MaterialTextBox value    = CloneTextBox(tbValue);

            condition.Name = cbCondition.Name + rowCount;
            dataType.Name  = cbDataType.Name + rowCount;
            op.Name        = cbOperator.Name + rowCount;

            property.Name = tbProperty.Name + rowCount;
            value.Name    = tbValue.Name + rowCount;
            //Names fixed, location is next

            condition.Location = new Point(cbCondition.Location.X, (cbCondition.Location.Y + cbCondition.Height) * rowCount);
            dataType.Location  = new Point(cbDataType.Location.X, (cbDataType.Location.Y + cbDataType.Height) * rowCount);
            op.Location        = new Point(cbOperator.Location.X, (cbOperator.Location.Y + cbOperator.Height) * rowCount);

            property.Location = new Point(tbProperty.Location.X, (tbProperty.Location.Y + cbCondition.Height) * rowCount);
            value.Location    = new Point(tbValue.Location.X, (tbValue.Location.Y + cbCondition.Height) * rowCount);

            //location fixed, add em to the panel
            int currRowCount = 0 + rowCount;

            dataType.SelectedIndexChanged += (s, ee) => cbDataTypeDynamic_SelectedIndexChanged(currRowCount);
            op.SelectedIndexChanged       += (s, ee) => cbOperatorDynamic_SelectedIndexChanged(currRowCount);

            pnlConditions.Controls.Add(condition);
            pnlConditions.Controls.Add(dataType);
            pnlConditions.Controls.Add(op);
            pnlConditions.Controls.Add(property);
            pnlConditions.Controls.Add(value);

            rowCount++;
        }
コード例 #14
0
        public void UpdateTFRNames(ArcticFoxConfiguration.TFRTable[] tables)
        {
            var selectedValue = MaterialComboBox.GetSelectedItem <ArcticFoxConfiguration.Material>();

            MaterialComboBox.BeginUpdate();
            for (var i = 0; i < tables.Length; i++)
            {
                // 4 : Default Non-TFR materials, Ni, Ti, SS, TCR
                var index = 4 + i;
                var item  = MaterialComboBox.Items[index] as NamedItemContainer <ArcticFoxConfiguration.Material>;
                if (item == null)
                {
                    continue;
                }

                var material = item.Data;
                MaterialComboBox.Items.RemoveAt(index);
                MaterialComboBox.Items.Insert(index, new NamedItemContainer <ArcticFoxConfiguration.Material>("[TFR] " + tables[i].Name, material));
            }
            MaterialComboBox.EndUpdate();
            MaterialComboBox.SelectItem(selectedValue);
        }
コード例 #15
0
        private void cbDataTypeDynamic_SelectedIndexChanged(int rCount)
        {
            Control[] op = pnlConditions.Controls.Find("cbOperator" + rCount, true);
            Control[] dt = pnlConditions.Controls.Find("cbDataType" + rCount, true);

            if (op.Length <= 0)
            {
                throw new ArgumentException("No control with name cbOperator" + rCount + " was found!");
            }

            if (dt.Length <= 0)
            {
                throw new ArgumentException("No control with name cbDataType" + rCount + " was found!");
            }

            MaterialComboBox cbOperatorDynamic = (MaterialComboBox)op[0];
            MaterialComboBox cbDataTypeDynamic = (MaterialComboBox)dt[0];

            cbOperatorDynamic.Items.Clear();
            if (cbDataTypeDynamic.SelectedItem != null)
            {
                switch (cbDataTypeDynamic.SelectedItem.ToString())
                {
                case "string":
                    cbOperatorDynamic.Items.AddRange(new[] { "==", "!=", "startsWith", "endsWith", "contains", "length ==", "length !=", "length >", "length <", "length >=", "length <=" });
                    break;

                case "double":
                    cbOperatorDynamic.Items.AddRange(new[] { "==", "!=", ">", "<", ">=", "<=" });
                    break;

                case "bool":
                    cbOperatorDynamic.Items.AddRange(new[] { "true", "false" });
                    break;
                }
            }
        }
コード例 #16
0
        public static void BindDepartments(ref MaterialComboBox drpdownDept, bool includeAll = false)
        {
            var _deptRepo = new DepartmentRepo();
            var alldepts  = _deptRepo.GetAllDepartments();


            if (includeAll)
            {
                alldepts.Insert(0, new Department {
                    Id = 0, DepartmentName = "All Departments"
                });
            }
            else
            {
                alldepts.Insert(0, new Department {
                    Id = -1, DepartmentName = "Select Department"
                });
            }

            drpdownDept.DataSource    = alldepts;
            drpdownDept.DisplayMember = "DepartmentName";
            drpdownDept.ValueMember   = "Id";
            drpdownDept.SelectedIndex = 0;
        }
コード例 #17
0
        private void InitializeControls()
        {
            ProfileNameTextBox.TextChanged += (s, e) =>
            {
                var position = ProfileNameTextBox.SelectionStart;
                var input    = ProfileNameTextBox.Text;
                var matches  = s_blackList.Matches(input);
                foreach (Match match in matches)
                {
                    if (!match.Success)
                    {
                        continue;
                    }
                    input = input.Replace(match.Value, string.Empty);
                }
                ProfileNameTextBox.Text           = input;
                ProfileNameTextBox.SelectionStart = position;
            };

            PowerUpDown.Minimum = MinimumWatts;
            PowerUpDown.Maximum = 60;

            PreheatTypeComboBox.Fill(PredefinedData.ArcticFox.Profile.PreheatTypes);
            PreheatTypeComboBox.SelectedValueChanged += PreheatTypeComboBox_SelectedValueChanged;

            PowerCurveComboBox.Fill(PredefinedData.ArcticFox.Profile.PowerCurves);
            TemperatureTypeComboBox.Fill(PredefinedData.ArcticFox.Profile.TemperatureTypes);
            TemperatureTypeComboBox.SelectedValueChanged += (s, e) =>
            {
                var isCelcius = TemperatureTypeComboBox.GetSelectedItem <bool>();
                if (isCelcius)
                {
                    TemperatureUpDown.Minimum = 100;
                    TemperatureUpDown.Maximum = 315;
                }
                else
                {
                    TemperatureUpDown.Minimum = 200;
                    TemperatureUpDown.Maximum = 600;
                }
            };

            ModeComboBox.Items.Clear();
            ModeComboBox.Items.AddRange(new object[]
            {
                new NamedItemContainer <Mode>(LocalizableStrings.VapeModePower, Mode.Power),
                new NamedItemContainer <Mode>(LocalizableStrings.VapeModeTempControl, Mode.TemperatureControl)
            });
            ModeComboBox.SelectedValueChanged += (s, e) =>
            {
                var isTemperatureSensing = ModeComboBox.GetSelectedItem <Mode>() == Mode.TemperatureControl;

                SetupTempControlButton.Visible = isTemperatureSensing;

                MaterialComboBox.Visible = isTemperatureSensing;
                MaterialLabel.Visible    = isTemperatureSensing;

                ResistanceLabel.Visible          = isTemperatureSensing;
                ResistanceUpDown.Visible         = isTemperatureSensing;
                ResistanceLockedCheckBox.Visible = isTemperatureSensing;
                OhmLabel.Visible = isTemperatureSensing;

                TemperatureLabel.Visible            = isTemperatureSensing;
                TemperatureUpDown.Visible           = isTemperatureSensing;
                TemperatureTypeComboBox.Visible     = isTemperatureSensing;
                TemperatureDominantCheckBox.Visible = isTemperatureSensing;

                var selectedMaterial = MaterialComboBox.GetSelectedItem <ArcticFoxConfiguration.Material>();
                TCRUpDown.Visible          = isTemperatureSensing && selectedMaterial == ArcticFoxConfiguration.Material.TCR;
                TFRCurveEditButton.Visible = isTemperatureSensing &&
                                             (int)selectedMaterial >= (int)ArcticFoxConfiguration.Material.TFR1 &&
                                             (int)selectedMaterial <= (int)ArcticFoxConfiguration.Material.TFR8;
            };

            MaterialComboBox.Fill(PredefinedData.ArcticFox.Profile.Materials);
            MaterialComboBox.SelectedValueChanged += (s, e) =>
            {
                if (MaterialComboBox.SelectedItem == null)
                {
                    return;
                }

                var selectedMaterial = MaterialComboBox.GetSelectedItem <ArcticFoxConfiguration.Material>();
                TCRUpDown.Visible          = selectedMaterial == ArcticFoxConfiguration.Material.TCR;
                TFRCurveEditButton.Visible = (int)selectedMaterial >= (int)ArcticFoxConfiguration.Material.TFR1 &&
                                             (int)selectedMaterial <= (int)ArcticFoxConfiguration.Material.TFR8;
            };

            PowerCurveEditButton.Click   += PowerCurveEditButton_Click;
            TFRCurveEditButton.Click     += TFRCurveEditButton_Click;
            SetupTempControlButton.Click += SetupTempControlButton_Click;
        }