Пример #1
0
        internal bool EditCurrentObject()
        {
            TrackedObjectConfig selectedObject = m_StateMachine.MeasuringStars[m_StateMachine.SelectedMeasuringStar];
            int selectedStarId = m_StateMachine.SelectedMeasuringStar;

            if (LightCurveReductionContext.Instance.LightCurveReductionType == LightCurveReductionType.MutualEvent)
            {
                var frmAddMutualTarget = new frmAddOrEditMutualEventsTarget(m_StateMachine.SelectedMeasuringStar, selectedObject, m_StateMachine, m_VideoController);
                DialogResult result = frmAddMutualTarget.ShowDialog();
                if (result == DialogResult.Cancel)
                    return false;

                if (result == DialogResult.Abort)
                {
                    m_StateMachine.ObjectSelected(frmAddMutualTarget.ObjectToAdd, false, true /* Ctrl = 'DELETE' */);
                    if (frmAddMutualTarget.ObjectToAdd2 != null)
                        m_StateMachine.ObjectSelected(frmAddMutualTarget.ObjectToAdd2, false, true /* Ctrl = 'DELETE' */);

                    m_StateMachine.SelectedMeasuringStar = -1;
                    m_VideoController.RefreshCurrentFrame();

                    return false;
                }

                if (selectedObject.GroupId != frmAddMutualTarget.ObjectToAdd.GroupId)
                {
                    if (selectedObject.GroupId > -1)
                    {
                        // Remove the previous group as now the group is different or is not a group
                        List<TrackedObjectConfig> objectsInGroup = m_StateMachine.MeasuringStars.Where(x => x.GroupId == selectedObject.GroupId).ToList();
                        foreach (TrackedObjectConfig prevObj in objectsInGroup)
                            m_StateMachine.ObjectSelected(prevObj, false, true /* Ctrl = 'DELETE' */);
                    }
                    else
                        // Remove the previous object as now we have a group of objects
                        m_StateMachine.ObjectSelected(selectedObject, false, true /* Ctrl = 'DELETE' */);
                }

                m_StateMachine.ObjectEdited(selectedStarId, frmAddMutualTarget.ObjectToAdd);

                if (frmAddMutualTarget.ObjectToAdd2 != null)
                    m_StateMachine.ObjectEdited(selectedStarId, frmAddMutualTarget.ObjectToAdd2);
            }
            else
            {
                frmAddOrEditSingleTarget frmAddSingleTarget =
                    new frmAddOrEditSingleTarget(m_StateMachine.SelectedMeasuringStar, selectedObject, m_StateMachine, m_VideoController);

                DialogResult result = frmAddSingleTarget.ShowDialog();
                if (result == DialogResult.Cancel)
                    return false;

                if (result == DialogResult.Abort)
                {
                    m_StateMachine.ObjectSelected(frmAddSingleTarget.ObjectToAdd, false, true /* Ctrl = 'DELETE' */);
                    m_StateMachine.SelectedMeasuringStar = -1;
                    m_VideoController.RefreshCurrentFrame();

                    return false;
                }

                m_StateMachine.ObjectEdited(selectedStarId, frmAddSingleTarget.ObjectToAdd);
            }

            return true;
        }
Пример #2
0
        internal bool ConfirmNewObject(int objectId, bool tryAutoDoubleFind)
        {
            if (LightCurveReductionContext.Instance.LightCurveReductionType == LightCurveReductionType.MutualEvent)
            {
                var frmAddMutualTarget = new frmAddOrEditMutualEventsTarget(objectId, m_StateMachine.SelectedObject, m_StateMachine.SelectedObjectGaussian, m_StateMachine, m_VideoController, tryAutoDoubleFind);
                if (frmAddMutualTarget.ShowDialog() == DialogResult.Cancel)
                    return false;

                m_StateMachine.ObjectSelected(frmAddMutualTarget.ObjectToAdd, false, false);

                if (frmAddMutualTarget.ObjectToAdd2 != null)
                    m_StateMachine.ObjectSelected(frmAddMutualTarget.ObjectToAdd2, false, false);
            }
            else
            {
                var frmAddSingleTarget = new frmAddOrEditSingleTarget(objectId, m_StateMachine.SelectedObject, m_StateMachine.SelectedObjectGaussian, m_StateMachine, m_VideoController);
                if (frmAddSingleTarget.ShowDialog() == DialogResult.Cancel)
                    return false;

                m_StateMachine.ObjectSelected(frmAddSingleTarget.ObjectToAdd, false, false);
            }

            return true;
        }