Exemple #1
0
        private void OKButton_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(ipAddressText.Text))
            {
                if (ipAddressText.Text.Contains("http") || ipAddressText.Text.Contains("//"))
                {
                    MessageBox.Show("The IP Address or machine name must not include \"http\" or \"//\"");
                }
                else
                {
                    if (Location == null)
                    {
                        Location = new AILocation(Guid.NewGuid(), ipAddressText.Text, (int)portNumeric.Value);
                    }
                    else
                    {
                        Location.IPAddress = ipAddressText.Text;
                        Location.Port      = (int)portNumeric.Value;
                    }

                    Storage.SetAILocation(Location);
                    AILocation.Refresh();
                    DialogResult = DialogResult.OK;
                }
            }
        }
Exemple #2
0
 private void RemoveButton_Click(object sender, EventArgs e)
 {
     if (aiLocationListView.SelectedItems.Count > 0)
     {
         int        index    = aiLocationListView.SelectedIndices[0];
         AILocation location = (AILocation)aiLocationListView.Items[index].Tag;
         Storage.RemoveAILocation(location.ID.ToString());
         AILocation.Refresh();
         aiLocationListView.Items.RemoveAt(index);
     }
 }