예제 #1
0
        /// <summary>
        ///
        /// </summary>
        internal override ReturnResultBase Execute()
        {
            ReturnResultBase result = null;

            if (LocalDataviewManager.UserSorts != null)
            {
                TaskViews.ApplySort(LocalDataviewManager.UserSorts);
            }
            else
            {
                if (!KeepUserSort)
                {
                    TaskViews.ApplySort(Task.RuntimeSorts);
                }
            }

            TaskViews.ApplyUserRangesAndLocates();

            SetTaskMode();

            if (RefreshMode == ViewRefreshMode.CurrentLocation)
            {
                InitCurrentPosition();
                if (startPosition != null)
                {
                    result = ExecuteRefreshAndKeepCurrentLocation();
                    if (result.Success)
                    {
                        LocalDataviewManager.UserGatewayLocates.Clear();
                        LocalDataviewManager.UserLocates.Clear();
                        LocalDataviewManager.UserSorts = null;
                    }

                    return(result);
                }
            }

            // clean the position cache
            LocalDataviewManager.Reset();

            // Release the ViewMain cursor and re-prepare it.
            if (TaskViews.ViewMain != null)
            {
                TaskViews.ViewMain.ReleaseCursor();
                TaskViews.ViewMain.Prepare();
            }

            result = base.Execute();

            if (result.Success)
            {
                DataviewSynchronizer.SetCurrentRecordByIdx(0);
                LocalDataviewManager.UserGatewayLocates.Clear();
                LocalDataviewManager.UserLocates.Clear();
                LocalDataviewManager.UserSorts = null;
            }

            return(result);
        }