namespace OpenTween
{
- public partial class AtIdSupplement : Form
+ public partial class AtIdSupplement : OTBaseForm
{
+ public string StartsWith { get; set; } = "";
+
public string inputText = "";
public bool isBack = false;
private string startChar = "";
- // private bool tabkeyFix = false;
-
- private string _StartsWith = "";
public void AddItem(string id)
{
}
public int ItemCount
- {
- get
- {
- return this.TextId.AutoCompleteCustomSource.Count;
- }
- }
+ => this.TextId.AutoCompleteCustomSource.Count;
private void ButtonOK_Click(object sender, EventArgs e) /*Handles ButtonOK.Click*/
{
private void TextId_KeyDown(object sender, KeyEventArgs e) /*Handles TextId.KeyDown*/
{
- if (e.KeyCode == Keys.Back && this.TextId.Text == "")
+ if (e.KeyCode == Keys.Back && string.IsNullOrEmpty(this.TextId.Text))
{
inputText = "";
isBack = true;
this.Close();
}
- if (e.KeyCode == Keys.Space || e.KeyCode == Keys.Tab)
+ else if (e.KeyCode == Keys.Space || e.KeyCode == Keys.Tab)
{
inputText = this.TextId.Text + " ";
isBack = false;
this.Close();
}
- if (e.Control && e.KeyCode == Keys.Delete)
+ else if (e.Control && e.KeyCode == Keys.Delete)
{
- if (this.TextId.Text != "")
+ if (!string.IsNullOrEmpty(this.TextId.Text))
{
var idx = this.TextId.AutoCompleteCustomSource.IndexOf(this.TextId.Text);
if (idx > -1)
private void AtIdSupplement_Shown(object sender, EventArgs e) /*Handles this.Shown*/
{
TextId.Text = startChar;
- if (!string.IsNullOrEmpty(_StartsWith))
+ if (!string.IsNullOrEmpty(this.StartsWith))
{
- TextId.Text += _StartsWith.Substring(0, _StartsWith.Length);
+ TextId.Text += this.StartsWith.Substring(0, this.StartsWith.Length);
}
TextId.SelectionStart = TextId.Text.Length;
TextId.Focus();
}
public AtIdSupplement()
- {
- InitializeComponent();
- }
+ => this.InitializeComponent();
public AtIdSupplement(List<string> ItemList, string startCharacter)
{
}
}
- public string StartsWith
- {
- get
- {
- return _StartsWith;
- }
- set
- {
- _StartsWith = value;
- }
- }
-
private void AtIdSupplement_FormClosed(object sender, FormClosedEventArgs e) /*Handles MyBase.FormClosed*/
{
- _StartsWith = "";
+ this.StartsWith = "";
if (isBack)
{
this.DialogResult = DialogResult.Cancel;