예제 #1
0
        private void MoveRectBlue(RectangleBlue Rect)
        {
            CmdMoveRectangleBlue CmdMoveRect = new CmdMoveRectangleBlue();

            CmdMoveRect.Execute(Rect);
            CmdMoveRect.hierarchyID = Rect.HierarchyID;
        }
예제 #2
0
        public static void Moving(string x, string y)
        {
            if (Selected[0].Name == "Rectangle Red")
            {
                int HelperX = 0;
                int HelperY = 0;
                for (int i = Objects.Count - 1; i >= 0; i--)
                {
                    if (Objects[i].Selected)
                    {
                        HelperX = Objects[i].X;
                        HelperY = Objects[i].Y;
                    }
                }

                RectangleRed Rec = new RectangleRed(int.Parse(x), int.Parse(y), HelperX, HelperY);
                Rec.Moved       = true;
                Rec.Username    = Username;
                Rec.HierarchyID = Selected[0].HierarchyID;
                CmdMoveRectangleRed CmdMoveRec = new CmdMoveRectangleRed();
                CmdMoveRec.ID_Command = Guid.NewGuid();
                CmdMoveRec.Execute(Rec);
                CmdMoveRec.hierarchyID = Rec.HierarchyID;

                BinaryFormatter bf = new BinaryFormatter();
                using (MemoryStream data = new MemoryStream())
                {
                    bf.Serialize(data, CmdMoveRec);
                    ServerStream.Write(data.ToArray(), 0, data.ToArray().Length);
                    ServerStream.Flush();
                }
                Selected.Clear();
            }
            else if (Selected[0].Name == "Rectangle Blue")
            {
                int HelperX = 0;
                int HelperY = 0;
                for (int i = Objects.Count - 1; i >= 0; i--)
                {
                    if (Objects[i].Selected)
                    {
                        HelperX = Objects[i].X;
                        HelperY = Objects[i].Y;
                    }
                }

                RectangleBlue Rec = new RectangleBlue(int.Parse(x), int.Parse(y), HelperX, HelperY);
                Rec.Moved    = true;
                Rec.Username = Username;
                CmdMoveRectangleBlue CmdMoveRec = new CmdMoveRectangleBlue();
                CmdMoveRec.ID_Command = Guid.NewGuid();
                CmdMoveRec.Execute(Rec);
                CmdMoveRec.hierarchyID = Rec.HierarchyID;

                BinaryFormatter bf = new BinaryFormatter();
                using (MemoryStream data = new MemoryStream())
                {
                    bf.Serialize(data, CmdMoveRec);
                    ServerStream.Write(data.ToArray(), 0, data.ToArray().Length);
                    ServerStream.Flush();
                }
                Selected.Clear();
            }
        }