private void OnTransportStatusChanger(object sender, NetworkStatus e) { base.Dispatcher.Invoke(() => { OWLOSTransport transport = sender as OWLOSTransport; switch (e) { case NetworkStatus.Online: Rotate(angel); break; case NetworkStatus.Offline: Rotate(90 + angel); break; case NetworkStatus.Reconnect: Rotate(180 + angel); break; case NetworkStatus.Erorr: Rotate(270 + angel); break; } this.UpdateLayout(); if (relationLine?.curveLine != null) { relationLine?.UpdatePositions(); } }); }
public ThingConnectionConfigItemControl(OWLOSThing Thing, OWLOSTransport ThingTransport) { InitializeComponent(); this.Thing = Thing; this.ThingTransport = ThingTransport; EnabledCheckBox.IsChecked = ThingTransport.connection.enable; NameTextBox.Text = ThingTransport.connection.name; TypeComboBox.SelectedIndex = (int)ThingTransport.connection.connectionType; ConnectionStringTextBox.Text = ThingTransport.connection.connectionString; ThingTransport.OnTransportStatusChanger += ThingTransport_OnTransportStatusChanger; ThingTransport.OnLogItem += ThingTransport_OnLogItem; OutLogControl = new LogControl(); OutLogControl.SetValue(Grid.ColumnProperty, 0); OutLogControl.SetValue(Grid.RowProperty, 1); LogGrid.Children.Add(OutLogControl); InLogControl = new LogControl(); InLogControl.SetValue(Grid.ColumnProperty, 1); InLogControl.SetValue(Grid.RowProperty, 1); LogGrid.Children.Add(InLogControl); }