Exemplo n.º 1
0
        // Main function
        public static void Main(string[] args)
        {
            Assembly.Load(new AssemblyName("MARC.Everest.RMIM.CA.R020402"));

            // Instantiate the connector
            WcfServerConnector connector = new WcfServerConnector();

            // Assign the formatter
            connector.Formatter = new MARC.Everest.Formatters.XML.ITS1.Formatter();
            connector.Formatter.GraphAides.Add(
                new DatatypeFormatter()
                );

            // Subscribe to the message available event
            connector.MessageAvailable += new EventHandler <UnsolicitedDataEventArgs>(
                connector_MessageAvailable
                );

            // Open and start the connector
            try
            {
                WcfConnectionStringBuilder builder = new WcfConnectionStringBuilder();
                builder.ServiceName        = "ApplicationService";
                connector.ConnectionString = builder.GenerateConnectionString();
                connector.Open();
                connector.Start();

                Console.WriteLine("Server started, press any key to close...");
                Console.ReadKey();

                // Teardown
                connector.Stop();
                connector.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }