Example #1
0
        public Communication()
        {
            this.ServiceConfig = new Config();
            this.LogList       = new ObservableCollection <Log>();

            this.gotConfig = false;
            this.gotLog    = false;

            this.Client = TcpClientChannel.getInstance();

            if (this.Client.IsConnected)
            {
                this.IsConnected         = true;
                this.Client.UpdateModel += ViewUpdate;

                this.Client.SendCommand(new CommandMessage(3, null));
                while (!this.gotLog)
                {
                    Thread.Sleep(1000);
                }

                this.Client.SendCommand(new CommandMessage(2, null));
                while (!this.gotConfig)
                {
                    Thread.Sleep(1000);
                }
            }
        }
Example #2
0
        public bool RemoveHandler(String handler)
        {
            TcpClientChannel RemoveClient = TcpClientChannel.getInstance();

            RemoveClient.SendCommand(new CommandMessage(4, handler));
            while (!this.handlerDeleted)
            {
                Thread.Sleep(1000);
            }

            ServiceConfig.Handlers.Remove(handler);
            RemoveClient.Stop();

            return(true);
        }
Example #3
0
        public SettingsModel()
        {
            //connecting for the first time to the server and send "get config" command.
            handlers = new ObservableCollection <string>();
            Object locker = new Object();

            BindingOperations.EnableCollectionSynchronization(handlers, locker);
            this.client = TcpClientChannel.getInstance();

            //If the client is connected to the server, continue with asking the config.
            if (this.client.IsConnected)
            {
                client.UpdateModel += ViewUpdate;
                client.SendCommand(new ImageService.Communication.Model.CommandMessage(2, null));
            }
        }
Example #4
0
        public LogModel()
        {
            isRunning = false;

            //connecting for the first time to the server and send "log command" command.
            this.client = TcpClientChannel.getInstance();
            this.LogMes = new ObservableCollection <MsgRecievedEventArgs>();
            Object locker = new Object();

            BindingOperations.EnableCollectionSynchronization(LogMes, locker);

            //If the client is connected to the server, continue with asking the log.
            if (this.client.IsConnected)
            {
                isRunning           = true;
                client.UpdateModel += ViewLogUpdate;
                client.SendCommand(new CommandMessage(3, null));
            }
        }
Example #5
0
 public MainWindowModel()
 {
     this.client = TcpClientChannel.getInstance();
 }