private void DrawPower(int value) { double PowerPercent = value / (PowerLimit / 100); double PowerAngel = (PowerAngelLimit / 100) * PowerPercent; PowerPath.Data = HudLibrary.DrawArc(350, 350, radius - 40, PowerAngeStart, PowerAngel + PowerAngeStart); }
private void DrawFreeHeap(int value) { double freeHeapPercent = value / (freeHeapLimit / 100); double freeHeapAngel = (freeHeapAngelLimit / 100) * freeHeapPercent; freeHeapPath.Data = HudLibrary.DrawArc(350, 350, radius - 20, 0, freeHeapAngel); }
private void DrawWiFiRSSID(int value) { value = value * -1; double WiFiRSSIDPercent = value / (WiFiRSSIDLimit / 100); double WiFiRSSIDAngel = (WiFiRSSIDAngelLimit / 100) * WiFiRSSIDPercent; WiFiRSSIDPath.Data = HudLibrary.DrawArc(350, 350, radius - 40, 0, WiFiRSSIDAngel); }
public OWLOSNodeControl(OWLOSNodeWrapper nodeWrapper) { this.nodeWrapper = nodeWrapper; if (nodeWrapper != null) { nodeWrapper.node.OnNewDriver += Node_OnNewDriver; } InitializeComponent(); parentControl = new EcosystemControl(this); nodeShadowPath.Data = nodePath.Data = HudLibrary.DrawArc(350, 350, radius, 0, 359); insideNodePath.Data = HudLibrary.DrawArc(350, 350, radius - 80, 0, 359); insideNodePath2.Data = HudLibrary.DrawArc(350, 350, radius - 120, 0, 359); freeHeapPathBack.Data = HudLibrary.DrawArc(350, 350, radius - 20, 0, freeHeapAngelLimit); DrawFreeHeap(50); WiFiRSSIDPathBack.Data = HudLibrary.DrawArc(350, 350, radius - 40, 0, WiFiRSSIDAngelLimit); DrawWiFiRSSID(-50); PowerPathBack.Data = HudLibrary.DrawArc(350, 350, radius - 40, PowerAngeStart, PowerAngelLimit + PowerAngeStart); DrawPower(25000); scriptsPath.Data = HudLibrary.DrawArc(350, 350, radius - 40, 185, 300); script1Path.Data = HudLibrary.DrawArc(350, 350, radius - 60, 190, 210); script2Path.Data = HudLibrary.DrawArc(350, 350, radius - 60, 215, 235); script3Path.Data = HudLibrary.DrawArc(350, 350, radius - 60, 240, 260); filesPath.Data = HudLibrary.DrawArc(350, 350, radius - 40, 302, 315); propertiesPath.Data = HudLibrary.DrawArc(350, 350, radius - 40, 317, 359); restFullPath.Data = HudLibrary.DrawArc(350, 350, radius - 100, 0, 40); MQTTPath.Data = HudLibrary.DrawArc(350, 350, radius - 100, 45, 85); UARTPath.Data = HudLibrary.DrawArc(350, 350, radius - 100, 90, 130); //RalationLines test /* * DoubleAnimation rotate = new DoubleAnimation * { * From = 0.0f, * To = 360.0f, * Duration = new Duration(TimeSpan.FromMilliseconds(10000)), * RepeatBehavior = RepeatBehavior.Forever, * EasingFunction = new BackEase() * //AutoReverse = true * }; * RotateTransform rotateTransform = new RotateTransform(); * this.RenderTransform = rotateTransform; * rotateTransform.BeginAnimation(RotateTransform.AngleProperty, rotate); * renderTransform.AddValueChanged(this, PositionChanged); * //nodeGrid.RenderTransform.Add */ }
public OWLOSPetalControl(OWLOSThingControl parentOWLOSThingControl, double radius, double angel, double length, double width) { InitializeComponent(); this.parentOWLOSThingControl = parentOWLOSThingControl; this.radius = radius; this.angel = angel; this.length = length; parentOWLOSThingControl.parentControl.OnPositionChanged += ParentControl_OnPositionChanged; double startAngel = 0; petalBackground.Data = HudLibrary.DrawArc(Gold.center, Gold.center, radius, startAngel, length); petalBackground.StrokeThickness = width; petalBorder1.Data = HudLibrary.DrawArc(Gold.center, Gold.center, radius + width / 2, startAngel, length); petalBorder2.Data = HudLibrary.DrawArc(Gold.center, Gold.center, radius - width / 2, startAngel, length); //подготавливаем конектор - элементы экосистемы могут соединятся друг с другом, в данном случае //одна нода имеет множество присоединеных драйверов. По этой причине нужно инкапсулировать много элементов //для соединеня connector = new EcosystemControl(null); connector.MoveTransform(0, 0); connector.Width = 10; connector.Height = 10; connector.HorizontalAlignment = HorizontalAlignment.Center; connector.VerticalAlignment = VerticalAlignment.Top; connector.Margin = new Thickness(0, 0, 0, 0); connector.MoveTransform(0, 330 - radius); Ellipse elipse = new Ellipse { Width = 10, Height = 10, Fill = (SolidColorBrush)App.Current.Resources["OWLOSWarning"] }; connector.childHolderGrid.Children.Add(elipse); petalMainGrid.Children.Add(connector); }
public DriverPropertyControl(OWLOSDriverProperty DriverProperty) { InitializeComponent(); this.DriverProperty = DriverProperty; flags = new PropertyFlags(DriverProperty.flags); //Name setup by flags propName.Text = DriverProperty.name; ValueToEditors(); if (flags.isSelected) { propName.Foreground = (SolidColorBrush)App.Current.Resources["OWLOSWarning"]; propValue.Foreground = (SolidColorBrush)App.Current.Resources["OWLOSWarning"]; } else { propName.Foreground = SystemColors.InfoTextBrush; propValue.Foreground = SystemColors.InfoTextBrush; } DriverProperty.OnPropertyChange += Property_ChangeProperty; DriverProperty.OnPropertyTransportStatusChange += Property_OnPropertyTransportStatusChange; propSpinner.Data = HudLibrary.DrawArc(10, 10, 7, 1, 240); spinnerRotate = new DoubleAnimation { From = 0.0f, To = 360, Duration = new Duration(TimeSpan.FromMilliseconds(1000)), RepeatBehavior = RepeatBehavior.Forever // EasingFunction = new BackEase() }; propSpinner.RenderTransform = new RotateTransform(); }
public OWLOSNodeDriverControl(OWLOSNodeControl parentOWLOSNodeControl, OWLOSDriver driver, double radius, double angel) { InitializeComponent(); this.driver = driver; this.radius = radius; this.angel = angel; connector.MoveTransform(0, 0); connector.Width = 10; connector.Height = 10; connector.HorizontalAlignment = HorizontalAlignment.Center; connector.VerticalAlignment = VerticalAlignment.Top; connector.Margin = new Thickness(0, 0, 0, 0); connector.Background = (SolidColorBrush)App.Current.Resources["OWLOSWarning"]; text2.Children.Add(connector); this.parentOWLOSNodeControl = parentOWLOSNodeControl; double _angel = 0; pathL1.Data = HudLibrary.DrawArc(350, 350, radius, _angel, _angel + 25); pathL2.Data = HudLibrary.DrawArc(350, 350, radius + 20, _angel, _angel + 25); pathL3.Data = HudLibrary.DrawArc(350, 350, radius - 20, _angel, _angel + 25); RotateTransform rotateTransform = new RotateTransform(); rotateTransform.Angle = angel * 30; text2.RenderTransform = rotateTransform; driverNameText.Text = driver.name; driverCountrol = new OWLOSDriverControl(driver); driverCountrol.parentControl.Visibility = Visibility.Hidden; driverCountrol.parentControl.Hide(); double xr = 1000 * Math.Cos(Math.PI * (angel / 6.0) - Math.PI / 2) + parentOWLOSNodeControl.parentControl.transform.X; double yr = 1000 * Math.Sin(Math.PI * (angel / 6.0) - Math.PI / 2) + parentOWLOSNodeControl.parentControl.transform.Y; driverCountrol.parentControl.MoveTransform(xr, yr); (parentOWLOSNodeControl.parentControl.Parent as Grid).Children.Add(driverCountrol.parentControl); parentOWLOSNodeControl.parentControl.OnPositionChanged += ParentControl_OnPositionChanged; relationLine = new EcosystemRelationLine(driverCountrol, driverCountrol.parentControl, connector, driverCountrol, parentOWLOSNodeControl.parentControl.Parent as Grid); relationLine.DrawRelationLine(((SolidColorBrush)App.Current.Resources["OWLOSInfo"]).Color.ToString(), ((SolidColorBrush)App.Current.Resources["OWLOSInfo"]).Color.ToString()); relationLine.Hide(); //driver.NewProperty += Driver_NewProperty; //DoubleAnimation rotate2 = new DoubleAnimation(1300.0f, 0.0f, new Duration(TimeSpan.FromMilliseconds(50000))); //RotateTransform rotateTransform2 = new RotateTransform(); //text2.RenderTransform = rotateTransform2; //rotateTransform2.BeginAnimation(RotateTransform.AngleProperty, rotate2); }