Esempio n. 1
0
        /// <summary>
        /// Функция которая будет выполнять основные действия.
        /// </summary>
        private void CoreThreadTask()
        {
            m_startDateTime = DateTime.Now;
            m_state         = State.Work;
            m_coreOptions.Set(m_core, m_options.onePath);
            switch (m_type)
            {
            case Type.ApplyAction:
            {
                m_updateResults = m_core.ApplyToResult(m_action, m_target);
                m_type          = Type.ClearTemporary;
                m_core.Clear(CoreDll.FileType.Temporary);
                break;
            }

            case Type.RenameCurrent:
            {
                m_updateResults = m_core.RenameCurrent(m_renameCurrentType, m_newFileName);
                m_type          = Type.ClearTemporary;
                m_core.Clear(CoreDll.FileType.Temporary);
                break;
            }

            case Type.MoveCurrentGroup:
            {
                m_updateResults = m_core.MoveCurrentGroup(m_directoryForMove);
                m_type          = Type.ClearTemporary;
                m_core.Clear(CoreDll.FileType.Temporary);
                break;
            }

            case Type.RenameCurrentGroupAs:
            {
                m_updateResults = m_core.RenameCurrentGroupAs(m_newFileName);
                m_type          = Type.ClearTemporary;
                m_core.Clear(CoreDll.FileType.Temporary);
                break;
            }

            case Type.RefreshResults:
            {
                m_updateResults = m_core.ApplyToResult(CoreDll.GlobalActionType.Refresh);
                m_type          = Type.ClearTemporary;
                m_core.Clear(CoreDll.FileType.Temporary);
                break;
            }

            case Type.Undo:
            {
                m_updateResults = m_core.ApplyToResult(CoreDll.GlobalActionType.Undo);
                break;
            }

            case Type.Redo:
            {
                m_updateResults = m_core.ApplyToResult(CoreDll.GlobalActionType.Redo);
                break;
            }

            case Type.LoadResults:
            {
                m_type = Type.ClearResults;
                m_core.Clear(CoreDll.FileType.Result);
                m_type = Type.ClearTemporary;
                m_core.Clear(CoreDll.FileType.Temporary);
                m_type = Type.LoadResults;
                m_core.Load(CoreDll.FileType.Result, m_options.GetResultsFileName(), m_options.checkResultsAtLoading);
                m_updateResults = true;
                break;
            }

            case Type.SaveResults:
            {
                m_core.Save(CoreDll.FileType.Result, m_options.GetResultsFileName());
                m_updateResults = false;
                break;
            }

            case Type.ClearDatabase:
            {
                m_type = Type.LoadImages;
                m_core.Load(CoreDll.FileType.ImageDataBase, m_coreOptions.GetImageDataBasePath(), true);
                m_updateResults = false;
                break;
            }

            default:
                throw new Exception("Unknown Action!!!");
            }
            m_state = State.Finish;
        }