Ejemplo n.º 1
0
        public void ProfileOpenAction(object sender, EventArgs e)
        {
            OpenFileDialog dialog   = new OpenFileDialog();
            FileInfo       fileInfo = new FileInfo(m_options.coreOptionsFileName);

            if (fileInfo.Exists)
            {
                dialog.FileName         = m_options.coreOptionsFileName;
                dialog.InitialDirectory = fileInfo.Directory.ToString();
            }
            else
            {
                dialog.InitialDirectory = Resources.ProfilesPath;
            }
            dialog.DefaultExt = "xml";
            dialog.Filter     = "Antidupl profile files (*.xml)|*.xml";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                if (string.Compare(dialog.FileName, m_options.coreOptionsFileName) != 0)
                {
                    m_coreOptions.Save(m_options.coreOptionsFileName);
                    ProgressForm saveProgressForm = new ProgressForm(ProgressForm.Type.SaveResults, m_core, m_options, m_coreOptions, m_mainSplitContainer);
                    saveProgressForm.Execute();
                    m_options.coreOptionsFileName = dialog.FileName;
                }

                CoreOptions coreOptions = CoreOptions.Load(m_options.coreOptionsFileName, m_core, m_options.onePath);
                coreOptions.CopyTo(ref m_coreOptions);
                ProgressForm loadProgressForm = new ProgressForm(ProgressForm.Type.LoadResults, m_core, m_options, m_coreOptions, m_mainSplitContainer);
                loadProgressForm.Execute();

                m_mainForm.UpdateCaption();
                m_options.Change();
            }
        }
Ejemplo n.º 2
0
        public void ProfileSaveAsAction(object sender, EventArgs e)
        {
            SaveFileDialog dialog   = new SaveFileDialog();
            FileInfo       fileInfo = new FileInfo(m_options.coreOptionsFileName);

            if (fileInfo.Exists)
            {
                dialog.FileName         = m_options.coreOptionsFileName;
                dialog.InitialDirectory = fileInfo.Directory.ToString();
            }
            else
            {
                dialog.InitialDirectory = Resources.ProfilesPath;
            }
            dialog.OverwritePrompt = false;
            dialog.DefaultExt      = "xml";
            dialog.Filter          = "Antidupl profile files (*.xml)|*.xml";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                /*if (string.Compare(dialog.FileName, m_options.coreOptionsFileName) != 0)
                 * {
                 *  m_coreOptions.Save(m_options.coreOptionsFileName);
                 *  ProgressForm saveProgressForm = new ProgressForm(ProgressForm.Type.SaveResults, m_core, m_options, m_coreOptions, m_mainSplitContainer);
                 *  saveProgressForm.Execute();
                 *  m_options.coreOptionsFileName = dialog.FileName;
                 * }*/
                m_options.coreOptionsFileName = dialog.FileName;
                m_coreOptions.Save(m_options.coreOptionsFileName);
                ProgressForm progressForm = new ProgressForm(ProgressForm.Type.SaveResults, m_core, m_options, m_coreOptions, m_mainSplitContainer);
                progressForm.Execute();
                m_mainForm.UpdateCaption();
            }
        }
Ejemplo n.º 3
0
        public void RenameCurrentGroupAs(string filename)
        {
            m_makeAction = true;
            ProgressForm progressForm = new ProgressForm(ProgressForm.Type.RenameCurrentGroupAs, filename, m_core, m_options, m_coreOptions, m_mainSplitContainer);

            progressForm.Execute();
            m_makeAction = false;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Перенести текущую группу в папку.
        /// </summary>
        /// <param name="directory"></param>
        public void MoveCurrentGroupToDirectory(string directory)
        {
            m_makeAction = true;
            ProgressForm progressForm = new ProgressForm(ProgressForm.Type.MoveCurrentGroup, directory, m_core, m_options, m_coreOptions, m_mainSplitContainer);

            progressForm.Execute();
            m_makeAction = false;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Меняет путь у текущей картинки на заданный.
        /// </summary>
        /// <param name="renameCurrentType"></param>
        /// <param name="newFileName">Новый путь</param>
        public void RenameCurrent(CoreDll.RenameCurrentType renameCurrentType, string newFileName)
        {
            m_makeAction = true;
            ProgressForm progressForm = new ProgressForm(renameCurrentType, newFileName, m_core, m_options, m_coreOptions, m_mainSplitContainer);

            progressForm.Execute();
            m_makeAction = false;
        }
Ejemplo n.º 6
0
        public void MakeAction(CoreDll.LocalActionType action, CoreDll.TargetType target)
        {
            m_makeAction = true;
            ProgressForm progressForm = new ProgressForm(action, target, m_core, m_options, m_coreOptions, m_mainSplitContainer);

            progressForm.Execute();
            m_makeAction = false;
        }
Ejemplo n.º 7
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;
                }
            }
        }
Ejemplo n.º 8
0
        public void RefreshResults()
        {
            ProgressForm progressForm = new ProgressForm(ProgressForm.Type.RefreshResults, m_core, m_options, m_coreOptions, m_mainSplitContainer);

            progressForm.Execute();
        }
Ejemplo n.º 9
0
        public void RedoAction(object sender, EventArgs e)
        {
            ProgressForm progressForm = new ProgressForm(ProgressForm.Type.Redo, m_core, m_options, m_coreOptions, m_mainSplitContainer);

            progressForm.Execute();
        }
Ejemplo n.º 10
0
        private void RefreshImagesAction(object sender, EventArgs e)
        {
            ProgressForm progressForm = new ProgressForm(ProgressForm.Type.ClearDatabase, m_core, m_options, m_coreOptions, m_mainSplitContainer);

            progressForm.Execute();
        }