PeerCastStation.GUI.YellowPagesEditDialog.okButton_Click C# (CSharp) Метод

okButton_Click() приватный Метод

private okButton_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void
    private void okButton_Click(object sender, EventArgs e)
    {
      YPName   = ypNameText.Text;
      var protocol_item = ypProtocolList.SelectedItem as YellowPageFactoryItem;
      Protocol = protocol_item!=null ? protocol_item.Factory.Protocol : null;
      if (!String.IsNullOrEmpty(YPName) && !String.IsNullOrEmpty(Protocol)) {
        Uri uri;
        var md = System.Text.RegularExpressions.Regex.Match(ypAddressText.Text, @"\A([^:/]+)(:(\d+))?\Z");
        if (md.Success &&
            Uri.CheckHostName(md.Groups[1].Value)!=UriHostNameType.Unknown &&
            Uri.TryCreate(Protocol + "://" + ypAddressText.Text, UriKind.Absolute, out uri) &&
            protocol_item.Factory.CheckURI(uri)) {
          Uri = uri;
          DialogResult = DialogResult.OK;
        }
        else if (Uri.TryCreate(ypAddressText.Text, UriKind.Absolute, out uri) &&
                 protocol_item.Factory.CheckURI(uri)) {
          Uri = uri;
          DialogResult = DialogResult.OK;
        }
      }
    }
  }