public WorkspaceActionEventArgs(CanvasInfo canvasInfo,DesignItemInfo[] designItemInfos, DesignConnectionInfo[] designConnectionInfos)
     : base()
 {
     this._CanvasInfo = canvasInfo;
     this._designItemInfos = designItemInfos;
     this._designConnectionInfos = designConnectionInfos;
 }
 public virtual void RaiseModifyingDesignShapes(DesignItemInfo[] designItemInfos, DesignConnectionInfo[] designConnectionInfos)
 {
     if (ModifyingDesignShapes != null)
     {
         ModifyingDesignShapes(this, new MultiDesignShapeActionEventArgs(designItemInfos, designConnectionInfos));
     }
 }
 public void LoadDesignInfo(CanvasInfo canvasInfo, DesignItemInfo[] designItemInfos, DesignConnectionInfo[] designConnectionInfos)
 {
     this.canvas.LoadDesignInfo(canvasInfo, designItemInfos, designConnectionInfos);
 }
 public virtual void RaiseDesignShapeMultiSelected(DesignItemInfo[] designItemInfos, DesignConnectionInfo[] designConnectionInfos)
 {
     if (DesignShapeMultiSelected != null)
     {
         DesignShapeMultiSelected(this, new MultiDesignShapeActionEventArgs(designItemInfos, designConnectionInfos));
     }
 }
 public virtual void RaiseDesignWorkspaceSaving(CanvasInfo canvasInfo, DesignItemInfo[] designItemInfos, DesignConnectionInfo[] designConnectionInfos)
 {
     if (DesignWorkspaceSaving != null)
     {
         DesignWorkspaceSaving(this, new WorkspaceActionEventArgs(canvasInfo, designItemInfos, designConnectionInfos));
     }
 }
 public virtual void RaiseDesignConnectionMouseRightClick(DesignConnectionInfo designConnectionInfo)
 {
     if (DesignConnectionMouseRightClick != null)
     {
         DesignConnectionMouseRightClick(this, new SingleDesignConnectionActionEventArgs(designConnectionInfo));
     }
 }
 public virtual void RaiseDesignConnectionSelected(DesignConnectionInfo designConnectionInfo)
 {
     if (DesignConnectionSelected != null)
     {
         DesignConnectionSelected(this, new SingleDesignConnectionActionEventArgs(designConnectionInfo));
     }
 }
 public virtual void RaiseAddedDesignConnection(DesignConnectionInfo designConnectionInfo)
 {
     if (AddedDesignConnection != null)
     {
         AddedDesignConnection(this, new SingleDesignConnectionActionEventArgs(designConnectionInfo));
     }
 }
 public SingleDesignConnectionActionEventArgs(DesignConnectionInfo designConnection)
     : base()
 {
     this._designConnection = designConnection;
 }
 public void LoadDesignInfo(CanvasInfo canvasInfo, DesignItemInfo[] designItemInfos, DesignConnectionInfo[] designConnectionInfos)
 {
     var originalDesignItemInfos = new List<DesignItemInfo>();
     var originalDesignConnectionInfos = new List<DesignConnectionInfo>();
     var designItemInfo = (DesignItemInfo)null;
     var designConnectionInfo = (DesignConnectionInfo)null;
     foreach (var item in designItemInfos)
     {
         designItemInfo = new DesignItemInfo();
         designItemInfo.ShapeType = ShapeType.DesignItem;
         designItemInfo.ShapeCategory = item.ShapeCategory;
         designItemInfo.SerialNo = item.SerialNo;
         designItemInfo.GroupID = item.GroupID;
         designItemInfo.IsInGroup = item.IsInGroup;
         designItemInfo.StyleKey = item.StyleKey;
         designItemInfo.Style = item.Style;
         designItemInfo.ToolTip = item.ToolTip;
         designItemInfo.IsChecked = item.IsChecked;
         designItemInfo.IsEnabled = item.IsEnabled;
         designItemInfo.Text = item.Text;
         designItemInfo.ID = item.ID;
         designItemInfo.ZIndex = item.ZIndex;
         designItemInfo.DesignInfo.Backgroud = item.DesignInfo.Backgroud;
         designItemInfo.DesignInfo.Foreground = item.DesignInfo.Foreground;
         designItemInfo.DesignInfo.FontSize = item.DesignInfo.FontSize;
         designItemInfo.DesignInfo.Bold = item.DesignInfo.Bold;
         designItemInfo.DesignInfo.Italic = item.DesignInfo.Italic;
         designItemInfo.DesignInfo.HorizontalAlignment = item.DesignInfo.HorizontalAlignment;
         designItemInfo.DesignInfo.VerticalAlignment = item.DesignInfo.VerticalAlignment;
         designItemInfo.ParentID = item.ParentID;
         designItemInfo.X = item.X;
         designItemInfo.Y = item.Y;
         designItemInfo.Width = item.Width;
         designItemInfo.Height = item.Height;
         originalDesignItemInfos.Add(designItemInfo);
     }
     foreach (var item in designConnectionInfos)
     {
         designConnectionInfo = new DesignConnectionInfo();
         designConnectionInfo.ShapeType = ShapeType.DesignItem;
         designConnectionInfo.ShapeCategory = item.ShapeCategory;
         designConnectionInfo.SerialNo = item.SerialNo;
         designConnectionInfo.GroupID = item.GroupID;
         designConnectionInfo.IsInGroup = item.IsInGroup;
         designConnectionInfo.StyleKey = item.StyleKey;
         designConnectionInfo.Style = item.Style;
         designConnectionInfo.ToolTip = item.ToolTip;
         designConnectionInfo.IsChecked = item.IsChecked;
         designConnectionInfo.IsEnabled = item.IsEnabled;
         designConnectionInfo.Text = item.Text;
         designConnectionInfo.ID = item.ID;
         designConnectionInfo.ZIndex = item.ZIndex;
         designConnectionInfo.DesignInfo.Backgroud = item.DesignInfo.Backgroud;
         designConnectionInfo.DesignInfo.Foreground = item.DesignInfo.Foreground;
         designConnectionInfo.DesignInfo.FontSize = item.DesignInfo.FontSize;
         designConnectionInfo.DesignInfo.Bold = item.DesignInfo.Bold;
         designConnectionInfo.DesignInfo.Italic = item.DesignInfo.Italic;
         designConnectionInfo.DesignInfo.HorizontalAlignment = item.DesignInfo.HorizontalAlignment;
         designConnectionInfo.DesignInfo.VerticalAlignment = item.DesignInfo.VerticalAlignment;
         designConnectionInfo.SourceID = item.SourceID;
         designConnectionInfo.SourceOrientation = item.SourceOrientation;
         designConnectionInfo.SinkID = item.SinkID;
         designConnectionInfo.SinkOrientation = item.SinkOrientation;
         designConnectionInfo.PathGeometry = item.PathGeometry;
         originalDesignConnectionInfos.Add(designConnectionInfo);
     }
     this.OriginalDesignItemInfos = this.OriginalDesignItemInfos;
     this.OriginalDesignConnectionInfos = this.OriginalDesignConnectionInfos;
     this.CurrentDesignItemInfos.AddRange(this.OriginalDesignItemInfos);
     this.RaiseDesignItemCollectionChanged(this.CurrentDesignItemInfos.ToArray());
 }
 public MultiDesignShapeActionEventArgs(DesignItemInfo[] designItemInfos, DesignConnectionInfo[] designConnectionInfos)
     : base()
 {
     this._designItemInfos = designItemInfos;
     this._designConnectionInfos = designConnectionInfos;
 }
Exemple #12
0
        public Connection(Connector source, Connector sink,ConnectionShapeInfo connectionShapeInfo=null)
        {
            var connectionShapInfo = connectionShapeInfo;
            var designConnectionInfo = (DesignConnectionInfo)null;
            if (connectionShapeInfo != null)
            {
                designConnectionInfo=new DesignConnectionInfo(connectionShapInfo);
            }
            else
            {
                var shapInfo = new ConnectionShapeInfo();
                designConnectionInfo = new DesignConnectionInfo(shapInfo);
            }
            var currentDate = DateTime.Now;
            designConnectionInfo.CreateDate = currentDate;
            designConnectionInfo.ModifyDate = currentDate;
            designConnectionInfo.SourceID = source.ParentDesignItem.ID;
            designConnectionInfo.SourceOrientation = source.Orientation;
            designConnectionInfo.SinkID = sink.ParentDesignItem.ID;
            designConnectionInfo.SinkOrientation = sink.Orientation;
            this.ShapeInfoUnit = new ConnectionShapeInfoUnit(designConnectionInfo);
            if (designConnectionInfo.SourceSvgBuffer != null)
            {
                using (var stream = new MemoryStream(designConnectionInfo.SourceSvgBuffer))
                {
                    (this.ShapeInfoUnit as ConnectionShapeInfoUnit).SourceSvgDrawing = SvgHelper.CreateSvgViewBox(stream);
                }
            }
            if (designConnectionInfo.SinkSvgBuffer != null)
            {
                using (var stream = new MemoryStream(designConnectionInfo.SinkSvgBuffer))
                {
                    (this.ShapeInfoUnit as ConnectionShapeInfoUnit).SinkSvgDrawing = SvgHelper.CreateSvgViewBox(stream);
                }
            }
            this.SetBinding(Connection.TextProperty, BindingHelper.CreateBinding(designConnectionInfo, "Text"));
            this.SetBinding(DesignCanvas.ZIndexProperty, BindingHelper.CreateBinding(designConnectionInfo, "ZIndex"));
            designConnectionInfo.PropertyChanged += (obj, e) =>
            {
                if (e.PropertyName.Equals("PathGeometry"))
                {
                    UpdateAnchorPosition();
                }
            };

            this.ID = Guid.NewGuid();
            this.Source = source;
            this.Sink = sink;
            //base.Unloaded += new RoutedEventHandler(Connection_Unloaded); //Resolve the issue of swithing tabItem
            base.SelectChanged += (a, b) =>
            {
                if (this.IsSelected) ShowAdorner();
                else HideAdorner();
            };
        }