Exemplo n.º 1
0
        public override bool Prepare(Node node)
        {
            var typeMethods = node.inputPorts[0].GetDataList <TypeMethod>();
            var methods     = typeMethods.ConvertAll(t => t.method);
            var targets     = node.inputPorts[2].GetDataList <SavedList <ItemPos <TargetT> > >();

            for (int i = 0; i < methods.Count; i++)
            {
                var method = methods[i];
                if (!NodeUtility.methodInstructionOffset.TryGetValue(method, out var offsets))
                {
                    continue;
                }
                for (int j = 0; j < targets[i].Count; j++)
                {
                    var target    = targets[i][j];
                    var targetPos = target.pos;
                    foreach (var offset in offsets)
                    {
                        if (targetPos >= offset.pos)
                        {
                            targetPos += offset.offset;
                        }
                    }
                    targets[i][j] = new ItemPos <TargetT>(targetPos, target.target);
                }
            }
            node.inputPorts[2].SetData(targets);
            return(base.Prepare(node));
        }
Exemplo n.º 2
0
 public Task(uint fileLine, string name, uint line, int process, ItemPos pos)
 {
     this.mName 		= name;
     this.mLine 		= line;
     this.mProcess 	= process;
     this.mItemPen 	= new Pen(Color.Black, 1);
     this.mFileLine 	= fileLine;
     this.mPos		= pos;
 }
Exemplo n.º 3
0
 public ItemVerticalLine(uint line, int process, string identifier, ItemPos placement, ItemStyle itemstyle)
 {
     this.mLineBeginn 		= line;
     this.mProcess 			= process;
     this.mLineEnd 			= 0;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mPos 				= placement;
     this.mItemStyle 		= itemstyle;
     this.mIdentifier		= identifier;
 }
Exemplo n.º 4
0
 public ItemVerticalLine(uint line, int process, string identifier)
 {
     this.mLineBeginn 		= line;
     this.mProcess 			= process;
     this.mLineEnd 			= 0;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mPos 				= ItemPos.Left;
     this.mItemStyle 		= ItemStyle.Normal;
     this.mIdentifier		= identifier;
 }
Exemplo n.º 5
0
 public SetTimer(uint fileLine, uint line, int process)
 {
     this.mName 				= "";
     this.mLine 				= line;
     this.mProcess 			= process;
     this.mInitialHeight 	= 20;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mPos 				= ItemPos.Left;
     this.mFileLine 			= fileLine;
 }
Exemplo n.º 6
0
 public SetTimer(uint fileLine, string name, uint line, int process, ItemPos placement)
 {
     this.mName 				= name;
     this.mLine 				= line;
     this.mProcess 			= process;
     this.mInitialHeight 	= 20;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mPos 				= placement;
     this.mFileLine 			= fileLine;
 }
Exemplo n.º 7
0
 public TimeoutStop(uint fileLine, string name, uint line, int process)
 {
     this.mName 				= name;
     this.mLine 				= line;
     this.mProcess 			= process;
     this.mInitialHeight 	= 10;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mPos 				= ItemPos.Left;
     this.mItemStyle 		= ItemStyle.Normal;
 }
Exemplo n.º 8
0
 public State(uint fileLine, string name, uint line, int process)
 {
     this.mName 			= name;
     this.mLine 			= line;
     this.mProcess 		= new int[1]{process};
     this.mItemPen 		= new Pen(Color.Black, 1);
     this.mStyle 		= StateStyle.Box;
     this.mFileLine 		= fileLine;
     this.mPos			= ItemPos.Top;
 }
Exemplo n.º 9
0
 public StopTimer(uint fileLine, string name, uint line, int process)
 {
     this.mName 				= name;
     this.mLine 				= line;
     this.mProcess 			= process;
     this.mInitialHeight 	= STOPXSIZE;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mPos 				= ItemPos.Left;
     this.mFileLine 			= fileLine;
 }
Exemplo n.º 10
0
 public TimeoutBegin(uint fileLine, string name, uint line, int process, ItemPos placement)
 {
     this.mName 				= name;
     this.mLine 				= line;
     this.mProcess 			= process;
     this.mInitialHeight 	= 10;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mPos 				= placement;
     this.mFileLine 			= fileLine;
     this.mItemStyle 		= ItemStyle.Normal;
 }
Exemplo n.º 11
0
    private void LineDestroy(ItemPos linePos,
                             Sprite line,
                             ItemPos[] destroyedPos)
    {
        Sprite[] destroyedSprites = destroyedPos
                                    .Select(p => _scene.ItemSprites[p.Pos.X, p.Pos.Y])
                                    .ToArray();

        var d1Body = (Node2D)_animTemplate.Duplicate();
        var d1     = new Destroyer(destroyedSprites, d1Body);

        line.GetParent().AddChild(d1);
        d1.Position = line.Position;
        //
        if (linePos.Item.Shape == ItemShape.VLine)
        {
            d1.RotationDegrees = 90f;
        }

        d1.Visible = true;

        var d2Body = (Node2D)_animTemplate.Duplicate();
        var d2     = new Destroyer(destroyedSprites, d2Body);

        line.GetParent().AddChild(d2);
        d2.Position = line.Position;
        //
        if (linePos.Item.Shape == ItemShape.HLine)
        {
            d2.RotationDegrees = 180f;
        }
        else if (linePos.Item.Shape == ItemShape.VLine)
        {
            d2.RotationDegrees = -90f;
        }

        d2.Visible = true;

        line.Visible = false; // removed later in Exec

        if (linePos.Item.Shape == ItemShape.HLine)
        {
            DestroyerLMovTween(d1);
            DestroyerRMovTween(d2);
        }
        else if (linePos.Item.Shape == ItemShape.VLine)
        {
            DestroyerUMovTween(d1);
            DestroyerDMovTween(d2);
        }

        d1.Connect(nameof(Destroyer.HitSignal), this, nameof(OnDestroyerHit));
        d2.Connect(nameof(Destroyer.HitSignal), this, nameof(OnDestroyerHit));
    }
Exemplo n.º 12
0
 public static void RepertoryImage(Graphics drawDestination, ItemPos pos)
 {
     StringFormat itemStringFormat = new StringFormat();
     RectangleF itemBox = new RectangleF(10, 30, 60, 20);
     itemStringFormat.Alignment = StringAlignment.Center;
     itemStringFormat.LineAlignment = StringAlignment.Center;
     drawDestination.DrawLine(Pens.DarkGray,40,10,40,70);
     drawDestination.FillRectangle(Brushes.White,10,30,60,20);
     drawDestination.DrawString("Task",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
     drawDestination.DrawRectangle(Pens.Black,10,30,60,20);
     itemStringFormat.Dispose();
 }
Exemplo n.º 13
0
 public TimerEnd(uint fileLine, uint line, string identifier, int process, ItemPos placement, ItemStyle iStyle)
 {
     this.mName 				= "";
     this.mLine 				= line;
     this.mProcess 			= process;
     this.mInitialHeight 	= 10;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mPos 				= placement;
     this.mFileLine 			= fileLine;
     this.mItemStyle 		= iStyle;
     this.mIdentifier		= identifier;
     this.mTimerStyle		= TimerStyle.End;
 }
Exemplo n.º 14
0
 public TimerEndProp(ItemPos pos, ItemStyle style)
 {
     //
     // The InitializeComponent() call is required for Windows Forms designer support.
     //
     InitializeComponent();
     SetSize();
     this.tabOptions.SelectedIndex = 2;
     mItemStyle = style;
     mItemPos = pos;
     DrawPropertyImage();
     this.hlpProvider.SetHelpKeyword(this.tabOptions, "dlgTimerEnd");
     this.hlpProvider.SetHelpNavigator(this.tabOptions, HelpNavigator.KeywordIndex);
 }
Exemplo n.º 15
0
        private static ItemPos GetItemPos(PlacementOperation operation, DesignItem designItem)
        {
            var itemPos = new ItemPos()
            {
                DesignItem = designItem
            };

            var pos = operation.CurrentContainerBehavior.GetPosition(operation, designItem);

            itemPos.Xmin = pos.X;
            itemPos.Xmax = pos.X + pos.Width;
            itemPos.Ymin = pos.Y;
            itemPos.Ymax = pos.Y + pos.Height;

            return(itemPos);
        }
Exemplo n.º 16
0
    private async Task DestroyItem(ItemPos dPos, float delay)
    {
        Sprite sprite = _sprites[dPos.Pos.X, dPos.Pos.Y];

        if (dPos.Item.IsRegularShape)
        {
            RegularDestroyTween(sprite, delay);
        }
        else if (dPos.Item.IsBombShape)
        {
            await BombDestroy(dPos.Item.Color, sprite, _act.DestroyedBy[dPos]);
        }
        else if (dPos.Item.IsLineShape)
        {
            LineDestroy(dPos, sprite, _act.DestroyedBy[dPos]);
        }
    }
Exemplo n.º 17
0
        public static void RepertoryImage(Graphics drawDestination, ItemPos position)
        {
            StringFormat itemStringFormat = new StringFormat();
            if (position == ItemPos.Left){
                drawDestination.DrawLine(Pens.DarkGray,70,10,70,70);
                RectangleF itemBox = new RectangleF(15, 10, 60, 12);
                itemStringFormat.Alignment = StringAlignment.Near;
                itemStringFormat.LineAlignment = StringAlignment.Near;
                drawDestination.DrawLine(Pens.Black,15,30,70,30);
                PointF[] capPolygon = new PointF[3];
                capPolygon[0] = new PointF(15, 30);
                capPolygon[1] = new PointF(10, 25);
                capPolygon[2] = new PointF(20, 25);
                drawDestination.DrawPolygon(Pens.Black,capPolygon);
                capPolygon[0] = new PointF(15, 30);
                capPolygon[1] = new PointF(10, 35);
                capPolygon[2] = new PointF(20, 35);
                drawDestination.DrawPolygon(Pens.Black,capPolygon);
                drawDestination.DrawString("SetTimer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);

            }
            else if (position == ItemPos.Right){
                drawDestination.DrawLine(Pens.DarkGray,10,10,10,70);
                RectangleF itemBox = new RectangleF(10, 10, 60, 12);
                itemStringFormat.Alignment = StringAlignment.Near;
                itemStringFormat.LineAlignment = StringAlignment.Near;
                drawDestination.DrawLine(Pens.Black,10,30,65,30);
                PointF[] capPolygon = new PointF[3];
                capPolygon[0] = new PointF(65, 30);
                capPolygon[1] = new PointF(70, 25);
                capPolygon[2] = new PointF(60, 25);
                drawDestination.DrawPolygon(Pens.Black,capPolygon);
                capPolygon[0] = new PointF(65, 30);
                capPolygon[1] = new PointF(70, 35);
                capPolygon[2] = new PointF(60, 35);
                drawDestination.DrawPolygon(Pens.Black,capPolygon);
                drawDestination.DrawString("SetTimer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
            }
            itemStringFormat.Dispose();
        }
Exemplo n.º 18
0
 public static void RepertoryImage(Graphics drawDestination, ItemPos pos, ItemStyle style, MscStyle style2, TimerStyle tStyle)
 {
     StringFormat itemStringFormat = new StringFormat();
     if (style2 == MscStyle.UML2){
         if (pos == ItemPos.Left){
             if(style == ItemStyle.Normal){
                 RectangleF itemBox = new RectangleF(10,40,65,20);
                 itemStringFormat.Alignment = StringAlignment.Far;
                 drawDestination.DrawLine(Pens.DarkGray,85,10,85,70);
                 drawDestination.DrawLine(Pens.Black,70,60,85,60);
                 drawDestination.DrawLine(Pens.Black,75,10,75,60);
                 if (tStyle == TimerStyle.End){
                     drawDestination.DrawLine(Pens.Black,75,59,72,53);
                     drawDestination.DrawLine(Pens.Black,75,59,78,53);
                 }
                 else if (tStyle == TimerStyle.Break){
                     drawDestination.DrawLine(Pens.Black,70,55,80,65);
                     drawDestination.DrawLine(Pens.Black,70,65,80,55);
                 }
                 drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
             }
             else if(style == ItemStyle.ExtendedOuter){
                 RectangleF itemBox = new RectangleF(0,40,35,20);
                 itemStringFormat.Alignment = StringAlignment.Far;
                 drawDestination.DrawLine(Pens.DarkGray,85,10,85,70);
                 drawDestination.DrawLine(Pens.Black,30,60,85,60);
                 drawDestination.DrawLine(Pens.Black,35,10,35,60);
                 if (tStyle == TimerStyle.End){
                     drawDestination.DrawLine(Pens.Black,35,59,32,53);
                     drawDestination.DrawLine(Pens.Black,35,59,38,53);
                 }
                 else if (tStyle == TimerStyle.Break){
                     drawDestination.DrawLine(Pens.Black,30,55,40,65);
                     drawDestination.DrawLine(Pens.Black,30,65,40,55);
                 }
                 drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
             }
             else if(style == ItemStyle.ExtendedInner){
                 RectangleF itemBox = new RectangleF(36,40,35,20);
                 itemStringFormat.Alignment = StringAlignment.Near;
                 drawDestination.DrawLine(Pens.DarkGray,85,10,85,70);
                 drawDestination.DrawLine(Pens.Black,30,60,85,60);
                 drawDestination.DrawLine(Pens.Black,35,10,35,60);
                 if (tStyle == TimerStyle.End){
                     drawDestination.DrawLine(Pens.Black,35,59,32,53);
                     drawDestination.DrawLine(Pens.Black,35,59,38,53);
                 }
                 else if (tStyle == TimerStyle.Break){
                     drawDestination.DrawLine(Pens.Black,30,55,40,65);
                     drawDestination.DrawLine(Pens.Black,30,65,40,55);
                 }
                 drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
             }
         }
         else if (pos == ItemPos.Right){
             if(style == ItemStyle.Normal){
                 RectangleF itemBox = new RectangleF(25,40,65,20);
                 itemStringFormat.Alignment = StringAlignment.Near;
                 drawDestination.DrawLine(Pens.DarkGray,15,10,15,70);
                 drawDestination.DrawLine(Pens.Black,15,60,30,60);
                 drawDestination.DrawLine(Pens.Black,25,10,25,60);
                 if (tStyle == TimerStyle.End){
                     drawDestination.DrawLine(Pens.Black,25,59,22,53);
                     drawDestination.DrawLine(Pens.Black,25,59,28,53);
                 }
                 else if (tStyle == TimerStyle.Break){
                     drawDestination.DrawLine(Pens.Black,20,55,30,65);
                     drawDestination.DrawLine(Pens.Black,20,65,30,55);
                 }
                 drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
             }
             else if(style == ItemStyle.ExtendedOuter){
                 RectangleF itemBox = new RectangleF(65,40,35,20);
                 itemStringFormat.Alignment = StringAlignment.Near;
                 drawDestination.DrawLine(Pens.DarkGray,15,10,15,70);
                 drawDestination.DrawLine(Pens.Black,15,60,70,60);
                 drawDestination.DrawLine(Pens.Black,65,10,65,60);
                 if (tStyle == TimerStyle.End){
                     drawDestination.DrawLine(Pens.Black,65,59,62,53);
                     drawDestination.DrawLine(Pens.Black,65,59,68,53);
                 }
                 else if (tStyle == TimerStyle.Break){
                     drawDestination.DrawLine(Pens.Black,60,55,70,65);
                     drawDestination.DrawLine(Pens.Black,60,65,70,55);
                 }
                 drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
             }
             else if(style == ItemStyle.ExtendedInner){
                 RectangleF itemBox = new RectangleF(0,40,65,20);
                 itemStringFormat.Alignment = StringAlignment.Far;
                 drawDestination.DrawLine(Pens.DarkGray,15,10,15,70);
                 drawDestination.DrawLine(Pens.Black,15,60,70,60);
                 drawDestination.DrawLine(Pens.Black,65,10,65,60);
                 if (tStyle == TimerStyle.End){
                     drawDestination.DrawLine(Pens.Black,65,59,62,53);
                     drawDestination.DrawLine(Pens.Black,65,59,68,53);
                 }
                 else if (tStyle == TimerStyle.Break){
                     drawDestination.DrawLine(Pens.Black,60,55,70,65);
                     drawDestination.DrawLine(Pens.Black,60,65,70,55);
                 }
                 drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
             }
         }
     }
     else if (style2 == MscStyle.SDL){
         if (pos == ItemPos.Left){
             if(style == ItemStyle.Normal){
                 RectangleF itemBox = new RectangleF(10,40,65,20);
                 itemStringFormat.Alignment = StringAlignment.Far;
                 drawDestination.DrawLine(Pens.DarkGray,85,10,85,70);
                 drawDestination.DrawLine(Pens.Black,75,60,85,60);
                 drawDestination.DrawLine(Pens.Black,75,10,75,60);
                 if (tStyle == TimerStyle.End){
                     PointF[] capPolygon = new PointF[3];
                     capPolygon[0] = new PointF(85, 60);
                     capPolygon[1] = new PointF(79, 57);
                     capPolygon[2] = new PointF(79, 63);
                     drawDestination.FillPolygon(Brushes.Black,capPolygon);
                 }
                 else if (tStyle == TimerStyle.Break){
                     drawDestination.DrawLine(Pens.Black,70,55,80,65);
                     drawDestination.DrawLine(Pens.Black,70,65,80,55);
                 }
                 drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
             }
             else if(style == ItemStyle.ExtendedOuter){
                 RectangleF itemBox = new RectangleF(0,40,35,20);
                 itemStringFormat.Alignment = StringAlignment.Far;
                 drawDestination.DrawLine(Pens.DarkGray,85,10,85,70);
                 drawDestination.DrawLine(Pens.Black,35,60,85,60);
                 drawDestination.DrawLine(Pens.Black,35,10,35,60);
                 if (tStyle == TimerStyle.End){
                     PointF[] capPolygon = new PointF[3];
                     capPolygon[0] = new PointF(85, 60);
                     capPolygon[1] = new PointF(79, 57);
                     capPolygon[2] = new PointF(79, 63);
                     drawDestination.FillPolygon(Brushes.Black,capPolygon);
                 }
                 else if (tStyle == TimerStyle.Break){
                     drawDestination.DrawLine(Pens.Black,30,55,40,65);
                     drawDestination.DrawLine(Pens.Black,30,65,40,55);
                 }
                 drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
             }
             else if(style == ItemStyle.ExtendedInner){
                 RectangleF itemBox = new RectangleF(36,40,35,20);
                 itemStringFormat.Alignment = StringAlignment.Near;
                 drawDestination.DrawLine(Pens.DarkGray,85,10,85,70);
                 drawDestination.DrawLine(Pens.Black,35,60,85,60);
                 drawDestination.DrawLine(Pens.Black,35,10,35,60);
                 if (tStyle == TimerStyle.End){
                     PointF[] capPolygon = new PointF[3];
                     capPolygon[0] = new PointF(85, 60);
                     capPolygon[1] = new PointF(79, 57);
                     capPolygon[2] = new PointF(79, 63);
                     drawDestination.FillPolygon(Brushes.Black,capPolygon);
                 }
                 else if (tStyle == TimerStyle.Break){
                     drawDestination.DrawLine(Pens.Black,30,55,40,65);
                     drawDestination.DrawLine(Pens.Black,30,65,40,55);
                 }
                 drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
             }
         }
         else if (pos == ItemPos.Right){
             if(style == ItemStyle.Normal){
                 RectangleF itemBox = new RectangleF(25,40,65,20);
                 itemStringFormat.Alignment = StringAlignment.Near;
                 drawDestination.DrawLine(Pens.DarkGray,15,10,15,70);
                 drawDestination.DrawLine(Pens.Black,15,60,25,60);
                 drawDestination.DrawLine(Pens.Black,25,10,25,60);
                 if (tStyle == TimerStyle.End){
                     PointF[] capPolygon = new PointF[3];
                     capPolygon[0] = new PointF(15, 60);
                     capPolygon[1] = new PointF(21, 57);
                     capPolygon[2] = new PointF(21, 63);
                     drawDestination.FillPolygon(Brushes.Black,capPolygon);
                 }
                 else if (tStyle == TimerStyle.Break){
                     drawDestination.DrawLine(Pens.Black,20,55,30,65);
                     drawDestination.DrawLine(Pens.Black,20,65,30,55);
                 }
                 drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
             }
             else if(style == ItemStyle.ExtendedOuter){
                 RectangleF itemBox = new RectangleF(65,40,35,20);
                 itemStringFormat.Alignment = StringAlignment.Near;
                 drawDestination.DrawLine(Pens.DarkGray,15,10,15,70);
                 drawDestination.DrawLine(Pens.Black,15,60,65,60);
                 drawDestination.DrawLine(Pens.Black,65,10,65,60);
                 if (tStyle == TimerStyle.End){
                     PointF[] capPolygon = new PointF[3];
                     capPolygon[0] = new PointF(15, 60);
                     capPolygon[1] = new PointF(21, 57);
                     capPolygon[2] = new PointF(21, 63);
                     drawDestination.FillPolygon(Brushes.Black,capPolygon);
                 }
                 else if (tStyle == TimerStyle.Break){
                     drawDestination.DrawLine(Pens.Black,60,55,70,65);
                     drawDestination.DrawLine(Pens.Black,60,65,70,55);
                 }
                 drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
             }
             else if(style == ItemStyle.ExtendedInner){
                 RectangleF itemBox = new RectangleF(0,40,65,20);
                 itemStringFormat.Alignment = StringAlignment.Far;
                 drawDestination.DrawLine(Pens.DarkGray,15,10,15,70);
                 drawDestination.DrawLine(Pens.Black,15,60,65,60);
                 drawDestination.DrawLine(Pens.Black,65,10,65,60);
                 if (tStyle == TimerStyle.End){
                     PointF[] capPolygon = new PointF[3];
                     capPolygon[0] = new PointF(15, 60);
                     capPolygon[1] = new PointF(21, 57);
                     capPolygon[2] = new PointF(21, 63);
                     drawDestination.FillPolygon(Brushes.Black,capPolygon);
                 }
                 else if (tStyle == TimerStyle.Break){
                     drawDestination.DrawLine(Pens.Black,60,55,70,65);
                     drawDestination.DrawLine(Pens.Black,60,65,70,55);
                 }
                 drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
             }
         }
     }
     itemStringFormat.Dispose();
 }
Exemplo n.º 19
0
    private async void OnDestroyerHit(Sprite toHit)
    {
        ItemPos hit = _destroyedBy[toHit];

        await DestroyItem(hit, 0);
    }
Exemplo n.º 20
0
 public StopTimer(uint fileLine, uint line, int process, ItemPos placement)
 {
     this.mName 				= "";
     this.mLine 				= line;
     this.mProcess 			= process;
     this.mInitialHeight 	= STOPXSIZE;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mPos 				= placement;
     this.mFileLine 			= fileLine;
 }
Exemplo n.º 21
0
 public State(uint fileLine, string name, uint line, int[] process, StateStyle style, ItemPos pos)
 {
     this.mName 			= name;
     this.mLine 			= line;
     this.mProcess 		= process;
     this.mItemPen 		= new Pen(Color.Black, 1);
     this.mStyle 		= style;
     this.mFileLine 		= fileLine;
     this.mPos			= pos;
 }
Exemplo n.º 22
0
        public static void WrapItemsNewContainer(IEnumerable <DesignItem> items, Type containerType)
        {
            var collection = items;

            var _context = collection.First().Context as XamlDesignContext;

            var oldContainer = collection.First().Parent;

            if (collection.Any(x => x.Parent != oldContainer))
            {
                return;
            }

            var        newInstance = Activator.CreateInstance(containerType);
            DesignItem newPanel    = _context.Services.Component.RegisterComponentForDesigner(newInstance);
            var        changeGroup = newPanel.OpenGroup("Wrap in Container");

            List <ItemPos> itemList = new List <ItemPos>();

            foreach (var item in collection)
            {
                var itemPos = new ItemPos()
                {
                    DesignItem = item
                };
                itemList.Add(itemPos);

                if (oldContainer.Component is Canvas)
                {
                    var canvas = oldContainer.View as Canvas;

                    if (item.Properties.GetAttachedProperty(Canvas.RightProperty) != null && item.Properties.GetAttachedProperty(Canvas.RightProperty).IsSet)
                    {
                        itemPos.HorizontalAlignment = HorizontalAlignment.Right;
                        itemPos.Xmax = canvas.ActualWidth - (double)item.Properties.GetAttachedProperty(Canvas.RightProperty).ValueOnInstance;
                        itemPos.Xmin = itemPos.Xmax - ((FrameworkElement)item.View).ActualWidth;
                    }
                    else if (item.Properties.GetAttachedProperty(Canvas.LeftProperty) != null && item.Properties.GetAttachedProperty(Canvas.LeftProperty).IsSet)
                    {
                        itemPos.HorizontalAlignment = HorizontalAlignment.Left;
                        itemPos.Xmin = (double)item.Properties.GetAttachedProperty(Canvas.LeftProperty).ValueOnInstance;
                        itemPos.Xmax = itemPos.Xmin + ((FrameworkElement)item.View).ActualWidth;
                    }
                    else
                    {
                        itemPos.HorizontalAlignment = HorizontalAlignment.Left;
                        itemPos.Xmax = itemPos.Xmin + ((FrameworkElement)item.View).ActualWidth;
                    }

                    if (item.Properties.GetAttachedProperty(Canvas.BottomProperty) != null && item.Properties.GetAttachedProperty(Canvas.BottomProperty).IsSet)
                    {
                        itemPos.VerticalAlignment = VerticalAlignment.Bottom;
                        itemPos.Ymax = canvas.ActualHeight - (double)item.Properties.GetAttachedProperty(Canvas.BottomProperty).ValueOnInstance;
                        itemPos.Ymin = itemPos.Ymax - ((FrameworkElement)item.View).ActualHeight;
                    }
                    else if (item.Properties.GetAttachedProperty(Canvas.TopProperty) != null && item.Properties.GetAttachedProperty(Canvas.TopProperty).IsSet)
                    {
                        itemPos.VerticalAlignment = VerticalAlignment.Top;
                        itemPos.Ymin = (double)item.Properties.GetAttachedProperty(Canvas.TopProperty).ValueOnInstance;
                        itemPos.Ymax = itemPos.Ymin + ((FrameworkElement)item.View).ActualHeight;
                    }
                    else
                    {
                        itemPos.VerticalAlignment = VerticalAlignment.Top;
                        itemPos.Ymax = itemPos.Ymin + ((FrameworkElement)item.View).ActualHeight;
                    }

                    item.Properties.GetAttachedProperty(Canvas.RightProperty).Reset();
                    item.Properties.GetAttachedProperty(Canvas.LeftProperty).Reset();
                    item.Properties.GetAttachedProperty(Canvas.TopProperty).Reset();
                    item.Properties.GetAttachedProperty(Canvas.BottomProperty).Reset();
                }
                else if (oldContainer.Component is Grid)
                {
                    var grid = oldContainer.View as Grid;

                    if ((HorizontalAlignment)item.Properties.GetProperty(FrameworkElement.HorizontalAlignmentProperty).ValueOnInstance == HorizontalAlignment.Right)
                    {
                        itemPos.HorizontalAlignment = HorizontalAlignment.Right;
                        itemPos.Xmax = grid.ActualWidth - ((Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance).Right;
                        itemPos.Xmin = itemPos.Xmax - ((FrameworkElement)item.View).ActualWidth;
                    }
                    else
                    {
                        itemPos.HorizontalAlignment = HorizontalAlignment.Left;
                        itemPos.Xmin = ((Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance).Left;
                        itemPos.Xmax = itemPos.Xmin + ((FrameworkElement)item.View).ActualWidth;
                    }

                    if ((VerticalAlignment)item.Properties.GetProperty(FrameworkElement.VerticalAlignmentProperty).ValueOnInstance == VerticalAlignment.Bottom)
                    {
                        itemPos.VerticalAlignment = VerticalAlignment.Bottom;
                        itemPos.Ymax = grid.ActualHeight - ((Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance).Bottom;
                        itemPos.Ymin = itemPos.Ymax - ((FrameworkElement)item.View).ActualHeight;
                    }
                    else
                    {
                        itemPos.VerticalAlignment = VerticalAlignment.Top;
                        itemPos.Ymin = ((Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance).Top;
                        itemPos.Ymax = itemPos.Ymin + ((FrameworkElement)item.View).ActualHeight;
                    }

                    item.Properties.GetProperty(FrameworkElement.HorizontalAlignmentProperty).Reset();
                    item.Properties.GetProperty(FrameworkElement.VerticalAlignmentProperty).Reset();
                    item.Properties.GetProperty(FrameworkElement.MarginProperty).Reset();
                }

                var parCol = item.ParentProperty.CollectionElements;
                parCol.Remove(item);
            }

            var xmin = itemList.Min(x => x.Xmin);
            var xmax = itemList.Max(x => x.Xmax);
            var ymin = itemList.Min(x => x.Ymin);
            var ymax = itemList.Max(x => x.Ymax);

            if (oldContainer.Component is Canvas)
            {
                newPanel.Properties.GetProperty(FrameworkElement.WidthProperty).SetValue(xmax - xmin);
                newPanel.Properties.GetProperty(FrameworkElement.HeightProperty).SetValue(ymax - ymin);
                newPanel.Properties.GetAttachedProperty(Canvas.LeftProperty).SetValue(xmin);
                newPanel.Properties.GetAttachedProperty(Canvas.TopProperty).SetValue(ymin);
            }
            else if (oldContainer.Component is Grid)
            {
                newPanel.Properties.GetProperty(FrameworkElement.HorizontalAlignmentProperty).SetValue(HorizontalAlignment.Left);
                newPanel.Properties.GetProperty(FrameworkElement.VerticalAlignmentProperty).SetValue(VerticalAlignment.Top);
                newPanel.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(new Thickness(xmin, ymin, 0, 0));
                newPanel.Properties.GetProperty(FrameworkElement.WidthProperty).SetValue(xmax - xmin);
                newPanel.Properties.GetProperty(FrameworkElement.HeightProperty).SetValue(ymax - ymin);
            }

            foreach (var item in itemList)
            {
                newPanel.ContentProperty.CollectionElements.Add(item.DesignItem);

                if (newPanel.Component is Canvas)
                {
                    if (item.HorizontalAlignment == HorizontalAlignment.Right)
                    {
                        item.DesignItem.Properties.GetAttachedProperty(Canvas.RightProperty).SetValue(xmax - item.Xmax);
                    }
                    else
                    {
                        item.DesignItem.Properties.GetAttachedProperty(Canvas.LeftProperty).SetValue(item.Xmin - xmin);
                    }

                    if (item.VerticalAlignment == VerticalAlignment.Bottom)
                    {
                        item.DesignItem.Properties.GetAttachedProperty(Canvas.BottomProperty).SetValue(ymax - item.Ymax);
                    }
                    else
                    {
                        item.DesignItem.Properties.GetAttachedProperty(Canvas.TopProperty).SetValue(item.Ymin - ymin);
                    }
                }
                else if (newPanel.Component is Grid)
                {
                    Thickness thickness = new Thickness(0);
                    if (item.HorizontalAlignment == HorizontalAlignment.Right)
                    {
                        item.DesignItem.Properties.GetProperty(FrameworkElement.HorizontalAlignmentProperty).SetValue(HorizontalAlignment.Right);
                        thickness.Right = xmax - item.Xmax;
                    }
                    else
                    {
                        item.DesignItem.Properties.GetProperty(FrameworkElement.HorizontalAlignmentProperty).SetValue(HorizontalAlignment.Left);
                        thickness.Left = item.Xmin - xmin;
                    }

                    if (item.VerticalAlignment == VerticalAlignment.Bottom)
                    {
                        item.DesignItem.Properties.GetProperty(FrameworkElement.VerticalAlignmentProperty).SetValue(VerticalAlignment.Bottom);
                        thickness.Bottom = ymax - item.Ymax;
                    }
                    else
                    {
                        item.DesignItem.Properties.GetProperty(FrameworkElement.VerticalAlignmentProperty).SetValue(VerticalAlignment.Top);
                        thickness.Top = item.Ymin - ymin;
                    }

                    item.DesignItem.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(thickness);
                }
            }

            oldContainer.ContentProperty.CollectionElements.Add(newPanel);

            changeGroup.Commit();

            _context.Services.Selection.SetSelectedComponents(new [] { newPanel });
        }
Exemplo n.º 23
0
		private static ItemPos GetItemPos(PlacementOperation operation, DesignItem designItem)
		{
			var itemPos = new ItemPos() {DesignItem = designItem};

			var pos = operation.CurrentContainerBehavior.GetPosition(operation, designItem);
			itemPos.Xmin = pos.X;
			itemPos.Xmax = pos.X + pos.Width;
			itemPos.Ymin = pos.Y;
			itemPos.Ymax = pos.Y + pos.Height;

			return itemPos;
		}
Exemplo n.º 24
0
 public TimeoutStop(uint fileLine, uint line, int process, ItemPos placement, ItemStyle itemstyle)
 {
     this.mName 				= "";
     this.mLine 				= line;
     this.mProcess 			= process;
     this.mInitialHeight 	= 10;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mPos 				= placement;
     this.mFileLine 			= fileLine;
     this.mItemStyle 		= itemstyle;
 }
Exemplo n.º 25
0
		public static void WrapItemsNewContainer(IEnumerable<DesignItem> items, Type containerType)
		{
			var collection = items;
			
			var _context = collection.First().Context as XamlDesignContext;
			
			var oldContainer = collection.First().Parent;
			
			if (collection.Any(x => x.Parent != oldContainer))
				return;
			
			var newInstance = Activator.CreateInstance(containerType);
			DesignItem newPanel = _context.Services.Component.RegisterComponentForDesigner(newInstance);
			var changeGroup = newPanel.OpenGroup("Wrap in Container");
			
			List<ItemPos> itemList = new List<ItemPos>();
			
			foreach (var item in collection) {
				
				var itemPos = new ItemPos(){ DesignItem = item };
				itemList.Add(itemPos);
				
				if (oldContainer.Component is Canvas) {
					var canvas = oldContainer.View as Canvas;
					
					if (item.Properties.GetAttachedProperty(Canvas.RightProperty) != null && item.Properties.GetAttachedProperty(Canvas.RightProperty).IsSet) {
						itemPos.HorizontalAlignment = HorizontalAlignment.Right;
						itemPos.Xmax = canvas.ActualWidth - (double)item.Properties.GetAttachedProperty(Canvas.RightProperty).ValueOnInstance;
						itemPos.Xmin = itemPos.Xmax - ((FrameworkElement)item.View).ActualWidth;
					}
					else if (item.Properties.GetAttachedProperty(Canvas.LeftProperty) != null && item.Properties.GetAttachedProperty(Canvas.LeftProperty).IsSet) {
						itemPos.HorizontalAlignment = HorizontalAlignment.Left;
						itemPos.Xmin = (double)item.Properties.GetAttachedProperty(Canvas.LeftProperty).ValueOnInstance;
						itemPos.Xmax = itemPos.Xmin + ((FrameworkElement)item.View).ActualWidth;
					} else {
						itemPos.HorizontalAlignment = HorizontalAlignment.Left;
						itemPos.Xmax = itemPos.Xmin + ((FrameworkElement)item.View).ActualWidth;
					}
					
					if (item.Properties.GetAttachedProperty(Canvas.BottomProperty) != null && item.Properties.GetAttachedProperty(Canvas.BottomProperty).IsSet) {
						itemPos.VerticalAlignment = VerticalAlignment.Bottom;
						itemPos.Ymax = canvas.ActualHeight - (double)item.Properties.GetAttachedProperty(Canvas.BottomProperty).ValueOnInstance;
						itemPos.Ymin = itemPos.Ymax - ((FrameworkElement)item.View).ActualHeight;
					}
					else if (item.Properties.GetAttachedProperty(Canvas.TopProperty) != null && item.Properties.GetAttachedProperty(Canvas.TopProperty).IsSet) {
						itemPos.VerticalAlignment = VerticalAlignment.Top;
						itemPos.Ymin = (double)item.Properties.GetAttachedProperty(Canvas.TopProperty).ValueOnInstance;
						itemPos.Ymax = itemPos.Ymin + ((FrameworkElement)item.View).ActualHeight;
					} else {
						itemPos.VerticalAlignment = VerticalAlignment.Top;
						itemPos.Ymax = itemPos.Ymin + ((FrameworkElement)item.View).ActualHeight;
					}
					
					item.Properties.GetAttachedProperty(Canvas.RightProperty).Reset();
					item.Properties.GetAttachedProperty(Canvas.LeftProperty).Reset();
					item.Properties.GetAttachedProperty(Canvas.TopProperty).Reset();
					item.Properties.GetAttachedProperty(Canvas.BottomProperty).Reset();
				} else if (oldContainer.Component is Grid) {
					var grid = oldContainer.View as Grid;
					
					if ((HorizontalAlignment)item.Properties.GetProperty(FrameworkElement.HorizontalAlignmentProperty).ValueOnInstance == HorizontalAlignment.Right) {
						itemPos.HorizontalAlignment = HorizontalAlignment.Right;
						itemPos.Xmax = grid.ActualWidth - ((Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance).Right;
						itemPos.Xmin = itemPos.Xmax - ((FrameworkElement)item.View).ActualWidth;
					} else {
						itemPos.HorizontalAlignment = HorizontalAlignment.Left;
						itemPos.Xmin = ((Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance).Left;
						itemPos.Xmax = itemPos.Xmin + ((FrameworkElement)item.View).ActualWidth;
					}
					
					if ((VerticalAlignment)item.Properties.GetProperty(FrameworkElement.VerticalAlignmentProperty).ValueOnInstance == VerticalAlignment.Bottom) {
						itemPos.VerticalAlignment = VerticalAlignment.Bottom;
						itemPos.Ymax = grid.ActualHeight - ((Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance).Bottom;
						itemPos.Ymin = itemPos.Ymax - ((FrameworkElement)item.View).ActualHeight;
					} else {
						itemPos.VerticalAlignment = VerticalAlignment.Top;
						itemPos.Ymin = ((Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance).Top;
						itemPos.Ymax = itemPos.Ymin + ((FrameworkElement)item.View).ActualHeight;
					}
					
					item.Properties.GetProperty(FrameworkElement.HorizontalAlignmentProperty).Reset();
					item.Properties.GetProperty(FrameworkElement.VerticalAlignmentProperty).Reset();
					item.Properties.GetProperty(FrameworkElement.MarginProperty).Reset();
				}
				
				var parCol = item.ParentProperty.CollectionElements;
				parCol.Remove(item);
			}
			
			var xmin = itemList.Min(x => x.Xmin);
			var xmax = itemList.Max(x => x.Xmax);
			var ymin = itemList.Min(x => x.Ymin);
			var ymax = itemList.Max(x => x.Ymax);
			
			if (oldContainer.Component is Canvas) {
				newPanel.Properties.GetProperty(FrameworkElement.WidthProperty).SetValue(xmax - xmin);
				newPanel.Properties.GetProperty(FrameworkElement.HeightProperty).SetValue(ymax - ymin);
				newPanel.Properties.GetAttachedProperty(Canvas.LeftProperty).SetValue(xmin);
				newPanel.Properties.GetAttachedProperty(Canvas.TopProperty).SetValue(ymin);
			} else if (oldContainer.Component is Grid) {
				newPanel.Properties.GetProperty(FrameworkElement.HorizontalAlignmentProperty).SetValue(HorizontalAlignment.Left);
				newPanel.Properties.GetProperty(FrameworkElement.VerticalAlignmentProperty).SetValue(VerticalAlignment.Top);
				newPanel.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(new Thickness(xmin, ymin, 0, 0));
				newPanel.Properties.GetProperty(FrameworkElement.WidthProperty).SetValue(xmax - xmin);
				newPanel.Properties.GetProperty(FrameworkElement.HeightProperty).SetValue(ymax - ymin);
			}
			
			foreach (var item in itemList) {
				newPanel.ContentProperty.CollectionElements.Add(item.DesignItem);
				
				if (newPanel.Component is Canvas) {
					if (item.HorizontalAlignment == HorizontalAlignment.Right) {
						item.DesignItem.Properties.GetAttachedProperty(Canvas.RightProperty).SetValue(xmax - item.Xmax);
					} else {
						item.DesignItem.Properties.GetAttachedProperty(Canvas.LeftProperty).SetValue(item.Xmin - xmin);
					}
					
					if (item.VerticalAlignment == VerticalAlignment.Bottom) {
						item.DesignItem.Properties.GetAttachedProperty(Canvas.BottomProperty).SetValue(ymax - item.Ymax);
					} else {
						item.DesignItem.Properties.GetAttachedProperty(Canvas.TopProperty).SetValue(item.Ymin - ymin);
					}
				} else if (newPanel.Component is Grid) {
					Thickness thickness = new Thickness(0);
					if (item.HorizontalAlignment == HorizontalAlignment.Right) {
						item.DesignItem.Properties.GetProperty(FrameworkElement.HorizontalAlignmentProperty).SetValue(HorizontalAlignment.Right);
						thickness.Right = xmax - item.Xmax;
					} else {
						item.DesignItem.Properties.GetProperty(FrameworkElement.HorizontalAlignmentProperty).SetValue(HorizontalAlignment.Left);
						thickness.Left = item.Xmin - xmin;
					}
					
					if (item.VerticalAlignment == VerticalAlignment.Bottom) {
						item.DesignItem.Properties.GetProperty(FrameworkElement.VerticalAlignmentProperty).SetValue(VerticalAlignment.Bottom);
						thickness.Bottom = ymax - item.Ymax;
					} else {
						item.DesignItem.Properties.GetProperty(FrameworkElement.VerticalAlignmentProperty).SetValue(VerticalAlignment.Top);
						thickness.Top = item.Ymin - ymin;
					}
					
					item.DesignItem.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(thickness);
				}
			}
			
			oldContainer.ContentProperty.CollectionElements.Add(newPanel);
			
			changeGroup.Commit();
			
			_context.Services.Selection.SetSelectedComponents(new []{ newPanel });
		}
Exemplo n.º 26
0
 public InterpretResult AddItemVerticalLine(uint fileLine, uint line, string identifier, int process, ItemPos placement, ItemStyle itemstyle)
 {
     if (process >= processes.Count)
         return InterpretResult.InstanceNotFound;
     IEnumerator enumerator = lines.GetEnumerator();
     for(uint i=0;i<lines.Count;i++){
         enumerator.MoveNext();
         if ( enumerator.Current is ItemVerticalLine)
             if((((ItemVerticalLine) enumerator.Current).LineEnd==0)&&(((ItemVerticalLine) enumerator.Current).Process == process)&&(((ItemVerticalLine) enumerator.Current).ItemPlacement == placement)&&(((ItemVerticalLine) enumerator.Current).Itemstyle == itemstyle)&&(((ItemVerticalLine) enumerator.Current).Identifier == identifier)) return InterpretResult.LineAllreadyExists;
     }
     lines.Add(new ItemVerticalLine(line+1, process, identifier, placement, itemstyle));
     return InterpretResult.Ok;
 }
Exemplo n.º 27
0
 public InterpretResult AddTimerBegin(uint fileLine, string processName, uint line, string identifier, string name, ItemPos placement, ItemStyle itemstyle)
 {
     Process process;
     IEnumerator enumerator = processes.GetEnumerator();
     bool instanceFound = false;
     for(int i=0;i<processes.Count;i++){
         enumerator.MoveNext();
         process = (Process) enumerator.Current;
         if(process.ProcessName == processName){
             items.Add(new TimerBegin(fileLine, line, identifier,i,name, placement, itemstyle));
             AddItemVerticalLine(fileLine, line,identifier,i, placement, itemstyle);
             instanceFound = true;
             break;
         }
     }
     if (instanceFound==false)
         return InterpretResult.InstanceNotFound;
     mLines = Math.Max(mLines, line);
     return InterpretResult.Ok;
 }
Exemplo n.º 28
0
        public static void RepertoryImage(Graphics drawDestination, ItemPos pos, ItemStyle style, MscStyle style2)
        {
            StringFormat itemStringFormat = new StringFormat();
            if (style2 == MscStyle.UML2){
                if (pos == ItemPos.Left){
                    if(style == ItemStyle.Normal){
                        RectangleF itemBox = new RectangleF(10,27,65,20);
                        itemStringFormat.Alignment = StringAlignment.Far;
                        drawDestination.DrawLine(Pens.DarkGray,85,10,85,70);
                        drawDestination.DrawLine(Pens.Black,70,20,85,20);
                        drawDestination.DrawLine(Pens.Black,75,20,75,70);
                        drawDestination.DrawLine(Pens.Black,75,21,72,27);
                        drawDestination.DrawLine(Pens.Black,75,21,78,27);
                        drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                    }
                    else if(style == ItemStyle.ExtendedOuter){
                        RectangleF itemBox = new RectangleF(0,27,35,20);
                        itemStringFormat.Alignment = StringAlignment.Far;
                        drawDestination.DrawLine(Pens.DarkGray,85,10,85,70);
                        drawDestination.DrawLine(Pens.Black,30,20,85,20);
                        drawDestination.DrawLine(Pens.Black,35,20,35,70);
                        drawDestination.DrawLine(Pens.Black,35,21,32,27);
                        drawDestination.DrawLine(Pens.Black,35,21,38,27);
                        drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                    }
                    else if(style == ItemStyle.ExtendedInner){
                        RectangleF itemBox = new RectangleF(36,27,35,20);
                        itemStringFormat.Alignment = StringAlignment.Near;
                        drawDestination.DrawLine(Pens.DarkGray,85,10,85,70);
                        drawDestination.DrawLine(Pens.Black,30,20,85,20);
                        drawDestination.DrawLine(Pens.Black,35,20,35,70);
                        drawDestination.DrawLine(Pens.Black,35,21,32,27);
                        drawDestination.DrawLine(Pens.Black,35,21,38,27);
                        drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                    }
                }
                else if (pos == ItemPos.Right){
                    if(style == ItemStyle.Normal){
                        RectangleF itemBox = new RectangleF(25,27,65,20);
                        itemStringFormat.Alignment = StringAlignment.Near;
                        drawDestination.DrawLine(Pens.DarkGray,15,10,15,70);
                        drawDestination.DrawLine(Pens.Black,15,20,30,20);
                        drawDestination.DrawLine(Pens.Black,25,20,25,70);
                        drawDestination.DrawLine(Pens.Black,25,21,22,27);
                        drawDestination.DrawLine(Pens.Black,25,21,28,27);
                        drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                    }
                    else if(style == ItemStyle.ExtendedOuter){
                        RectangleF itemBox = new RectangleF(65,27,35,20);
                        itemStringFormat.Alignment = StringAlignment.Near;
                        drawDestination.DrawLine(Pens.DarkGray,15,10,15,70);
                        drawDestination.DrawLine(Pens.Black,15,20,70,20);
                        drawDestination.DrawLine(Pens.Black,65,20,65,70);
                        drawDestination.DrawLine(Pens.Black,65,21,62,27);
                        drawDestination.DrawLine(Pens.Black,65,21,68,27);
                        drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                    }
                    else if(style == ItemStyle.ExtendedInner){
                        RectangleF itemBox = new RectangleF(0,27,65,20);
                        itemStringFormat.Alignment = StringAlignment.Far;
                        drawDestination.DrawLine(Pens.DarkGray,15,10,15,70);
                        drawDestination.DrawLine(Pens.Black,15,20,70,20);
                        drawDestination.DrawLine(Pens.Black,65,20,65,70);
                        drawDestination.DrawLine(Pens.Black,65,21,62,27);
                        drawDestination.DrawLine(Pens.Black,65,21,68,27);
                        drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                    }
                }
            }
            else if (style2 == MscStyle.SDL){
                if (pos == ItemPos.Left){
                    if(style == ItemStyle.Normal){
                        RectangleF itemBox = new RectangleF(20,12,65,20);
                        itemStringFormat.Alignment = StringAlignment.Far;
                        drawDestination.DrawLine(Pens.DarkGray,85,10,85,70);
                        drawDestination.DrawLine(Pens.Black,75,30,85,30);
                        PointF[] capPolygon = new PointF[3];
                        capPolygon[0] = new PointF(75, 30);
                        capPolygon[1] = new PointF(80, 25);
                        capPolygon[2] = new PointF(70, 25);
                        drawDestination.DrawPolygon(Pens.Black,capPolygon);
                        capPolygon[0] = new PointF(75, 30);
                        capPolygon[1] = new PointF(80, 35);
                        capPolygon[2] = new PointF(70, 35);
                        drawDestination.DrawPolygon(Pens.Black,capPolygon);
                        drawDestination.DrawLine(Pens.Black,75,35,75,70);
                        drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                    }
                    else if(style == ItemStyle.ExtendedOuter){

                        RectangleF itemBox = new RectangleF(5,12,35,20);
                        itemStringFormat.Alignment = StringAlignment.Far;
                        drawDestination.DrawLine(Pens.DarkGray,85,10,85,70);
                        drawDestination.DrawLine(Pens.Black,35,30,85,30);
                        PointF[] capPolygon = new PointF[3];
                        capPolygon[0] = new PointF(35, 30);
                        capPolygon[1] = new PointF(40, 25);
                        capPolygon[2] = new PointF(30, 25);
                        drawDestination.DrawPolygon(Pens.Black,capPolygon);
                        capPolygon[0] = new PointF(35, 30);
                        capPolygon[1] = new PointF(40, 35);
                        capPolygon[2] = new PointF(30, 35);
                        drawDestination.DrawPolygon(Pens.Black,capPolygon);
                        drawDestination.DrawLine(Pens.Black,35,35,35,70);
                        drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                    }
                    else if(style == ItemStyle.ExtendedInner){
                        RectangleF itemBox = new RectangleF(35,12,35,20);
                        itemStringFormat.Alignment = StringAlignment.Near;
                        drawDestination.DrawLine(Pens.DarkGray,85,10,85,70);
                        drawDestination.DrawLine(Pens.Black,35,30,85,30);
                        PointF[] capPolygon = new PointF[3];
                        capPolygon[0] = new PointF(35, 30);
                        capPolygon[1] = new PointF(40, 25);
                        capPolygon[2] = new PointF(30, 25);
                        drawDestination.DrawPolygon(Pens.Black,capPolygon);
                        capPolygon[0] = new PointF(35, 30);
                        capPolygon[1] = new PointF(40, 35);
                        capPolygon[2] = new PointF(30, 35);
                        drawDestination.DrawPolygon(Pens.Black,capPolygon);
                        drawDestination.DrawLine(Pens.Black,35,35,35,70);
                        drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                    }
                }
                else if (pos == ItemPos.Right){
                    if(style == ItemStyle.Normal){
                        RectangleF itemBox = new RectangleF(16,12,65,20);
                        itemStringFormat.Alignment = StringAlignment.Near;
                        drawDestination.DrawLine(Pens.DarkGray,15,10,15,70);
                        drawDestination.DrawLine(Pens.Black,15,30,25,30);
                        PointF[] capPolygon = new PointF[3];
                        capPolygon[0] = new PointF(25, 30);
                        capPolygon[1] = new PointF(30, 25);
                        capPolygon[2] = new PointF(20, 25);
                        drawDestination.DrawPolygon(Pens.Black,capPolygon);
                        capPolygon[0] = new PointF(25, 30);
                        capPolygon[1] = new PointF(30, 35);
                        capPolygon[2] = new PointF(20, 35);
                        drawDestination.DrawPolygon(Pens.Black,capPolygon);
                        drawDestination.DrawLine(Pens.Black,25,35,25,70);
                        drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                    }
                    else if(style == ItemStyle.ExtendedOuter){

                        RectangleF itemBox = new RectangleF(65,12,35,20);
                        itemStringFormat.Alignment = StringAlignment.Near;
                        drawDestination.DrawLine(Pens.DarkGray,15,10,15,70);
                        drawDestination.DrawLine(Pens.Black,15,30,65,30);
                        PointF[] capPolygon = new PointF[3];
                        capPolygon[0] = new PointF(65, 30);
                        capPolygon[1] = new PointF(70, 25);
                        capPolygon[2] = new PointF(60, 25);
                        drawDestination.DrawPolygon(Pens.Black,capPolygon);
                        capPolygon[0] = new PointF(65, 30);
                        capPolygon[1] = new PointF(70, 35);
                        capPolygon[2] = new PointF(60, 35);
                        drawDestination.DrawPolygon(Pens.Black,capPolygon);
                        drawDestination.DrawLine(Pens.Black,65,35,65,70);
                        drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                    }
                    else if(style == ItemStyle.ExtendedInner){
                        RectangleF itemBox = new RectangleF(15,12,50,20);
                        itemStringFormat.Alignment = StringAlignment.Far;
                        drawDestination.DrawLine(Pens.DarkGray,15,10,15,70);
                        drawDestination.DrawLine(Pens.Black,15,30,65,30);
                        PointF[] capPolygon = new PointF[3];
                        capPolygon[0] = new PointF(65, 30);
                        capPolygon[1] = new PointF(70, 25);
                        capPolygon[2] = new PointF(60, 25);
                        drawDestination.DrawPolygon(Pens.Black,capPolygon);
                        capPolygon[0] = new PointF(65, 30);
                        capPolygon[1] = new PointF(70, 35);
                        capPolygon[2] = new PointF(60, 35);
                        drawDestination.DrawPolygon(Pens.Black,capPolygon);
                        drawDestination.DrawLine(Pens.Black,65,35,65,70);
                        drawDestination.DrawString("Timer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                    }
                }
            }

            itemStringFormat.Dispose();
        }
Exemplo n.º 29
0
 public InterpretResult AddTask(uint fileLine, string processName, uint line, string name, ItemPos pos)
 {
     Process process;
     IEnumerator enumerator = processes.GetEnumerator();
     bool instanceFound=false;
     for(int i=0;i<processes.Count;i++){
         enumerator.MoveNext();
         process = (Process) enumerator.Current;
         if(process.ProcessName == processName){
             items.Add(new Task(fileLine, name, line, i, pos));
             instanceFound=true;
             break;
         }
     }
     if (instanceFound==false)
         return InterpretResult.InstanceNotFound;
     mLines = Math.Max(mLines, line);
     return InterpretResult.Ok;
 }
Exemplo n.º 30
0
 public InterpretResult addTimeoutStop(uint fileLine, string processName, uint line, string name, ItemPos placement, ItemStyle style)
 {
     Process process;
     IEnumerator enumerator = processes.GetEnumerator();
     bool lineFound = false;
     bool instanceFound = false;
     for(int j=0;j<processes.Count;j++){
         enumerator.MoveNext();
         process = (Process) enumerator.Current;
         if(process.ProcessName == processName){
             IEnumerator lEnumerator = lines.GetEnumerator();
             instanceFound = true;
             for(uint i=0;i<lines.Count;i++){
                 lEnumerator.MoveNext();
                 if ( lEnumerator.Current is ItemVerticalLine)
                     if((((ItemVerticalLine) lEnumerator.Current).LineEnd==0)&&(((ItemVerticalLine) lEnumerator.Current).Process == j)&&(((ItemVerticalLine) lEnumerator.Current).ItemPlacement == placement)&&(((ItemVerticalLine) lEnumerator.Current).Itemstyle == style)){
                         ((ItemVerticalLine) lEnumerator.Current).LineEnd = line-1;
                         items.Add(new TimeoutStop(fileLine, name,line, j, ((ItemVerticalLine) lEnumerator.Current).ItemPlacement, ((ItemVerticalLine) lEnumerator.Current).Itemstyle));
                         lineFound = true;
                         break;
                     }
             }
             break;
         }
     }
     if (instanceFound==false)
         return InterpretResult.InstanceNotFound;
     if (lineFound==false)
         return InterpretResult.LineNotExists;
     mLines = Math.Max(mLines, line);
     return InterpretResult.Ok;
 }
Exemplo n.º 31
0
 public InterpretResult AddState(uint fileLine, string[] processName, uint line, string name,StateStyle style, ItemPos pos )
 {
     Process process;
     int[] proc = new int[processName.Length];
     IEnumerator enumerator = processes.GetEnumerator();
     for (int j=0;j<processName.Length;j++){
         proc[j]=-1;
         enumerator.Reset();
         for(int i=0;i<processes.Count;i++){
             enumerator.MoveNext();
             process = (Process) enumerator.Current;
             if(process.ProcessName == processName[j]){
                 proc[j]=i;
                 break;
             }
         }
     }
     for (int j=0;j<processName.Length;j++){
         if (proc[j]==-1) return InterpretResult.InstanceNotFound;
     }
     items.Add(new State(fileLine, name, line, proc,style,pos));
     mLines = Math.Max(mLines, line);
     return InterpretResult.Ok;
 }
Exemplo n.º 32
0
 public InterpretResult AddState(uint fileLine, uint line, string name, ItemPos pos)
 {
     int[] proc = new int[processes.Count];
     for (int j=0;j<processes.Count;j++){
         proc[j]=j;
     }
     items.Add(new State(fileLine, name, line,proc, StateStyle.Box, pos));
     mLines = Math.Max(mLines, line);
     return InterpretResult.Ok;
 }
Exemplo n.º 33
0
 public Item(string name, string description, INames combWith, ItemPos location, bool pickUp) : base(name, description)
 {
     this.CombWith = combWith;
     BelongsTo     = location;
     this.Pickup   = pickUp;
 }
Exemplo n.º 34
0
 public Item(string name, string description, ItemPos location, bool pickUp) : base(name, description)
 {
     BelongsTo   = location;
     this.Pickup = pickUp;
 }
Exemplo n.º 35
-1
 public static void RepertoryImage(Graphics drawDestination, ItemPos position)
 {
     StringFormat itemStringFormat = new StringFormat();
     if (position == ItemPos.Left){
         drawDestination.DrawLine(Pens.DarkGray,70,10,70,70);
         RectangleF itemBox = new RectangleF(15, 12, 60, 14);
         itemStringFormat.Alignment = StringAlignment.Near;
         itemStringFormat.LineAlignment = StringAlignment.Near;
         drawDestination.DrawLine(Pens.Black,15,30,70,30);
         drawDestination.DrawLine(Pens.Black,11,26,19,34);
         drawDestination.DrawLine(Pens.Black,11,34,19,26);
         drawDestination.DrawString("StopTimer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
     }
     else if (position == ItemPos.Right){
         drawDestination.DrawLine(Pens.DarkGray,10,10,10,70);
         RectangleF itemBox = new RectangleF(11, 12, 60, 14);
         itemStringFormat.Alignment = StringAlignment.Near;
         itemStringFormat.LineAlignment = StringAlignment.Near;
         drawDestination.DrawLine(Pens.Black,10,30,65,30);
         drawDestination.DrawLine(Pens.Black,61,26,69,34);
         drawDestination.DrawLine(Pens.Black,61,34,69,26);
         drawDestination.DrawString("StopTimer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
     }
     itemStringFormat.Dispose();
 }