Esempio n. 1
0
        private void UpdateResults()
        {
            bool hasResults = m_core.GetResultSize() > 0;

            m_edit_undoMenuItem.Enabled      = m_core.CanApply(CoreDll.ActionEnableType.Undo);
            m_edit_redoMenuItem.Enabled      = m_core.CanApply(CoreDll.ActionEnableType.Redo);
            m_edit_selectAllMenuItem.Enabled = hasResults;
        }
        private void OnOpening(object sender, EventArgs e)
        {
            Items.Clear();

            if (m_mainSplitContainer.resultsListView.GetTotalResultCount() > 0)
            {
                if (m_core.CanApply(CoreDll.ActionEnableType.Defect))
                {
                    Items.Add(m_deleteDefectItem);
                    Items.Add(new ToolStripSeparator());
                }
                if (m_core.CanApply(CoreDll.ActionEnableType.DuplPair)) //проверяется тип результата в выделенных
                {
                    Items.Add(m_deleteFirstItem);
                    Items.Add(m_deleteSecondItem);
                    Items.Add(m_renameFirstToSecond);
                    Items.Add(m_renameSecondToFirst);
                    Items.Add(m_deleteBothItem);
                    Items.Add(new ToolStripSeparator());
                    Items.Add(m_renameFirstLikeSecond);
                    Items.Add(m_renameSecondLikeFirst);
                    if (m_mainSplitContainer.resultsListView.MoveEnable())
                    {
                        Items.Add(m_moveFirstToSecond);
                        Items.Add(m_moveSecondToFirst);
                    }
                    Items.Add(new ToolStripSeparator());
                }
                if (m_core.CanApply(CoreDll.ActionEnableType.PerformHint))
                {
                    Items.Add(m_performHintItem);
                    Items.Add(new ToolStripSeparator());
                }
                if (m_core.CanApply(CoreDll.ActionEnableType.Any))
                {
                    Items.Add(m_mistakeItem);
                }
            }
        }
Esempio n. 3
0
        private void OnSelectedResultsChanged()
        {
            bool mistake     = m_core.CanApply(CoreDll.ActionEnableType.Any);
            bool performHint = m_core.CanApply(CoreDll.ActionEnableType.PerformHint);
            bool duplPair    = m_core.CanApply(CoreDll.ActionEnableType.DuplPair);
            bool defect      = m_core.CanApply(CoreDll.ActionEnableType.Defect);

            m_mistakeButton.Enabled      = mistake;
            m_performHintButton.Enabled  = performHint;
            m_deleteFirstButton.Enabled  = duplPair;
            m_deleteSecondButton.Enabled = duplPair;
            m_deleteBothButton.Enabled   = duplPair;
            m_deleteDefectButton.Enabled = defect;

            m_undoButton.Enabled = m_core.CanApply(CoreDll.ActionEnableType.Undo);
            m_redoButton.Enabled = m_core.CanApply(CoreDll.ActionEnableType.Redo);
        }
Esempio n. 4
0
        /// <summary>
        /// MakeAction by hotkey.
        /// </summary>
        /// <param name="hotKey"></param>
        private void MakeAction(Keys hotKey)
        {
            if (hotKey == (Keys.Z | Keys.Control) && m_core.CanApply(CoreDll.ActionEnableType.Undo))
            {
                ProgressForm progressForm = new ProgressForm(ProgressForm.Type.Undo, m_core, m_options, m_coreOptions, m_mainSplitContainer);
                progressForm.Execute();
                return;
            }

            if (hotKey == (Keys.Y | Keys.Control) && m_core.CanApply(CoreDll.ActionEnableType.Redo))
            {
                ProgressForm progressForm = new ProgressForm(ProgressForm.Type.Redo, m_core, m_options, m_coreOptions, m_mainSplitContainer);
                progressForm.Execute();
                return;
            }

            if (m_currentRowIndex >= 0 && m_currentRowIndex < m_results.Length)
            {
                if (m_results[m_currentRowIndex].type == CoreDll.ResultType.DefectImage)
                {
                    if (hotKey == m_options.hotKeyOptions.keys[(int)HotKeyOptions.Action.CurrentDefectDelete])
                    {
                        MakeAction(CoreDll.LocalActionType.DeleteDefect, CoreDll.TargetType.Current);
                    }
                    else if (hotKey == m_options.hotKeyOptions.keys[(int)HotKeyOptions.Action.CurrentMistake])
                    {
                        MakeAction(CoreDll.LocalActionType.Mistake, CoreDll.TargetType.Current);
                    }
                    return;
                }
                if (m_results[m_currentRowIndex].type == CoreDll.ResultType.DuplImagePair)
                {
                    if (hotKey == m_options.hotKeyOptions.keys[(int)HotKeyOptions.Action.CurrentDuplPairDeleteFirst])
                    {
                        MakeAction(CoreDll.LocalActionType.DeleteFirst, CoreDll.TargetType.Current);
                    }
                    else if (hotKey == m_options.hotKeyOptions.keys[(int)HotKeyOptions.Action.CurrentDuplPairDeleteSecond])
                    {
                        MakeAction(CoreDll.LocalActionType.DeleteSecond, CoreDll.TargetType.Current);
                    }
                    else if (hotKey == m_options.hotKeyOptions.keys[(int)HotKeyOptions.Action.CurrentDuplPairDeleteBoth])
                    {
                        MakeAction(CoreDll.LocalActionType.DeleteBoth, CoreDll.TargetType.Current);
                    }
                    else if (hotKey == m_options.hotKeyOptions.keys[(int)HotKeyOptions.Action.CurrentDuplPairRenameFirstToSecond])
                    {
                        MakeAction(CoreDll.LocalActionType.RenameFirstToSecond, CoreDll.TargetType.Current);
                    }
                    else if (hotKey == m_options.hotKeyOptions.keys[(int)HotKeyOptions.Action.CurrentDuplPairRenameSecondToFirst])
                    {
                        MakeAction(CoreDll.LocalActionType.RenameSecondToFirst, CoreDll.TargetType.Current);
                    }
                    else if (hotKey == m_options.hotKeyOptions.keys[(int)HotKeyOptions.Action.CurrentMistake])
                    {
                        MakeAction(CoreDll.LocalActionType.Mistake, CoreDll.TargetType.Current);
                    }
                    else if (hotKey == m_options.hotKeyOptions.keys[(int)HotKeyOptions.Action.ShowNeighbours])
                    {
                        m_options.resultsOptions.ShowNeighboursImages = !m_options.resultsOptions.ShowNeighboursImages;
                    }
                    return;
                }
            }
        }