Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.CancelKeyPress += new ConsoleCancelEventHandler(Console_CancelKeyPress);

            // NOTE: The constructor of SQLWebProxy uses default settings. You might want to
            // override these and should edit the .config file to provide valid settings here
            server = new SQLWebProxy(Properties.Settings.Default.SQLServerAddress, Properties.Settings.Default.SQLUserName,
                Properties.Settings.Default.SQLPassword, Properties.Settings.Default.SQLDatabase, Properties.Settings.Default.SQLServerPort,
                Properties.Settings.Default.ListenAddress, Properties.Settings.Default.ListenPort);
            server.OnLogOutput += (line) =>
                {
                    Console.WriteLine(line);
                };

            server.Start();

            Console.WriteLine("Server has been started ...");

            isRunning = true;
            while (isRunning)
            {
                Thread.Sleep(0);
            }

            Console.WriteLine("Server has been shut down");
        }
        public MainWindow()
        {
            InitializeComponent();

            TestSerialize();

            this.Closing += (s, e) =>
                {
                    server.Stop();
                };

            // NOTE: The constructor of SQLWebProxy uses default settings. You might want to
            // override these and should edit the .config file to provide valid settings here
            server = new SQLWebProxy(Properties.Settings.Default.ServerAddress, Properties.Settings.Default.ServerUsername,
                Properties.Settings.Default.ServerPassword, Properties.Settings.Default.ServerDatabase, Properties.Settings.Default.ServerPort);
            server.OnLogOutput += (line) =>
                {
                    Dispatcher.Invoke(new Action(() =>
                        {
                            textBox1.Text += line + "\r\n";
                        }));
                };

            Properties.Settings.Default.RemoteAddress = "localhost";
            Properties.Settings.Default.RemotePort = 8080;

            // NOTE: You should edit the .config file to provide valid settings here
            client = new SQLWebProxyClient();
            client.RemoteAddress = Properties.Settings.Default.RemoteAddress;
            client.RemotePort = Properties.Settings.Default.RemotePort;
        }