コード例 #1
0
ファイル: Database.cs プロジェクト: AleksandraMisic/MasterRad
 static Database()
 {
     GlobalConnectionInfo     = new GlobalConnectionInfo();
     AnalogInputPoints        = new Dictionary <int, AnalogInputPoint>();
     ARPSpoofParticipantsInfo = new ARPSpoofParticipantsInfo();
     FixedValues = new Dictionary <Tuple <int, PointType>, FixedValue>();
     lockObject  = new object();
 }
コード例 #2
0
 public void ReturnConnectionInfo(GlobalConnectionInfo connectionInfo)
 {
     try
     {
         proxy.ReturnConnectionInfo(connectionInfo);
     }
     catch { }
 }
コード例 #3
0
        public void ReturnConnectionInfo(GlobalConnectionInfo connectionInfo)
        {
            foreach (IPublisher subscriber in PubSubDatabase.Subscribers)
            {
                PublishThreadData threadObj = new PublishThreadData(subscriber, connectionInfo);

                Thread thread = new Thread(() => threadObj.PublishConnectionInfo(connectionInfo));
                thread.Start();
            }
        }
コード例 #4
0
 public void PublishConnectionInfo(GlobalConnectionInfo connectionInfo)
 {
     try
     {
         subscriber.ReturnConnectionInfo(connectionInfo);
     }
     catch (Exception e)
     {
         PubSubDatabase.RemoveSubsriber(subscriber);
     }
 }
コード例 #5
0
        void ConnectionInfoChanged(GlobalConnectionInfo connectionInfo)
        {
            lock (Database.lockObject)
            {
                Database.GlobalConnectionInfo = connectionInfo;
            }

            if (Database.ViewModels.TryGetValue(ViewModelType.CONNECTION_INFO, out SingleShellFillerViewModel singleShellFillerViewModel) && singleShellFillerViewModel.IsOpen)
            {
                ((ConnectionInfoViewModel)singleShellFillerViewModel).ConnectionInfoChanged();
            }
        }
コード例 #6
0
        public void ConnectionInfoChanged()
        {
            GlobalConnectionInfo connectionInfo = Database.GlobalConnectionInfo;

            if (connectionInfo.ConnectionState == ConnectionState.DISCONNECTED)
            {
                this.IsConnected = false;
                return;
            }

            this.IsConnected = true;

            this.friendlyName = connectionInfo.FriendlyName;
            this.Description  = connectionInfo.Description;

            this.IPAddress = string.Empty;
            for (int i = 0; i < 4; i++)
            {
                this.IPAddress += connectionInfo.IPAddress[i].ToString();

                if (i != 3)
                {
                    this.IPAddress += ".";
                }
            }

            this.SubnetMask = string.Empty;
            for (int i = 0; i < 4; i++)
            {
                this.SubnetMask += connectionInfo.SubnetMask[i].ToString();

                if (i != 3)
                {
                    this.SubnetMask += ".";
                }
            }

            this.MACAddress = string.Empty;
            for (int i = 0; i < 6; i++)
            {
                this.MACAddress += connectionInfo.MACAddress[i].ToString("X");

                if (i != 5)
                {
                    this.MACAddress += " : ";
                }
            }
        }
コード例 #7
0
 public void ReturnConnectionInfo(GlobalConnectionInfo connectionInfo)
 {
     publishConnectionInfoEvent?.Invoke(connectionInfo);
 }
コード例 #8
0
 public PublishThreadData(IPublisher subscriber, GlobalConnectionInfo connectionInfo)
 {
     this.subscriber     = subscriber;
     this.connectionInfo = connectionInfo;
 }