static Database() { GlobalConnectionInfo = new GlobalConnectionInfo(); AnalogInputPoints = new Dictionary <int, AnalogInputPoint>(); ARPSpoofParticipantsInfo = new ARPSpoofParticipantsInfo(); FixedValues = new Dictionary <Tuple <int, PointType>, FixedValue>(); lockObject = new object(); }
public void ReturnConnectionInfo(GlobalConnectionInfo connectionInfo) { try { proxy.ReturnConnectionInfo(connectionInfo); } catch { } }
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(); } }
public void PublishConnectionInfo(GlobalConnectionInfo connectionInfo) { try { subscriber.ReturnConnectionInfo(connectionInfo); } catch (Exception e) { PubSubDatabase.RemoveSubsriber(subscriber); } }
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(); } }
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 += " : "; } } }
public void ReturnConnectionInfo(GlobalConnectionInfo connectionInfo) { publishConnectionInfoEvent?.Invoke(connectionInfo); }
public PublishThreadData(IPublisher subscriber, GlobalConnectionInfo connectionInfo) { this.subscriber = subscriber; this.connectionInfo = connectionInfo; }