Пример #1
0
 public void Deserialize(string value)
 {
     try
     {
         if (value != "")
         {
             string[] strArray = value.Split(':');
             if (strArray != null && strArray.Length > 0)
             {
                 if (_listline == null)
                 {
                     _listline = new List<LineModel>();
                 }
                 else
                 {
                     _listline.Clear();
                 }
                 Page = Convert.ToInt32(strArray[0]);
                 ProgressIndex = Convert.ToInt32(strArray[1]);
                 Width = Convert.ToDouble(strArray[2]);
                 Height = Convert.ToDouble(strArray[3]);
                 for (int i = 4; i < strArray.Length; i += 6)
                 {
                     if (strArray[i].ToString() == ";")
                     {
                         return;
                     }
                     LineModel item = new LineModel(0, 0, 0, 0, 0)
                     {
                         Index = Convert.ToInt32(strArray[i]),
                         IsVisible = Convert.ToBoolean(strArray[i + 1]),
                         X1 = Convert.ToDouble(strArray[i + 2]),
                         Y1 = Convert.ToDouble(strArray[i + 3]),
                         X2 = Convert.ToDouble(strArray[i + 4]),
                         Y2 = Convert.ToDouble(strArray[i + 5])
                     };
                     ListLine.Add(item);
                 }
             }
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
     }
 }
Пример #2
0
        public DrawModel Clone()
        {
            DrawModel drawModel = new DrawModel(Page, Width, Height)
            {
                ProgressIndex = this.ProgressIndex
            };

         foreach (var item in ListLine)
            {
                LineModel line = new LineModel()
                {
                    Index = item.Index,
                    IsVisible = item.IsVisible,
                    X1 = item.X1,
                    Y1 = item.Y1,
                    X2 = item.X2,
                    Y2 = item.Y2
                };
                drawModel.ListLine.Add(line);
            }
            return drawModel;
        }