public PrepareNoteForm(NetworkNode client, string dbConnectionString, Log log)
        {
            this.client = client;
             this.dbConnectionString = dbConnectionString;
             this.log = log;

             InitializeComponent();

             this.updateServerDelegate = new VoidDelegate(UpdateCurrentServerDetails);
             this.receiveHandler = new MessageEventHandler(client_MessageReceived);
             this.toggleSendButtonDelegate = new ButtonStringBoolDelegate(ToggleButton);
             this.closeDelegate = new DialogResultDelegeate(DoClose);
             this.timeDelegate = new VoidDelegate(UpdateTime);
             this.clockCallback = new System.Threading.TimerCallback(ClockTimerTimedout);
        }
Exemple #2
0
        private void SetUpWorkings()
        {
            closeDelegate = new VoidDelegate(this.Close);
             connectionHandler = new DeviceNotification(DeviceManagement_NetworkConnected);

             InitialiseWiFi();

             log.Name = "log";
             log.LogMessage += new LogMessageEventHandler(log_LogMessage);
             log.Start();

             DeviceManagement.NetworkConnected += connectionHandler;

             aliveServers = new ObjectCache(7000);
             receiveHandler = new MessageEventHandler(networkNode_MessageReceived);
             aliveServers.ItemExpired += new ItemExpiredEventHandler(aliveServers_ItemExpired);

             ClientID = Guid.NewGuid();
             networkNode = new NetworkNode(ClientID, IPAddress.Any, SensorShareConfig.CommunicationPort);
             networkNode.MessageReceived += receiveHandler;
        }
Exemple #3
0
        private void StartServer()
        {
            if (!serverIsStarted)
             {
            if (networkNode != null)
            {
               networkNode = null;
            }
            networkNode = new NetworkNode(CurrentServerData.id, IPAddress.Any, SensorShareConfig.CommunicationPort);
            aliveTimer = new System.Threading.Timer(new System.Threading.TimerCallback(SendAliveMessage), null, 0, SensorShareConfig.AliveTimeout);

            networkNode.MessageReceived += new MessageEventHandler(networkNode_MessageReceived);
            networkNode.Start();

            serverIsStarted = true;
            MessageBox.Show(String.Format("Started for {0}", CurrentServerData.id));
            log.Append("StartServer", String.Format("Started for {0}", CurrentServerData.id));
             }
             if (this.InvokeRequired)
             {
            this.Invoke(descriptionUpdater);
             }
             else
             {
            UpdateServerDescription();
             }
        }