/// <summary>
        /// Gets the bussiness logic object.
        /// </summary>
        /// <param name="endpointData">The endpoint data.</param>
        /// <returns></returns>
        public static ISPDBL GetBussinessLogicObject(EndpointData endpointData)
        {
            ServiceType serviceType = (ServiceType)SPD.GUI.Properties.Settings.Default.service;

            switch (serviceType) {
                case ServiceType.local:
                    return new SPDBL();
                //case ServiceType.WCF:
                //    return new SPDWCFBL(endpointData);
                default:
                    return null;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SPDWCFBL"/> class.
        /// </summary>
        /// <param name="endPointData">The end point data.</param>
        public SPDWCFBL(EndpointData endPointData)
        {
            string protocol;
            string uri;

            string host = endPointData.Host;
            string port = endPointData.port.ToString();

            switch (endPointData.Protocol) {
                case WCFProtocol.http:
                    protocol = "http";
                    binding = new WSHttpBinding();
                    uri = protocol + "://" + host + ":" + port + "/SPDService";
                    break;
                case WCFProtocol.tcp:
                    protocol = "net.tcp";
                    binding = new NetTcpBinding();
                    uri = protocol + "://" + host + ":" + port + "/SPDService";
                    break;
                case WCFProtocol.namedPipe:
                    protocol = "net.pipe";
                    binding = new NetNamedPipeBinding();
                    uri = protocol + "://" + host + "/SPDService";
                    break;
                default:
                    protocol = "";
                    uri = "";
                    break;
            }

            endpointAddress = new EndpointAddress(uri);

            try {
                this.SupportsBackup();
            } catch (Exception) {
                MessageBox.Show("The connection to the server could not be established\r\nPlease be sure that the Server runs, restart SPD\r\nand be sure to have the right parameters");
                Environment.Exit(1);
            }
        }