Ejemplo n.º 1
0
        internal ConnectorInfo GetInfo()
        {
            ConnectorInfo info = new ConnectorInfo();

            info.DesignerItemLeft = DesignerCanvas.GetLeft(this.ParentDesignerItem);
            info.DesignerItemTop  = DesignerCanvas.GetTop(this.ParentDesignerItem);
            info.DesignerItemSize = new Size(this.ParentDesignerItem.ActualWidth, this.ParentDesignerItem.ActualHeight);
            info.Orientation      = this.Orientation;
            info.Position         = this.Position;
            return(info);
        }
Ejemplo n.º 2
0
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonDown(e);
            DesignerCanvas canvas = GetDesignerCanvas(this);

            if (canvas != null)
            {
                // position relative to DesignerCanvas
                this.dragStartPoint = new Point?(e.GetPosition(canvas));
                e.Handled           = true;
            }
        }
Ejemplo n.º 3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Flow_Chart = ((System.Windows.Controls.Expander)(target));
                return;

            case 2:
                this.Add_Remove_Img = ((System.Windows.Controls.Button)(target));

            #line 38 "..\..\..\Screens\Recipe_Creation.xaml"
                this.Add_Remove_Img.Click += new System.Windows.RoutedEventHandler(this.Chart_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.Top_Size_Lbl = ((System.Windows.Controls.Label)(target));
                return;

            case 4:
                this.Top_Size = ((System.Windows.Controls.ComboBox)(target));

            #line 46 "..\..\..\Screens\Recipe_Creation.xaml"
                this.Top_Size.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.Top_Size_SelectionChanged);

            #line default
            #line hidden
                return;

            case 5:
                this.Mass_Lbl = ((System.Windows.Controls.Label)(target));
                return;

            case 6:
                this.Mass = ((System.Windows.Controls.TextBox)(target));

            #line 58 "..\..\..\Screens\Recipe_Creation.xaml"
                this.Mass.PreviewTextInput += new System.Windows.Input.TextCompositionEventHandler(this.NumberValidationTextBox);

            #line default
            #line hidden
                return;

            case 7:
                this.MyDesigner = ((RobotRecipeManager.DesignerCanvas)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 4
0
        private void ShowAdorner()
        {
            // the ConnectionAdorner is created once for each Connection
            if (this.connectionAdorner == null)
            {
                DesignerCanvas designer = VisualTreeHelper.GetParent(this) as DesignerCanvas;

                AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);
                if (adornerLayer != null)
                {
                    this.connectionAdorner = new ConnectionAdorner(designer, this);
                    adornerLayer.Add(this.connectionAdorner);
                }
            }
            this.connectionAdorner.Visibility = Visibility.Visible;
        }
        public ConnectionAdorner(DesignerCanvas designer, Connection connection)
            : base(designer)
        {
            this.designerCanvas = designer;
            adornerCanvas       = new Canvas();
            this.visualChildren = new VisualCollection(this);
            this.visualChildren.Add(adornerCanvas);

            this.connection = connection;
            this.connection.PropertyChanged += new PropertyChangedEventHandler(AnchorPositionChanged);

            InitializeDragThumbs();

            drawingPen          = new Pen(Brushes.LightSlateGray, 1);
            drawingPen.LineJoin = PenLineJoin.Round;

            base.Unloaded += new RoutedEventHandler(ConnectionAdorner_Unloaded);
        }
Ejemplo n.º 6
0
        void Connection_Unloaded(object sender, RoutedEventArgs e)
        {
            // do some housekeeping when Connection is unloaded

            // remove event handler
            this.Source = null;
            this.Sink   = null;

            // remove adorner
            if (this.connectionAdorner != null)
            {
                DesignerCanvas designer = VisualTreeHelper.GetParent(this) as DesignerCanvas;

                AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);
                if (adornerLayer != null)
                {
                    adornerLayer.Remove(this.connectionAdorner);
                    this.connectionAdorner = null;
                }
            }
        }
Ejemplo n.º 7
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Flow_Chart = ((System.Windows.Controls.Expander)(target));
                return;

            case 2:

            #line 38 "..\..\Window1.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Chart_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.Top_Size_Lbl = ((System.Windows.Controls.Label)(target));
                return;

            case 4:
                this.Top_Size = ((System.Windows.Controls.TextBox)(target));
                return;

            case 5:
                this.Mass_Lbl = ((System.Windows.Controls.Label)(target));
                return;

            case 6:
                this.Mass = ((System.Windows.Controls.TextBox)(target));
                return;

            case 7:
                this.MyDesigner = ((RobotRecipeManager.DesignerCanvas)(target));
                return;
            }
            this._contentLoaded = true;
        }
        protected override void OnDrop(DragEventArgs e)
        {
            Custom_Functions.Validation_OnDrop validation = new Custom_Functions.Validation_OnDrop();

            bool check = validation.Validation_Check(e);

            if (check == false)
            {
                return;
            }
            else
            {
                base.OnDrop(e);
                DragObject dragObject = e.Data.GetData(typeof(DragObject)) as DragObject;
                if (dragObject != null && !String.IsNullOrEmpty(dragObject.Xaml))
                {
                    DesignerItem newItem = null;
                    Object       content = XamlReader.Load(XmlReader.Create(new StringReader(dragObject.Xaml)));

                    if (content != null)
                    {
                        newItem         = new DesignerItem();
                        newItem.Content = content;
                        newItem.Init();

                        Point position = e.GetPosition(this);

                        if (dragObject.DesiredSize.HasValue)
                        {
                            Size desiredSize = dragObject.DesiredSize.Value;
                            newItem.Width  = desiredSize.Width;
                            newItem.Height = desiredSize.Height;

                            DesignerCanvas.SetLeft(newItem, Math.Max(0, position.X - newItem.Width / 2));
                            DesignerCanvas.SetTop(newItem, Math.Max(0, position.Y - newItem.Height / 2));
                        }
                        else
                        {
                            DesignerCanvas.SetLeft(newItem, Math.Max(0, position.X));
                            DesignerCanvas.SetTop(newItem, Math.Max(0, position.Y));
                        }

                        Canvas.SetZIndex(newItem, this.Children.Count);
                        this.Children.Add(newItem);
                        SetConnectorDecoratorTemplate(newItem);

                        //update selection
                        this.SelectionService.SelectItem(newItem);
                        newItem.Focus();

                        var timer = new System.Windows.Threading.DispatcherTimer {
                            Interval = TimeSpan.FromSeconds(0.5)
                        };
                        timer.Start();
                        timer.Tick += (sender, args) =>
                        {
                            timer.Stop();
                            this.connectAutomatically();
                        };
                    }

                    e.Handled = true;
                }
            }
        }
Ejemplo n.º 9
0
 public SelectionService(DesignerCanvas canvas)
 {
     this.designerCanvas = canvas;
 }