Esempio n. 1
0
        static void SetTabComboBoxState(TabComboBox combobox, string strText)
        {
            string strState = "";

            if (IsType(strText, combobox, out strState) == false)
            {
                return;
            }

            if (string.IsNullOrEmpty(strState) == false)
            {
                Hashtable table = StringUtil.ParseParameters(strState);

                string strStyle = (string)table["style"];
                string strValue = (string)table["text"];

                if (string.IsNullOrEmpty(strValue) == false)
                {
                    ComboBoxStyle style;
                    Enum.TryParse <ComboBoxStyle>(strStyle, out style);

                    combobox.Text = strValue;

                    if (combobox.Text != strValue)
                    {
                        combobox.Items.Add(strValue);
                        combobox.Text = strValue;
                    }
                }
            }
        }
Esempio n. 2
0
        static string GetTabComboBoxState(TabComboBox combobox)
        {
            Hashtable table = new Hashtable();

            table["style"] = combobox.DropDownStyle.ToString();
            table["text"]  = combobox.Text;

            return(combobox.GetType().ToString() + ":"
                   + StringUtil.BuildParameterString(table));
        }
Esempio n. 3
0
        async public void LoadDataForBankList(bool UpdateTable = false)
        {
            HttpClient client = new HttpClient();
            string     path   = "https://localhost:44320//api";

            path += "//Bank//" + Convert.ToInt32(User.Instance.Rank);
            string retsz = "";

            try
            {
                retsz = await client.GetStringAsync(path);
            }
            catch
            {
                MessageBox.Show("There was an issue, Try again later.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            var bank = JsonConvert.DeserializeObject <Bank>(retsz);

            m_Bank = bank;

            int count = m_Bank.BankTabs.Count;

            TabComboBox.Invoke(new MethodInvoker(delegate {
                TabComboBox.Items.Clear();
            }));
            for (int index = 0; index < count; index++)
            {
                string name = m_Bank.BankTabs[index].Name;
                if (name == "Tab")
                {
                    name += " " + index.ToString();
                }

                TabComboBox.Invoke(new MethodInvoker(delegate {
                    TabComboBox.Items.Add(name);
                }));
            }
            TabComboBox.Invoke(new MethodInvoker(delegate {
                TabComboBox.SelectedIndex = 0;
            }));

            LoadDataForItem(m_Bank.BankTabs[0].ItemsDictionary.First().Value.ItemID);

            BankListBox.Invoke(new MethodInvoker(delegate {
                BankListBox.SelectedIndex = 0;
            }));

            if (UpdateTable)
            {
                LoadDataForBankTable();
            }
        }
Esempio n. 4
0
        // 根据左侧文字匹配 Items 中整行文字,如果有匹配的行,返回整行文字
        static string GetLineText(TabComboBox combobox,
                                  string strLeft)
        {
            foreach (string s in combobox.Items)
            {
                if (StringUtil.HasHead(s, strLeft + "\t") == true)
                {
                    return(s);
                }
            }

            return(null);
        }
            public Item(AmazonSearchParametersControl container,
                        ItemType itemType)
            {
                this.Container = container;

                this.ItemType = itemType;

                int nTopBlank = 0;  //  (int)this.Container.Font.GetHeight() + 2;

                label           = new Label();
                label.Dock      = DockStyle.Fill;
                label.Size      = new Size(70, 28);
                label.AutoSize  = true;
                label.TextAlign = ContentAlignment.MiddleRight;
                label.Margin    = new Padding(1, 0, 1, 0);

                if (this.ItemType == AmazonSearchParametersControl.ItemType.TextBox)
                {
                    this.textBox        = new TextBox();
                    textBox.BorderStyle = BorderStyle.None;
                    textBox.Dock        = DockStyle.Fill;
                    textBox.MinimumSize = new Size(80, 24);
                    // textBox_price.Multiline = true;
                    textBox.Margin    = new Padding(6, nTopBlank + 6, 6, 0);
                    textBox.ForeColor = this.Container.tableLayoutPanel_content.ForeColor;
                }

                if (this.ItemType == AmazonSearchParametersControl.ItemType.ComboBox)
                {
                    comboBox = new TabComboBox();
                    comboBox.RemoveRightPartAtTextBox = false;
                    comboBox.DropDownStyle            = ComboBoxStyle.DropDown;
                    comboBox.FlatStyle = FlatStyle.Flat;
                    comboBox.Dock      = DockStyle.Fill;
                    // comboBox.MaximumSize = new Size(150, 28);
                    comboBox.Size           = new Size(100, 28);
                    comboBox.MinimumSize    = new Size(50, 28);
                    comboBox.DropDownHeight = 300;
                    comboBox.DropDownWidth  = 300;
                    comboBox.ForeColor      = this.Container.tableLayoutPanel_content.ForeColor;
                    comboBox.Text           = "";
                    comboBox.Margin         = new Padding(6 - 4, nTopBlank + 6 - 2, 6, 2);
                }
            }
 void DisposeChildControls()
 {
     if (label != null)
     {
         label.Dispose();
         label = null;
     }
     if (textBox != null)
     {
         textBox.Dispose();
         textBox = null;
     }
     if (comboBox != null)
     {
         comboBox.Dispose();
         comboBox = null;
     }
     Container = null;
 }