コード例 #1
0
        public MainWindowController()
        {
            ClientTCP client = ClientTCP.getInstance();

            try
            {
                client.connectionStatusUpdated += delegate(object sender, PropertyChangedEventArgs args)
                {
                    App.Current.Dispatcher.Invoke(delegate
                    {
                        if (args.PropertyName == "disconnected")
                        {
                            backgroundColor = Brushes.Gray;
                        }
                        else
                        {
                            backgroundColor = Brushes.Turquoise;
                        }
                    });
                };
                if (client.isConnected)
                {
                    client.isConnected = true;
                }
                else
                {
                    client.isConnected = false;
                }
            } catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
コード例 #2
0
        public LogModel()
        {
            logList = new ObservableCollection <LogEntry>();
            ClientTCP client = ClientTCP.getInstance();

            if (client.isConnected)
            {
                ClientTCP.OnMessageReceived += UpdateLogs;
                client.sendCommand(CommandEnum.LogCommand.ToString());
            }
        }
コード例 #3
0
 public static ClientTCP getInstance()
 {
     if (instance == null)
     {
         lock (locker)
         {
             if (instance == null)
             {
                 instance = new ClientTCP();
             }
         }
     }
     return(instance);
 }
コード例 #4
0
 public SettingsModel()
 {
     client = ClientTCP.getInstance();
     if (client.isConnected)
     {
         ClientTCP.OnMessageReceived += UpdateHandlers;
         ClientTCP.OnMessageReceived += UpdateSettingsMap;
         outputDirectory              = new SettingsEntry(null);
         sourceName    = new SettingsEntry(null);
         logName       = new SettingsEntry(null);
         thumbnailSize = new SettingsEntry(null);
         client.sendCommand(CommandEnum.GetConfigCommand.ToString());
     }
 }