Ejemplo n.º 1
0
        private void Ufrm_Distance_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (EditMode)
            {
                try
                {
                    MeasuringUnit u1 = Func_System.GetUnit(unitList1, (data as BaseCal_Single).unit1.iD);
                    if (u1 == null)
                    {
                        u1 = Func_System.GetUnit(unitList1, (oldData as BaseCal_Single).unit1.iD);
                    }

                    MeasuringUnit u2 = Func_System.GetUnit(unitList2, (data as BaseCal_Single).unit2.iD);
                    if (u2 == null)
                    {
                        u2 = Func_System.GetUnit(unitList2, (oldData as BaseCal_Single).unit2.iD);
                    }

                    if (u1 == null)
                    {
                        u1 = new Line();
                    }
                    if (u2 == null)
                    {
                        u2 = new Line();
                    }

                    (data as BaseCal_Single).unit1 = u1;
                    (data as BaseCal_Single).unit2 = u2;
                }
                catch (Exception)
                { }
            }
        }
Ejemplo n.º 2
0
        private void Ufrm_Radius_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (EditMode)
            {
                try
                {
                    MeasuringUnit u1 = Func_System.GetUnit(measuringUnits, (data as BaseCal_Single).unit1.iD);
                    if (u1 == null)
                    {
                        u1 = Func_System.GetUnit(measuringUnits, (oldData as BaseCal_Single).unit1.iD);
                    }

                    if (u1 == null)
                    {
                        u1 = new Circle(0, 0, 1);
                    }

                    (data as BaseCal_Single).unit1 = u1;
                }
                catch (Exception)
                { }
            }
        }
Ejemplo n.º 3
0
        private void Ufrm_MultipleDistance_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (EditMode)
            {
                MeasuringUnit u1 = null;
                try
                {
                    u1 = (Line)Func_System.GetUnit(baseLines, (data as BaseCal_Multi).baseLine.iD);
                }
                catch (Exception) { }
                try
                {
                    if (u1 == null)
                    {
                        u1 = (Line)Func_System.GetUnit(baseLines, (oldData as BaseCal_Multi).baseLine.iD);
                    }
                }
                catch (Exception) { }

                MeasuringUnit u2 = null;
                try
                {
                    u2 = (GetSetOfLines)Func_System.GetUnit(lineGroups, (data as BaseCal_Multi).lines.iD);
                }
                catch (Exception) { }
                try
                {
                    if (u2 == null)
                    {
                        u2 = (GetSetOfLines)Func_System.GetUnit(lineGroups, (oldData as BaseCal_Multi).lines.iD);
                    }
                }
                catch (Exception) { }

                if (u1 == null)
                {
                    u1 = new Line(0, 0, 1, 1);
                }
                if (u2 == null)
                {
                    u2 = new GetSetOfLines();
                    (u2 as GetSetOfLines).AddLine(
                        new GetLineUseThreshold(
                            new Threshold(new Rectangle2(0, 0, 0, 1, 1))));
                }
                (data as BaseCal_Multi).baseLine = (Line)u1;
                (data as BaseCal_Multi).lines    = (GetSetOfLines)u2;
                if (data is MultipleDistance)
                {
                    for (int i = 0; i < (data as MultipleDistance).calList.Count; i++)
                    {
                        BaseCal_Single item = (data as MultipleDistance).calList[i];
                        item.unit1 = (data as MultipleDistance).baseLine;
                        item.unit2 = (data as MultipleDistance).lines.LineList[i];
                    }
                }
                if (data is DropDistance)
                {
                    for (int i = 0; i < (data as DropDistance).calList.Count; i++)
                    {
                        BaseCal_Single item = (data as DropDistance).calList[i];
                        item.unit1 = (data as DropDistance).baseLine;
                        item.unit2 = (data as DropDistance).lines.LineList[i];
                    }
                }
                if (data is PinDistance)
                {
                    for (int i = 0; i < (data as PinDistance).calList.Count; i++)
                    {
                        BaseCal_Single item = (data as PinDistance).calList[i];
                        item.unit1 = (data as PinDistance).lines.LineList[i];
                        item.unit2 = (data as PinDistance).lines.LineList[i + 1];
                    }
                }
            }
        }