internal void initCanvas(DrawingCanvas canvas)
        {
            this.canvas = canvas;
            StockEngine.Inst.init(canvas);

            //init stock engine by python config.
            initConfig();
        }
Esempio n. 2
0
        private StreamControl(DrawingCanvas canvas, AbstractStream stream)
        {
            m_canvas = canvas;
            m_stream = stream;

            InitializeComponent();

            if (null != canvas && null != stream)
            {
                // Create the brush for the stream line
                if (stream is HeatStream)
                {
                    m_streamLineNotSelected = new SolidColorBrush(Colors.Red);
                }
                else
                {
                    m_streamLineNotSelected = new SolidColorBrush(Colors.Black);
                }

                // Create the drag handle for the source
                m_sourceDragIcon = new DraggableStreamEndpoint(
                    DraggableStreamEndpoint.EndpointType.StreamSource,
                    this, canvas);
                m_sourceDragIcon.Width    = m_sourceDragIcon.Height = 20.0;
                m_sourceDragIcon.Location = new Point(m_stream.SourceLocation.X, m_stream.SourceLocation.Y);
                // Add it to the canvas
                m_canvas.AddNewChild(m_sourceDragIcon);
                // Set the Z-index
                m_sourceDragIcon.SetValue(Canvas.ZIndexProperty, 2);
                // Setup mouse events
                m_sourceDragIcon.MouseLeftButtonDown += new MouseButtonEventHandler(DragIcon_MouseLeftButtonDown);

                // Create the drag handle for the destination
                m_dstDragIcon = new DraggableStreamEndpoint(
                    DraggableStreamEndpoint.EndpointType.StreamDestination,
                    this, canvas);
                // Add it to the canvas
                m_canvas.AddNewChild(m_dstDragIcon);
                // Set the Z-index
                m_dstDragIcon.SetValue(Canvas.ZIndexProperty, 2);
                // Show it if there's no destination, hide it otherwise
                m_dstDragIcon.Visibility = (null == m_stream.Destination) ?
                                           Visibility.Visible : System.Windows.Visibility.Collapsed;
                // Setup mouse events
                m_dstDragIcon.MouseLeftButtonDown += new MouseButtonEventHandler(DragIcon_MouseLeftButtonDown);

                // Create the arrow polygon control
                m_arrow = new Polygon();
                // Set the fill
                m_arrow.Fill = m_streamLineNotSelected;
                // Add it to the canvas
                m_canvas.AddNewChild(m_arrow);
                // Set the Z-index
                m_arrow.SetValue(Canvas.ZIndexProperty, 2);
                // Add 3 points/vertices
                m_arrow.Points.Add(new Point());
                m_arrow.Points.Add(new Point());
                m_arrow.Points.Add(new Point());
                // Hide it if there's no destination
                if (null == m_stream.Destination)
                {
                    m_arrow.Visibility = Visibility.Collapsed;
                }
                // Setup mouse events
                if (!(m_stream.Destination is HeatExchangerWithUtility))
                {
                    m_arrow.MouseLeftButtonDown += new MouseButtonEventHandler(DestinationArrow_MouseLeftButtonDown);
                }

                UpdateStreamLocation();

                // Create the table
                CreatePropertiesTable(m_stream.PropertiesTable);

                // Watch for when the table location changes
                m_stream.PropertiesTable.PropertyChanged += new PropertyChangedEventHandler(PropertiesTable_PropertyChanged);

                // Add it to the canvas and set it up
                m_canvas.AddNewChild(m_table as UIElement);

                UserControl tableAsUiElement = m_table as UserControl;

                //This sets the tables index to the greatest so it will be above everything
                tableAsUiElement.SetValue(System.Windows.Controls.Canvas.ZIndexProperty, 3);

                tableAsUiElement.MouseLeftButtonDown += new MouseButtonEventHandler((canvas as DrawingCanvas).MouseLeftButtonDownHandler);
                tableAsUiElement.MouseLeftButtonUp   += new MouseButtonEventHandler((canvas as DrawingCanvas).MouseLeftButtonUpHandler);

                // Hook up event listeners to the stream if non-null. We need to monitor:
                //  1. Changes in the comment collection
                //  2. Changes to the source process units properties (position)
                //  3. Changes to the destination process units properties (position)
                //  4. Changes to the source or destination references

                // 1.
                // Setup the event listener for the comment collection. It is the responsibility of this
                // control to create and manage the sticky note controls for its comments
                m_stream.Comments.CollectionChanged += Comments_CollectionChanged;
                // Invoke the callback to create sticky notes for comments
                Comments_CollectionChanged(m_stream.Comments, null);

                // 2.
                if (null != stream.Source)
                {
                    m_sourceEventItem              = stream.Source;
                    stream.Source.PropertyChanged += this.SourceOrDest_PropertyChanged;
                }

                // 3.
                if (null != stream.Destination)
                {
                    m_destEventItem = stream.Destination;
                    stream.Destination.PropertyChanged += this.SourceOrDest_PropertyChanged;
                }

                // 4.
                stream.PropertyChanged += new PropertyChangedEventHandler(Stream_PropertyChanged);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Detete All again
 /// </summary>
 public override void Redo(DrawingCanvas drawingCanvas)
 {
     drawingCanvas.GraphicsList.Clear();
 }
 public ResizeCommand(DrawingCanvas canvas, DrawingObject drawingObject, Point translationPoint, int x, int y) : base(canvas, drawingObject, x, y)
 {
     transPoint = translationPoint;
 }
Esempio n. 5
0
 // Call this function AFTER operation.
 public void NewState(DrawingCanvas drawingCanvas)
 {
     // Keep objects state after operation.
     FillList(drawingCanvas.GraphicsList, ref listAfter);
 }
Esempio n. 6
0
 public ResizingStickyNote(DrawingCanvas canvas, StickyNote note)
 {
     m_canvas = canvas;
     m_note   = note;
 }
 internal void init(DrawingCanvas canvas)
 {
     this.canvas = canvas;
    
 }
Esempio n. 8
0
 /// <summary>
 /// 反序列化
 /// </summary>
 /// <returns></returns>
 public abstract DrawGeometryBase Deserialize(DrawingCanvas drawingCanvas);
Esempio n. 9
0
 public void constructionContinuing(PaintObject temporaryObject)
 {
     DrawingCanvas.setTemporaryObject(temporaryObject); //
 }
Esempio n. 10
0
 public void constructionBeginning(PaintObject temporaryObject)
 {
     //((PaintCanvas)DrawingCanvas).setTemporaryObject(temporaryObject);
     DrawingCanvas.setTemporaryObject(temporaryObject);
 }
Esempio n. 11
0
        private void InitializeComponent()
        {
            // Create the content with a menu and a canvas
            panel   = new StackPanel();
            Content = panel;

            // Add menu
            InitMenu();

            grid        = new Grid();
            grid.Margin = new Thickness(5);
            panel.Children.Add(grid);

            // Set row definitions.
            RowDefinition rowdef = new RowDefinition();

            rowdef.Height = GridLength.Auto;
            grid.RowDefinitions.Add(rowdef);

            rowdef        = new RowDefinition();
            rowdef.Height = GridLength.Auto;
            grid.RowDefinitions.Add(rowdef);

            // Add a button row on top
            StackPanel buttons = new StackPanel()
            {
                Orientation = Orientation.Horizontal, Background = Brushes.CornflowerBlue, Height = 30
            };
            Button aButton = new Button();

            //aButton.Name = "start";
            aButton.Content = "Start";
            aButton.Margin  = new Thickness(5);
            aButton.Click  += StartClicked;
            buttons.Children.Add(aButton);

            aButton = new Button();
            //aButton.Name = "stop";
            aButton.Content = "Stop";
            aButton.Margin  = new Thickness(5);
            aButton.Click  += StopClicked;
            buttons.Children.Add(aButton);
            grid.Children.Add(buttons);
            Grid.SetRow(buttons, 0);

            // Add a view box at the bottom
            view = new Viewbox();
            view.HorizontalAlignment = HorizontalAlignment.Left;
            grid.Children.Add(view);
            Grid.SetRow(view, 1);

            canvas = new DrawingCanvas()
            {
                Background = Brushes.White
            };
            view.Child = canvas;
            SetCanvasSize(DefaultSize, DefaultSize);

            // Set up other properties
            Title = "Minimal Window";
            Top   = 60;
            Left  = 60;

            SizeToContent = SizeToContent.WidthAndHeight;
        }
Esempio n. 12
0
 public void Initialize()
 {
     drawing = new DrawingCanvas();
 }
Esempio n. 13
0
 internal void init(DrawingCanvas canvas)
 {
     this.canvas = canvas;
 }
Esempio n. 14
0
        public DraggableStreamEndpoint(EndpointType endpointType, StreamControl owner, DrawingCanvas canvas)
        {
            InitializeComponent();

            m_id = s_idCounter;
            s_idCounter++;

            m_canvas = canvas;
            m_owner  = owner;
            m_type   = endpointType;

            // Initialize the icon
            RebuildIcon();
        }
Esempio n. 15
0
        public override void OnMouseUp(DrawingCanvas drawingCanvas, Point position)
        {
            newPolyLine = null;

            base.OnMouseUp(drawingCanvas, position);
        }
 public ChangeBorderCommand(DrawingCanvas canvas, DrawingObject drawing, Color color) : base(canvas, drawing, color)
 {
 }
Esempio n. 17
0
 public void constructionComplete(PaintObject finalObject)
 {
     DrawingCanvas.setTemporaryObject(null);
     DrawingCanvas.addPaintObject(finalObject);
 }
Esempio n. 18
0
 public void hoveringOverConstructionArea(PaintObject hoverObject)
 {
     DrawingCanvas.setHoveringObject(hoverObject);
 }
Esempio n. 19
0
 // Create this command BEFORE operation.
 public CommandChangeState(DrawingCanvas drawingCanvas)
 {
     // Keep objects state before operation.
     FillList(drawingCanvas.GraphicsList, ref listBefore);
 }
        internal void setDrawingCanvas(DrawingCanvas drawingCanvas)
        {
            this.canvas = drawingCanvas;

            //now can run some init script...
            initConfig();



        }
Esempio n. 21
0
        public UndoManager(DrawingCanvas drawingCanvas)
        {
            this.drawingCanvas = drawingCanvas;

            ClearHistory();
        }