Example #1
0
 private void ConnectFiguresAssemblies()
 {
     try
     {
         foreach (var lib in DllList)
         {
             Assembly asm = Assembly.LoadFile(lib);
             Type[]   typ = asm.GetTypes();
             figure = (Figure.Figure)Activator.CreateInstance(typ[0], new Object[] { CurrPen, 0, 0, 0, 0 });
             bool isExist = false;
             foreach (var i in NamesList)
             {
                 if (figure.GetName() == i)
                 {
                     isExist = true;
                 }
             }
             if (!isExist)
             {
                 var nextRB = new RadioButton();
                 nextRB.Parent = grboxFigures;
                 nextRB.Left   = 8;
                 nextRB.Top    = StartRBPos;
                 nextRB.Width  = 100;
                 nextRB.Height = 21;
                 TypesList.Add(typ[0]);
                 if (figure.GetName().Length > 11)
                 {
                     nextRB.Text = figure.GetName().Substring(0, 10);
                 }
                 else
                 {
                     nextRB.Text = figure.GetName();
                 }
                 nextRB.CheckedChanged += (a, b) => {
                     FigParams = new Object[] { CurrPen, 0, 0, 0, 0 };
                     figure    = (Figure.Figure)Activator.CreateInstance(typ[0], FigParams);
                     isChanged = true;
                     isPointer = false;
                 };
                 StartRBPos    += 27;
                 nextRB.Checked = true;
                 NamesList.Add(figure.GetName());
             }
             else
             {
                 MessageBoxWrongDll("There is a repeated figure name \"" + figure.GetName() + "\" in assemblies.");
             }
         }
     }
     catch (Exception e)
     {
         MessageBoxException(e.Message);
     }
 }
Example #2
0
 public SerialFigure(Figure.Figure fig)
 {
     X1        = fig.X1;
     X2        = fig.X2;
     Y1        = fig.Y1;
     Y2        = fig.Y2;
     penColor  = fig.pen.color;
     penWidth  = fig.pen.Width;
     Name      = fig.GetName();
     Direction = fig.Direction;
     if (fig is MyInterfaces.IFillingable)
     {
         isFilled = ((MyInterfaces.IFillingable)fig).isFilled;
     }
     figtype      = fig.GetType().ToString();
     isUserFigure = fig.isUserFigure;
     if (fig is UserFigure)
     {
         Hash = ((UserFigure)fig).SourceFigures.CalculateHash();
     }
     else
     {
         Hash = 0;
     }
 }