/// <summary>
        /// Gets the proxy client.
        /// </summary>
        /// <returns> A LicenseServicesClient</returns>
        public static LicenseServiceClient GetClientProxy()
        {
            if ( client == null )
            {
                string url = string.Empty;
                if ( System.Configuration.ConfigurationSettings.AppSettings["LicenseServicesUrl"] != null )
                {
                    url = System.Configuration.ConfigurationSettings.AppSettings["LicenseServicesUrl"];
                }

                if ( url.Length > 0 )
                {
                    EndpointReference requestEndpoint = new EndpointReference(new Uri(url));

                    // Client
                    client = new LicenseServiceClient(requestEndpoint);

                    SoapHttpOutputChannel channel = (SoapHttpOutputChannel)client.Channel;
                    channel.Options.Credentials = System.Net.CredentialCache.DefaultCredentials;
                    channel.Options.Proxy = System.Net.GlobalProxySelection.Select;

                    Security security = new Security();
                    client.Security = security;
                    client.GetSessionID();
                }
                else
                {
                    throw new ArgumentNullException("System.Configuration.ConfigurationSettings.AppSettings[\"LicenseServicesUrl\"]","No service url found in the configuration file.");
                }
            }

            return client;
        }
        private void Form1_Load(object sender, System.EventArgs e)
        {
            try
            {
                client = LicenseServicesClientProxy.GetClientProxy();
                client.GetSessionID();

                // exception handling registration
                // ExceptionHandlerEvent += new ExceptionHandler(OrderForm_ExceptionEventHandler);
                // LicenseServicesClientProxy.RegisterControlForExceptionHandling(this);
                client.ExceptionEventHandler += new ExceptionHandler(client_ExceptionEventHandler);
            }
            catch ( Exception ex )
            {
                MessageBox.Show(ex.ToString());
                this.Close();
            }
        }