示例#1
0
        public Markings Merge(Markings newMarkings)
        {
            RedMarkings.AddRange(newMarkings.RedMarkings);
            BlackMarkings.AddRange(newMarkings.BlackMarkings);
            BlueMarkings.AddRange(newMarkings.BlueMarkings);
            WhiteMarkings.AddRange(newMarkings.WhiteMarkings);
            YellowMarkings.AddRange(newMarkings.YellowMarkings);
            GreenMarkings.AddRange(newMarkings.GreenMarkings);

            return(this);
        }
        public Markings Merge(Markings newMarkings)
        {
            RedMarkings.AddRange(newMarkings.RedMarkings);
            BlackMarkings.AddRange(newMarkings.BlackMarkings);
            BlueMarkings.AddRange(newMarkings.BlueMarkings);
            WhiteMarkings.AddRange(newMarkings.WhiteMarkings);
            YellowMarkings.AddRange(newMarkings.YellowMarkings);
            GreenMarkings.AddRange(newMarkings.GreenMarkings);

            return this;
        }
        private void markingsReceived(IAsyncResult ar)
        {
            IPEndPoint clientEP = new IPEndPoint(IPAddress.Any, markingsPort);
            byte[] arry = markingsListener.EndReceive(ar, ref clientEP);
            string json = Encoding.ASCII.GetString(arry);
            Markings newMarks = JsonConvert.DeserializeObject<Markings>(json);
            myMarkings = myMarkings.Merge(newMarks);
            if (newMarks.ClearRequest)
            {
                myMarkings.Clear();
                tmpPoints = new List<Point>();
                redFigureNum = 0;
                blackFigureNum = 0;
                blueFigureNum = 0;
                whiteFigureNum = 0;
                yellowFigureNum = 0;
                greenFigureNum = 0;
                btn_UndoMark.Visible = false;
            }
            if (newMarks.FigureToDelete != null)
                myMarkings.RemoveFigure(newMarks.FigureToDelete);

            if (applicationRunning)
                listenForMarkings();
        }