Exemple #1
0
        public void updateUI(object a, ServerArgs e)
        {
            Console.WriteLine(e.Target);

            if (e.Target.Equals("status"))
            {
                if (this.statusText.InvokeRequired)
                {
                    SetTextCallback setText = n => { statusText.Text = n; };
                    this.Invoke(setText, new object[] { e.Message });
                }
                else
                {
                    statusText.Text = e.Message;
                }
            }
            else if(e.Target.Equals("rtb"))
            {
                if (this.infoBox.InvokeRequired)
                {
                    SetTextCallback setText = n => { infoBox.AppendText(n + "\n"); };
                    this.Invoke(setText, new object[] { e.Message });
                }
                else
                {
                    infoBox.AppendText(e.Message + "\n");
                }
            }
        }
        private void StartServer()
        {
            var args = new ServerArgs();

            if (!Int32.TryParse(textBoxRecvTimeoutSec.Text, out args.timeoutSec))
            {
                MessageBox.Show("Parse error of Recv timeout");
                return;
            }
            if (args.timeoutSec < 1)
            {
                MessageBox.Show("Recv timeout must be integer value greater than 0");
                return;
            }
            if (1000 * 100 < args.timeoutSec)
            {
                MessageBox.Show("Recv timeout (sec) must be smaller than 100000");
                return;
            }

            args.recvFolder = textBoxRecvFolder.Text;

            mBackgroundWorker         = new BackgroundWorker();
            mBackgroundWorker.DoWork += Server_DoWork;
            mBackgroundWorker.WorkerReportsProgress = true;
            mBackgroundWorker.ProgressChanged      += Server_ProgressChanged;
            mBackgroundWorker.RunWorkerCompleted   += Server_RunWorkerCompleted;

            buttonStart.IsEnabled = false;

            mBackgroundWorker.RunWorkerAsync(args);
        }
Exemple #3
0
        static void Main(string[] args)
        {
            ServerArgs sargs = new ServerArgs(args);

#if DEBUG
            LogThread.AlwaysPrintToConsole = true;
#endif
            _server = new HappinessServer(sargs.ListenPort, sargs.DBString, sargs.HostAddress, sargs.HostPort);

            _server.Run();

            LogThread.GetLog().Shutdown();
        }
Exemple #4
0
        static void Main(string[] args)
        {
            _sargs = new ServerArgs(args);

            _server = new ServerBase(_sargs.ListenPort, _sargs.DBString);
            _server.TaskProcessor = new GlobalTaskProcessor();
            _server.DatabaseSetup();
//#if DEBUG
            LogThread.AlwaysPrintToConsole = true;
//#endif
            _webServer = new WebServer(null, "http://127.0.0.1:8080/purchase/", "http://127.0.0.1:8080/checkout/");
            _webServer.Run();

            Marketplace m = new Marketplace(_server);

            _server.TaskProcessor.AddTask(new GlobalTask(GlobalTask.GlobalType.Products_Fetch));

            _server.ListenThread.OnConnectionAccepted += new EventHandler <SocketArg>(lt_OnConnectionAccepted);

            _server.Run();
        }
Exemple #5
0
 /// <summary>
 /// Creates a new instance of <see="SqlServerBuilder" />
 /// </summary>
 /// <param name="arguments">Default arguments to use</param>
 public SqlServerBuilder(string name, ServerArgs arguments, ResourceContext context) : base(name, context)
 {
     Arguments = arguments;
 }
Exemple #6
0
 /// <summary>
 /// Creates a new instance of <see="SqlServerBuilder" />
 /// </summary>
 /// <param name="arguments">Default arguments to use</param>
 public SqlServerBuilder(string name, ServerArgs arguments) : base(name)
 {
     Arguments = arguments;
 }
        private void StartServer()
        {
            var args = new ServerArgs();
            if (!Int32.TryParse(textBoxRecvTimeoutSec.Text, out args.timeoutSec)) {
                MessageBox.Show("Parse error of Recv timeout");
                return;
            }
            if (args.timeoutSec < 1) {
                MessageBox.Show("Recv timeout must be integer value greater than 0");
                return;
            }
            if (1000 * 100 < args.timeoutSec) {
                MessageBox.Show("Recv timeout (sec) must be smaller than 100000");
                return;
            }

            args.recvFolder = textBoxRecvFolder.Text;

            mBackgroundWorker = new BackgroundWorker();
            mBackgroundWorker.DoWork += Server_DoWork;
            mBackgroundWorker.WorkerReportsProgress = true;
            mBackgroundWorker.ProgressChanged += Server_ProgressChanged;
            mBackgroundWorker.RunWorkerCompleted += Server_RunWorkerCompleted;

            buttonStart.IsEnabled = false;

            mBackgroundWorker.RunWorkerAsync(args);
        }
Exemple #8
0
 private void Client_serverClosed(object sender, ServerArgs args)
 {
     MessageBox.Show(args.Message);
 }