Ejemplo n.º 1
0
        private void BtnSearch_Click(object sender, EventArgs e)
        {
            if (this.InvokeRequired)
            {
                DelegateBtnSearch inv = new DelegateBtnSearch(this.BtnSearch_Click);
                this.Invoke(inv, new object[] { sender, e });
            }
            else
            {
                Cursor.Current = Cursors.WaitCursor;
                if (this.LbxNodeKey.Items.Count > 0)
                {
                    this.LbxNodeKey.Items.Clear();
                }

                if (string.IsNullOrEmpty(this.TxtSearchKey.Text))
                {
                    MessageBox.Show("Please enter search pattern.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.TxtSearchKey.Focus();
                    this.UnselectServerList();
                    Cursor.Current = Cursors.Default;
                    return;
                }

                List <string> keys = CACHE.SharedCache.GetAllKeys();

                if (keys != null && keys.Count > 0)
                {
                    if (this.LbxNodeKey.Items.Count > 0)
                    {
                        this.LbxNodeKey.Items.Clear();
                    }

                    foreach (string item in keys)
                    {
                        if (item.Equals(this.TxtSearchKey.Text, StringComparison.InvariantCultureIgnoreCase))
                        {
                            this.LbxNodeKey.Items.Add(
                                new Common.ComboBoxItem(item, -1)
                                );
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Your search term does not return any result, please revalidate your term: '" + this.TxtSearchKey.Text + "'",
                                    "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Cursor.Current = Cursors.Default;
                    this.UnselectServerList();
                    return;
                }
                Cursor.Current = Cursors.Default;
                this.UnselectServerList();
                this.BindStats();
                this.UpdateLblAmount();
            }
        }
Ejemplo n.º 2
0
		private void BtnSearch_Click(object sender, EventArgs e)
		{
			if (this.InvokeRequired)
			{
				DelegateBtnSearch inv = new DelegateBtnSearch(this.BtnSearch_Click);
				this.Invoke(inv, new object[] { sender, e });
			}
			else
			{
				Cursor.Current = Cursors.WaitCursor;
				if (this.LbxNodeKey.Items.Count > 0) this.LbxNodeKey.Items.Clear();

				if (string.IsNullOrEmpty(this.TxtSearchKey.Text))
				{
					MessageBox.Show("Please enter search pattern.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
					this.TxtSearchKey.Focus();
					this.UnselectServerList();
					Cursor.Current = Cursors.Default;
					return;
				}

				List<string> keys = CACHE.SharedCache.GetAllKeys();

				if (keys != null && keys.Count > 0)
				{
					if (this.LbxNodeKey.Items.Count > 0) this.LbxNodeKey.Items.Clear();

					foreach (string item in keys)
					{
						if(item.Equals(this.TxtSearchKey.Text, StringComparison.InvariantCultureIgnoreCase))
						this.LbxNodeKey.Items.Add(
								new Common.ComboBoxItem(item, -1)
							);
					}					
				}
				else
				{
					MessageBox.Show("Your search term does not return any result, please revalidate your term: '" + this.TxtSearchKey.Text + "'",
						"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
					Cursor.Current = Cursors.Default;
					this.UnselectServerList();
					return;
				}
				Cursor.Current = Cursors.Default;
				this.UnselectServerList();
				this.BindStats();
				this.UpdateLblAmount();
			}
		}