Пример #1
0
 public ArgMoveObject(long clientID, long pictureBoxID, MoveObject moveObj)
 {
     if (moveObj == null)
     {
         throw new ArgumentNullException("move object is null");
     }
     _clientID    = clientID;
     MoveObj      = moveObj;
     PictureBoxID = pictureBoxID;
 }
Пример #2
0
        private void NCMovePictureBox(IConnector connection, ArgMoveObject arg)
        {
            if (arg == null || arg.PictureBoxID == 0)
            {
                return;
            }
            MoveObject move = arg.MoveObj;

            move.Picture = _canvas.GetEditablePictureBox(arg.PictureBoxID);
            _canvas.AddDrawObject(arg.PictureBoxID, move);
        }
Пример #3
0
        public static void Draw(DrawObject drawObj)
        {
            MoveObject move = drawObj as MoveObject;

            if (move == null || move.Picture == null)
            {
                return;
            }

            if ((PictureBoxStatus.IsMovable & move.Picture.Status) == PictureBoxStatus.IsMovable)
            {
                move.Picture.Location = new Point(move.LocationX - move.OffsetX, move.LocationY - move.OffsetY);
            }
        }
Пример #4
0
        public DrawObject GetDrawObject(int pX, int pY)
        {
            MoveObject move = new MoveObject();

            move.Picture = _picture;

            move.OffsetX = _offsetX;
            move.OffsetY = _offsetY;

            move.LocationX = pX;
            move.LocationY = pY;

            return(move);
        }
Пример #5
0
        private void SendDrawObject(DrawObject drObj)
        {
            if (drObj == null || drObj.Picture == null)
            {
                return;
            }

            long        picBoxID = drObj.Picture.UniqueID; //canvas
            ICommandArg arg      = null;

            if (drObj is BrushLineObject)
            {
                BrushLineObject line = drObj as BrushLineObject;
                arg = new ArgBrushObject(_netClient.ClientID, picBoxID, line);
            }
            else if (drObj is LineObject)
            {
                LineObject line = drObj as LineObject;
                arg = new ArgLineObject(_netClient.ClientID, picBoxID, line);
            }
            else if (drObj is RectObject)
            {
                RectObject rect = drObj as RectObject;
                arg = new ArgRectObject(_netClient.ClientID, picBoxID, rect);
            }
            else if (drObj is EllipseObject)
            {
                EllipseObject ellipse = drObj as EllipseObject;
                arg = new ArgEllipseObject(_netClient.ClientID, picBoxID, ellipse);
            }
            else if (drObj is MoveObject)
            {
                MoveObject move = drObj as MoveObject;
                arg = new ArgMoveObject(_netClient.ClientID, picBoxID, move);
            }
            else if (drObj is SelectorObject)
            {
                SelectorObject selector = drObj as SelectorObject;
                arg = new ArgSelectorCopyObject(_netClient.ClientID, picBoxID, selector);
            }

            if (arg != null && _netClient.Connector != null)
            {
                _netClient.Connector.SendCommand(arg);
            }
        }
Пример #6
0
        private void NCMovePictureBox(IConnector connection, ArgMoveObject arg)
        {
            if (arg.PictureBoxID == 0)
            {
                return;
            }
            long assocID = GetPictureBoxAssociationID(arg.PictureBoxID);

            if (assocID == 0)
            {
                return;
            }

            arg.PictureBoxID = assocID;
            MoveObject move = arg.MoveObj;

            move.Picture = _canvas.GetEditablePictureBox(arg.PictureBoxID);
            _canvas.AddDrawObject(arg.PictureBoxID, move);
            AddCommandToSendClients(arg);
        }
Пример #7
0
        public bool UnPack(byte[] pack)
        {
            if (pack == null || pack.Length < 40)
            {
                return(false);
            }

            int ptr = 8;

            _clientID    = BytePacketReader.ReadLong(pack, ref ptr);
            PictureBoxID = BytePacketReader.ReadLong(pack, ref ptr);

            MoveObj           = new MoveObject();
            MoveObj.OffsetX   = BytePacketReader.ReadInt(pack, ref ptr);
            MoveObj.OffsetY   = BytePacketReader.ReadInt(pack, ref ptr);
            MoveObj.LocationX = BytePacketReader.ReadInt(pack, ref ptr);
            MoveObj.LocationY = BytePacketReader.ReadInt(pack, ref ptr);

            return(true);
        }