コード例 #1
0
 private void pathL1_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (!driverCountrol.parentControl.isVisible)
     {
         if (driverCountrol.parentControl.Visibility == Visibility.Hidden)
         {
             driverCountrol.parentControl.Visibility = Visibility.Visible;
         }
         driverCountrol.parentControl.Show();
         relationLine.Show();
     }
     else
     {
         driverCountrol.parentControl.Hide();
         relationLine.Hide();
     }
 }
コード例 #2
0
 private void RelatedPanel_OnWindow(object sender, EventArgs e)
 {
     relationLine.Hide();
 }
コード例 #3
0
        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);
        }