StonehearthEditor.AliasSelectionDialog.acceptButton_Click C# (CSharp) Method

acceptButton_Click() private method

private acceptButton_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private void acceptButton_Click(object sender, EventArgs e)
        {
            if (mCallback != null)
            {
                // Casts the listbox items to strings (throws an exception should anything be uncastable),
                // then selects only unique (distinct) elements and passes that to OnAccept as IEnumerable<string>
                bool isSuccess = mCallback.OnAccept(listBox.SelectedItems.Cast<string>().Distinct());
                if (isSuccess)
                {
                    mCallback = null;
                    Close();
                }
            }
        }