Exemple #1
0
        /// <summary>
        /// Create a shape viewwmodel that represents a canvas element.
        /// </summary>
        /// <param name="dropPoint"></param>
        /// <returns></returns>
        private static ShapeViewModelBase CreateAssocationShapeViewModel(Point dropPoint,
                                                                         IShapeParent parent,
                                                                         DataDef item,
                                                                         UmlTypes umlType)
        {
            var element = new UmlUseCaseShapeViewModel(parent, umlType);

            switch (umlType)
            {
            case UmlTypes.ConnectorAggregation:
                return(new UmlAssociationShapeViewModel(parent, ConnectorKeys.WhiteDiamond, ConnectorKeys.None, UmlTypes.ConnectorAggregation));

            case UmlTypes.ConnectorAssociation:
                return(new UmlAssociationShapeViewModel(parent, ConnectorKeys.None, ConnectorKeys.None, UmlTypes.ConnectorAssociation));

            case UmlTypes.ConnectorComposition:
                return(new UmlAssociationShapeViewModel(parent, ConnectorKeys.BlackDiamond, ConnectorKeys.None, UmlTypes.ConnectorComposition));

            case UmlTypes.ConnectorInheritance:
                return(new UmlAssociationShapeViewModel(parent, ConnectorKeys.None, ConnectorKeys.Triangle, UmlTypes.ConnectorInheritance));

            default:
                throw new System.NotImplementedException(umlType.ToString());
            }
        }
Exemple #2
0
        public Form1()
        {
            InitializeComponent();
            this.Location = new Point(Screen.PrimaryScreen.Bounds.Width - this.Width, 0);
            Refresh();
            //System.Windows.SystemParameters.PrimaryScreenWidth
            DataFrame ddx = new DataFrame();

            Byte[]    qq  = DataDef.SerializeToBytes(ddx);
            DataFrame dfx = (DataFrame)DataDef.DeserializeFromBytes(qq);

            Byte[] _qqbu = new Byte[5];
            _qqbu[4] = 99;
            using (BinaryReader br = new BinaryReader(new MemoryStream()))
            {
                br.BaseStream.Write(_qqbu, 0, 5);
                br.BaseStream.Seek(0, SeekOrigin.Begin);
                ddx.SetDataFrom(br);
            }



            //_client.GetDeliveryACK((ushort) 1);
            //_client.ResponseAuthenticaction((ushort)1);


            //RTU_TY _rtu = new RTU_TY_Rev1("COM1");
            //_rtu.RTUReceived += _rtu_RTUReceived;
            //_rtu.OnRTUReceived(EventArgs.Empty);
        }
Exemple #3
0
        /// <summary>
        /// Create a shape viewwmodel that represents a canvas element.
        /// </summary>
        /// <param name="dropPoint"></param>
        /// <returns></returns>
        private static ShapeViewModelBase CreateCanvasShapeViewModel(Point dropPoint,
                                                                     IShapeParent parent,
                                                                     DataDef item,
                                                                     UmlTypes umlType)
        {
            var element = new UmlCanvasShapeViewModel(parent, item.ShapeViewModelSubKey, umlType);

            element.Name   = item.ShapeName;
            element.Top    = dropPoint.Y;
            element.Left   = dropPoint.X;
            element.Width  = item.DefaultWidth;
            element.Height = item.DefaultHeight;

            return(element);
        }
Exemple #4
0
        /// <summary>
        /// Create a shape viewwmodel that represents a canvas element.
        /// </summary>
        /// <param name="dropPoint"></param>
        /// <returns></returns>
        private static ShapeViewModelBase CreateNoteShapeViewModel(Point dropPoint,
                                                                   IShapeParent parent,
                                                                   DataDef item,
                                                                   UmlTypes umlType)
        {
            var element = new UmlNoteShapeViewModel(parent, umlType);

            element.Text   = item.ToolboxName;
            element.Top    = dropPoint.Y;
            element.Left   = dropPoint.X;
            element.Width  = item.DefaultWidth;
            element.Height = item.DefaultHeight;

            return(element);
        }
Exemple #5
0
        /// <summary>
        /// Create a shape viewwmodel that represents a canvas element.
        /// </summary>
        /// <param name="dropPoint"></param>
        /// <returns></returns>
        private static ShapeViewModelBase CreateUseCaseShapeViewModel(Point dropPoint,
                                                                      IShapeParent parent,
                                                                      DataDef item,
                                                                      UmlTypes umlType)
        {
            var element = new UmlUseCaseShapeViewModel(parent, umlType);

            element.Name            = item.ShapeName;
            element.Top             = dropPoint.Y;
            element.Left            = dropPoint.X;
            element.Width           = item.DefaultWidth;
            element.Height          = item.DefaultHeight;
            element.StrokeDashArray = (item.StrokeDashArray == null ? string.Empty : item.StrokeDashArray);

            return(element);
        }
Exemple #6
0
        /// <summary>
        /// Create a shape viewwmodel that represents a canvas element.
        /// </summary>
        /// <param name="dropPoint"></param>
        /// <returns></returns>
        private static ShapeViewModelBase CreateNodeShapeViewModel(Point dropPoint,
                                                                   IShapeParent parent,
                                                                   DataDef item,
                                                                   UmlTypes umlType)
        {
            var element = new UmlNodeShapeViewModel(parent, umlType);

            element.Stereotype    = item.ShapeStereotype == null ? string.Empty : item.ShapeStereotype;
            element.Name          = item.ShapeName;
            element.ShapeImageUrl = item.ShapeImageUrl == null ? string.Empty : item.ShapeImageUrl;
            element.Top           = dropPoint.Y;
            element.Left          = dropPoint.X;
            element.Width         = item.DefaultWidth;
            element.Height        = item.DefaultHeight;

            return(element);
        }
Exemple #7
0
        /// <summary>
        /// Create a shape viewwmodel that represents a canvas element.
        /// </summary>
        /// <param name="dropPoint"></param>
        /// <returns></returns>
        private static ShapeViewModelBase CreateDecisionShapeViewModel(Point dropPoint,
                                                                       IShapeParent parent,
                                                                       DataDef item,
                                                                       UmlTypes umlType)
        {
            var element = new UmlDecisionShapeViewModel(parent, umlType);

            element.Name = item.ShapeName;

            if (dropPoint == null)
            {
                dropPoint = new Point(100, 100);
            }

            element.Top  = dropPoint.Y;
            element.Left = dropPoint.X;

            element.Width  = item.DefaultWidth;
            element.Height = item.DefaultHeight;

            return(element);
        }