public MapSelectForm()
        {
            InitializeComponent();

            treeView1.Nodes.Clear();
            _selectedNode = treeView1.Nodes.Add("", "Top");

            try
            {
                MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
                _client = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

                //System.Threading.Thread.Sleep(500);
                bool x = _client.IsConnected;
                _msgObject = _client.RegisterCommunicationFilter(MapResponseHandler,
                                                                 new CommunicationIdFilter(MessageId.Server.GetMapResponse));

                MapRequestData data = new MapRequestData()
                {
                    MapGuid = "",
                };
                _client.TransmitMessage(new VideoOS.Platform.Messaging.Message(MessageId.Server.GetMapRequest, data),
                                        null, null, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Map Select issue:" + ex.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// event handler for the connection changed event
        /// The Sites Treeview is updated, if a site is disconnected it is shown in grey
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MessageConnectionStateChangedEvent(object sender, EventArgs e)
        {
            MessageCommunication messageCommunication = (MessageCommunication)sender;
            ServerObject         smo;

            if (_dicServerObjects.TryGetValue(messageCommunication.ServerId.Id, out smo))
            {
                if (IsHandleCreated && !IsDisposed)
                {
                    this.BeginInvoke(new MethodInvoker(delegate()
                    {
                        TreeNode tn = smo.SitesTreeNode;
                        RefreshButtons(treeViewSites.SelectedNode);
                        if (smo.MessCommunication != null)
                        {
                            if (smo.MessCommunication.IsConnected)
                            {
                                tn.ToolTipText             = "connected";
                                tn.ForeColor               = Color.Black;
                                toolStripStatusLabel1.Text = "This is a developer's code sample only. It is neither a test program nor an attempt to make an application.";
                            }
                            else
                            {
                                tn.ToolTipText = "not connected";
                                tn.ForeColor   = Color.Gray;
                            }
                        }
                    }));
                }
            }
        }
        public override void Init()
        {
            try
            {
                MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
                _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

                _messageCommunication.ConnectionStateChangedEvent += new EventHandler(_messageCommunication_ConnectionStateChangedEvent);
                _obj1 = _messageCommunication.RegisterCommunicationFilter(WhoAreOnlineResponseHandler, new VideoOS.Platform.Messaging.CommunicationIdFilter(MessageCommunication.WhoAreOnlineResponse));
                _obj2 = _messageCommunication.RegisterCommunicationFilter(NewEndPointHandler, new VideoOS.Platform.Messaging.CommunicationIdFilter(MessageCommunication.NewEndPointIndication));
                _obj3 = _messageCommunication.RegisterCommunicationFilter(EndPointTableChangedHandler, new VideoOS.Platform.Messaging.CommunicationIdFilter(MessageCommunication.EndPointTableChangedIndication));
                _obj4 = _messageCommunication.RegisterCommunicationFilter(ChatLineHandler, new VideoOS.Platform.Messaging.CommunicationIdFilter(MessageIdChatLine));

                LoginSettings ls = LoginSettingsCache.GetLoginSettings(EnvironmentManager.Instance.MasterSite);
                _myName = ls.UserName;
                if (_myName.Contains("\\"))
                {
                    _myName = _myName.Split('\\')[1];
                }
                if (_messageCommunication.IsConnected)
                {
                    _messageCommunication.TransmitMessage(
                        new VideoOS.Platform.Messaging.Message(MessageCommunication.WhoAreOnlineRequest), null, null,
                        null);
                }
            } catch (Exception ex)
            {
                EnvironmentManager.Instance.ExceptionDialog("Chat.Init", ex);
            }
        }
        /// <summary>
        /// Called by the Environment when the user has logged in.
        /// </summary>
        public override void Init()
        {
            //Instance = this;
            ClientControl.Instance.NewImageViewerControlEvent += new ClientControl.NewImageViewerControlHandler(NewImageViewerControlEvent);
            MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
            _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

            _messageRegistrationObjects.Add(_messageCommunication.RegisterCommunicationFilter(NewEventIndicationMessageHandler,
                                                                                              new CommunicationIdFilter(MessageId.Server.NewEventIndication)));

            _messageRegistrationObjects.Add(_messageCommunication.RegisterCommunicationFilter(NewAlarmMessageHandler,
                                                                                              new CommunicationIdFilter(MessageId.Server.NewAlarmIndication)));

            _messageRegistrationObjects.Add(EnvironmentManager.Instance.RegisterReceiver(SelectedViewChangedReceiver, new MessageIdFilter(MessageId.SmartClient.SelectedViewChangedIndication)));
            _messageRegistrationObjects.Add(EnvironmentManager.Instance.RegisterReceiver(SelectedViewItemChangedReceiver, new MessageIdFilter(MessageId.SmartClient.SelectedViewItemChangedIndication)));

            _SelectViewItemTimer = new System.Timers.Timer()
            {
                AutoReset = true,
                Interval  = 2000,
                Enabled   = true
            };
            _SelectViewItemTimer.Elapsed += SelectViewItemTimer_Elapsed;
            _SelectViewItemTimer.Start();
        }
 public ClientSession(MessageCommunication messageComm)
 {
     this.Communication = messageComm;
     messageComm.IncomingMessageHandler = this;
     this.ClientId = new ClientIdentity();
     State = new AuthenticationState(this);
 }
        /// <summary>
        /// Initialize the Comunication Manager.
        ///
        /// </summary>
        private void SetUpComunicationManager()
        {
            MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
            _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

            // Create a fiter to get messages from Smart Client Plugin
            Object _heatmapSearchFilter = _messageCommunication.RegisterCommunicationFilter(HeatMapPicHandler, new VideoOS.Platform.Messaging.CommunicationIdFilter("heatmapPic"));
        }
Esempio n. 7
0
 private void EnsureMessageCommunicationInitialized()
 {
     if (_mc == null)
     {
         MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
         _mc = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);
         _mc.RegisterCommunicationFilter(IPAddressResponseHandler, new CommunicationIdFilter(MessageId.Server.GetIPAddressResponse));
     }
 }
Esempio n. 8
0
 /// <summary>
 /// Called by the Environment when the user log's out.
 /// You should close all remote sessions and flush cache information, as the
 /// user might logon to another server next time.
 /// </summary>
 public override void Close()
 {
     ClientControl.Instance.NewImageViewerControlEvent -= new ClientControl.NewImageViewerControlHandler(NewImageViewerControlEvent);
     if (_messageCommunication != null)
     {
         _messageCommunication.UnRegisterCommunicationFilter(_obj1);
         _messageCommunication.UnRegisterCommunicationFilter(_obj2);
         _messageCommunication = null;
     }
     timerRemoveOverlays.Stop();
     timerRemoveOverlays.Elapsed -= new ElapsedEventHandler(TimedRefresh);
 }
Esempio n. 9
0
 private void OnLoad(object sender, EventArgs e)
 {
     _cameraSetLayoutAndCamerasFQIDCollection = new Collection <FQID>();
     _cameraRemoveCamerasFQIDCollection       = new Collection <FQID>();
     _cameraSetCamerasFQIDCollection          = new Collection <FQID>();
     _positionInViewSetLayoutAndCameras       = setPositionSetLayoutAndCamerasNumeric.Value;
     _positionInViewShowText   = setPositionShowTextNumeric.Value;
     _positionInViewSetCameras = setPositionSetCamerasNumeric.Value;
     MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
     _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);
     _msgComRec            = _messageCommunication.RegisterCommunicationFilter(VideoWallMessageCommunicationHandler, new CommunicationIdFilter(MessageId.Control.VideoWallIndication));
 }
Esempio n. 10
0
        /// <summary>
        /// Called by the Environment when the user has logged in.
        /// </summary>
        public override void Init()
        {
            //initiates the message communication
            //    MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
            MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
            _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);
            _heatmapSearchFilter  = _messageCommunication.RegisterCommunicationFilter(HeatMapSearchHandler, new VideoOS.Platform.Messaging.CommunicationIdFilter(AnalyticsDefinition.analyticsHeatMapSearchFilterID));



            _stop        = false;
            _thread      = new Thread(new ThreadStart(Run));
            _thread.Name = "Analytics Background Thread";
            _thread.Start();
        }
Esempio n. 11
0
        public void Listener()
        {
            if (server != null)
            {
                while (!stop)
                {
                    client = server.Accept();
                    Console.WriteLine("Client connected from: " + (( IPEndPoint )client.RemoteEndPoint).Address + ":" + (( IPEndPoint )client.RemoteEndPoint).Port);
                    /* Message chat system only for one client implementation */

                    MessageCommunication ms = new MessageCommunication(client);
                    ChatManager          cm = new ChatManager();
                    Message     message     = null;
                    TextMessage textMessage;

                    // Message
                    while (client.Connected)
                    {
                        message = ms.Recive();
                        if (message != null)
                        {
                            if (message is TextMessage)
                            {
                                textMessage = ( TextMessage )message;
                                TimeSpan MessageTime = new TimeSpan(textMessage.Date);

                                // Latency, message created to message recived
                                double latency = ((DateTime.Now.ToUniversalTime().Ticks - textMessage.Date) / 10000);

                                // if type of text message is ToAll
                                if (textMessage.Type == TextMessageType.ToAll)
                                {
                                    Console.WriteLine("MessageTime: " + MessageTime.Hours + ":" + MessageTime.Minutes + ":" + MessageTime.Seconds + " Latency: " + latency + "ms Message: " + textMessage.Text);
                                }
                            }
                        }


                        // Sending message to Server
                        textMessage = cm.CreateTextMessage("Hello client");
                        Console.WriteLine("[Server] Server ---> Client | Sending message");
                        ms.Send(textMessage);
                    } // End of message
                    Console.WriteLine("Client: " + (( IPEndPoint )client.RemoteEndPoint).Address + ":" + (( IPEndPoint )client.RemoteEndPoint).Port + " disconnected");
                    /* ... */
                }
            }
        }
Esempio n. 12
0
        private void OnLoad(object sender, EventArgs e)
        {
            treeViewItems.ImageList        = VideoOS.Platform.UI.Util.ImageListClone;
            treeViewItems.ShowNodeToolTips = true;

            MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
            _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

            // Register to retrieve all NewEventIndication's from the Event Server
            _obj = _messageCommunication.RegisterCommunicationFilter(MessageHandler,
                                                                     new VideoOS.Platform.Messaging.CommunicationIdFilter(VideoOS.Platform.Messaging.MessageId.Server.NewEventIndication));
            _obj = _messageCommunication.RegisterCommunicationFilter(MessageHandler,
                                                                     new VideoOS.Platform.Messaging.CommunicationIdFilter(VideoOS.Platform.Messaging.MessageId.System.SystemConfigurationChangedIndication));

            // Register to receive the response from the ProvideCurrentStateRequest - issued later in this method.
            _obj3 = _messageCommunication.RegisterCommunicationFilter(ProvideCurrentStateResponseHandler,
                                                                      new VideoOS.Platform.Messaging.CommunicationIdFilter(MessageCommunication.ProvideCurrentStateResponse));

            _messageCommunication.ConnectionStateChangedEvent += new EventHandler(_messageCommunication_ConnectionStateChangedEvent);
            // Build Top TreeNode
            // GetItems will always return the Management Server as the single top-node - we are using System-defined hierarchy so that in XPCO you can see recording servers
            Item     server = Configuration.Instance.GetItems(ItemHierarchy.SystemDefined)[0];
            TreeNode tn     = new TreeNode(server.Name)
            {
                ImageIndex         = VideoOS.Platform.UI.Util.ServerIconIx,
                SelectedImageIndex = VideoOS.Platform.UI.Util.ServerIconIx,
                Tag = server.FQID.ServerId.Id
            };

            treeViewItems.Nodes.Add(tn);

            // Add all children
            tn.Nodes.AddRange(AddChildren(server));

            try
            {
                // Ask for current state of all Items
                _messageCommunication.TransmitMessage(
                    new VideoOS.Platform.Messaging.Message(MessageCommunication.ProvideCurrentStateRequest), null, null, null);
            } catch (MIPException)
            {
                MessageBox.Show(
                    "Unable to connect to EventServer's MessageCommunication service (default port 22333) - will retry every 5 seconds",
                    "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            treeViewItems.ExpandAll();
        }
Esempio n. 13
0
        /// <summary>
        /// Called by the Environment when the user has logged in.
        /// </summary>
        public override void Init()
        {
            ClientControl.Instance.NewImageViewerControlEvent += new ClientControl.NewImageViewerControlHandler(NewImageViewerControlEvent);
            MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
            _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

            _obj1 = _messageCommunication.RegisterCommunicationFilter(NewEventIndicationMessageHandler,
                                                                      new CommunicationIdFilter(MessageId.Server.NewEventIndication));

            _obj2 = _messageCommunication.RegisterCommunicationFilter(NewAlarmMessageHandler,
                                                                      new CommunicationIdFilter(MessageId.Server.NewAlarmIndication));
            timerRemoveOverlays          = new System.Timers.Timer(_interval);
            timerRemoveOverlays.Elapsed += new ElapsedEventHandler(TimedRefresh);

            timerRemoveOverlays.Enabled = true;
        }
Esempio n. 14
0
        public void Init()
        {
            _catchUpTimer = new Timer(CatchUpTimerHandler);

            try
            {
                MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
                _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

                _systemConfigurationChangedIndicationRefefence = _messageCommunication.RegisterCommunicationFilter(SystemConfigChangedHandler2,
                                                                                                                   new VideoOS.Platform.Messaging.CommunicationIdFilter(MessageId.System.SystemConfigurationChangedIndication));
            }
            catch (MIPException ex)
            {
                Trace.WriteLine("Message Communcation not supported:" + ex.Message);
            }
        }
Esempio n. 15
0
        public MainForm()
        {
            InitializeComponent();
            _viewMode = ViewMode.Alarm;
            MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
            _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

            _alarmClientManager = new AlarmClientManager();

            rbAlarms.Tag    = ViewMode.Alarm;
            rbAnalytics.Tag = ViewMode.Analytics;
            rbEvents.Tag    = ViewMode.Event;
            rbLPR.Tag       = ViewMode.LPR;
            rbAccess.Tag    = ViewMode.Access;

            setGrid();
        }
Esempio n. 16
0
        public void Listener()
        {
            if (client != null && client.Connected)
            {
                ms = new MessageCommunication(client);
                ChatManager cm      = new ChatManager();
                Message     message = null;
                TextMessage textMessage;

                // Message
                while (client.Connected)
                {
                    // Sending message to Server
                    textMessage = cm.CreateTextMessage("Hello server");
                    Console.WriteLine("[Client] Client ---> Server | Sending message");
                    ms.Send(textMessage);

                    // Recive message from Server
                    message = ms.Recive();

                    if (message != null)
                    {
                        Console.WriteLine("[Client] Server ---> Client | Recived message");
                        if (message is TextMessage)
                        {
                            textMessage = ( TextMessage )message;

                            TimeSpan MessageTime = new TimeSpan(textMessage.Date);
                            // Latency, message created to message recived
                            double latency = ((DateTime.Now.ToUniversalTime().Ticks - textMessage.Date) / 10000);

                            // if type of text message is ToAll
                            if (textMessage.Type == TextMessageType.ToAll)
                            {
                                Console.WriteLine("MessageTime: " + MessageTime.Hours + ":" + MessageTime.Minutes + ":" + MessageTime.Seconds + " Latency: " + latency + "ms Message: " + textMessage.Text);
                            }
                        }
                    }


                    Thread.Sleep(1000);
                } // End of message
            }
            Console.Write("Lost connection to server, press any key to exit.");
            Console.Read();
        }
Esempio n. 17
0
        public ConfigurationMonitor(ServerId serverId)
        {
            _reloadTimer = new System.Threading.Timer(ReloadConfigTimerHandler);
            _serverId    = serverId;

            //Find out if site has an event server

            // We use the Event Server for getting the change indication
            MessageCommunicationManager.Start(_serverId);
            _messageCommunication = MessageCommunicationManager.Get(_serverId);

            _obj = _messageCommunication.RegisterCommunicationFilter(SystemConfigurationChangedIndicationHandler,
                                                                     new VideoOS.Platform.Messaging.CommunicationIdFilter(VideoOS.Platform.Messaging.MessageId.System.SystemConfigurationChangedIndication));

            _messageCommunication.ConnectionStateChangedEvent += new EventHandler(_messageCommunication_ConnectionStateChangedEvent);

            _reloadTimer.Change(0, 15000);      // Lets display now
        }
 /// <summary>
 /// Called by the Environment when the user log's out.
 /// You should close all remote sessions and flush cache information, as the
 /// user might logon to another server next time.
 /// </summary>
 public override void Close()
 {
     if (_SelectViewItemTimer != null)
     {
         _SelectViewItemTimer.Elapsed -= SelectViewItemTimer_Elapsed;
         _SelectViewItemTimer.Dispose();
     }
     ClientControl.Instance.NewImageViewerControlEvent -= new ClientControl.NewImageViewerControlHandler(NewImageViewerControlEvent);
     if (_messageCommunication != null)
     {
         foreach (object messageRegistrationObject in _messageRegistrationObjects)
         {
             EnvironmentManager.Instance.UnRegisterReceiver(messageRegistrationObject);
         }
         _messageRegistrationObjects?.Clear();
         _messageCommunication?.Dispose();
         _messageCommunication = null;
     }
 }
        // private static readonly string modelsDirectory = Path.Combine(Environment.CurrentDirectory, @"ML\OnnxModels");


        /*
         * private void LoadModel()
         * {
         *  // Check for an Onnx model exported from Custom Vision
         *  var customVisionExport = Directory.GetFiles(modelsDirectory, "*.zip").FirstOrDefault();
         *
         *  // If there is one, use it.
         *  if (customVisionExport != null)
         *  {
         *      var customVisionModel = new CustomVisionModel(customVisionExport);
         *      var modelConfigurator = new OnnxModelConfigurator(customVisionModel);
         *
         *      outputParser = new OnnxOutputParser(customVisionModel);
         *      customVisionPredictionEngine = modelConfigurator.GetMlNetPredictionEngine<CustomVisionPrediction>();
         *  }
         *  else // Otherwise default to Tiny Yolo Onnx model
         *  {
         *      var tinyYoloModel = new TinyYoloModel(Path.Combine(modelsDirectory, "TinyYolo2_model.onnx"));
         *      var modelConfigurator = new OnnxModelConfigurator(tinyYoloModel);
         *
         *      outputParser = new OnnxOutputParser(tinyYoloModel);
         *      tinyYoloPredictionEngine = modelConfigurator.GetMlNetPredictionEngine<TinyYoloPrediction>();
         *  }
         * }
         *
         *
         *
         */



        public HeatMapPluginService()
        {
            //load Model
            //LoadModel();


            InitializeComponent();


            // Test Parameters
            //Item _newItem = Configuration.Instance.GetItem(new Guid("d198ae21-1aba-48fa-83d5-f0aa191439f9"), new Guid("5135ba21-f1dc-4321-806a-6ce2017343c0"));
            Item _newItem = Configuration.Instance.GetItem(new Guid("D198AE21-1ABA-48FA-83D5-F0AA191439F9"), new Guid("5135ba21-f1dc-4321-806a-6ce2017343c0"));

            //Item _newItem = Configuration.Instance.GetItem(new Guid("DD826D1C-E703-4FED-8124-7D67ECEAA317"), new Guid("5135ba21-f1dc-4321-806a-6ce2017343c0"));



            OpenStream(_newItem);

            blobCounter = new BlobCounter();

            // Initialize Analyc Image Process
            analyticsImageProcessing = new AnalyticsImageProcessing();

            // Start Metadata Device service
            metadataHandler          = new MetadataHandler();
            _metadataProviderChannel = metadataHandler.OpenHTTPService();

            _metadataProviderChannel.SessionOpening += MetadataProviderSessionOpening;
            _metadataProviderChannel.SessionClosed  += MetadataProviderSessionClosed;

            // Start Communication Manager
            MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
            _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

            // Create a fiter to get messages from Smart Client Plugin
            _messageCommunication.RegisterCommunicationFilter(HeatMapSearchHandler, new VideoOS.Platform.Messaging.CommunicationIdFilter("analyticsHeatMapSearch"));
        }
Esempio n. 20
0
        private void StartMessaging(ServerObject smo)
        {
            if (smo.MessCommunication == null)
            {
                //VideoOS.Platform.SDK.Environment.AddServer(smo.SiteItem, _credentialCache);
                Item site = smo.SiteItem;

                MessageCommunicationManager.Start(site.FQID.ServerId);
                MessageCommunication messageCommunication = MessageCommunicationManager.Get(site.FQID.ServerId);
                object newEventIndicationHandler          = messageCommunication.RegisterCommunicationFilter(
                    MessageHandler,
                    new VideoOS.Platform.Messaging.CommunicationIdFilter(
                        VideoOS.Platform.Messaging.MessageId.Server.NewEventIndication));
                object provideCurrentStateResponseHandler =
                    messageCommunication.RegisterCommunicationFilter(ProvideCurrentStateResponseHandler,
                                                                     new VideoOS.Platform.Messaging.
                                                                     CommunicationIdFilter(
                                                                         MessageCommunication
                                                                         .ProvideCurrentStateResponse));
                TreeNode treeNode = BuildTree(site.FQID);
                if (treeNode != null)
                {
                    smo.MessCommunication                  = messageCommunication;
                    smo.NewEventIndicationHandler          = newEventIndicationHandler;
                    smo.ProvideCurrentStateResponseHandler = provideCurrentStateResponseHandler;
                }

                try
                {
                    messageCommunication.TransmitMessage(
                        new VideoOS.Platform.Messaging.Message(MessageCommunication.ProvideCurrentStateRequest),
                        null, null, null);
                }
                catch (Exception ex)
                {
                    toolStripStatusLabel1.Text = "TransmitMessage Exception: " + ex.Message +
                                                 " -Happens on server: " + smo.SiteItem.Name;
                    // todo

                    {
                        if (IsHandleCreated && !IsDisposed)
                        {
                            this.BeginInvoke(new MethodInvoker(delegate()
                            {
                                TreeNode tn = smo.SitesTreeNode;
                                if (smo.MessCommunication != null)
                                {
                                    if (smo.MessCommunication.IsConnected)
                                    {
                                        tn.ToolTipText = "connected";
                                        tn.ForeColor   = Color.Black;
                                    }
                                    else
                                    {
                                        tn.ToolTipText = "not connected";
                                        tn.ForeColor   = Color.Gray;
                                    }
                                }
                            }));
                        }
                    }
                }

                messageCommunication.ConnectionStateChangedEvent +=
                    new EventHandler(MessageConnectionStateChangedEvent);
            }
        }