Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        public bool StartSearchResultProcess()
        {
            if (this._SearchItem == null || this._SearchItem.searchResult == null)
            {
                throw new InvalidOperationException("No search item to process.");
            }

            Advertisement.Advertisements _results = null;
            Stopwatch _stopwatch = new Stopwatch();

            _DirectoryProviderRoutineStage = DirectoryProviderRoutineStageEnum.ProcessStarting;
            bool _cancel = false;

            this.InvokeEventProcessStarting(new Handlers.EventHandlers.ProcessStartingEventArgs(_cancel));

            if (!_cancel)
            {
                _stopwatch.Reset();
                _stopwatch.Start();
                _results = this.StartSearchResultProcessCallback();
                _stopwatch.Stop();
            }

            _DirectoryProviderRoutineStage = DirectoryProviderRoutineStageEnum.ProcessFinished;
            this.InvokeEventProcessFinished(new Handlers.EventHandlers.ProcessFinishedEventArgs(_results, _stopwatch.Elapsed));

            if (_results != null)
            {
                this._Advertisements = _results;
                return(_results.Count > 0);
            }
            return(false);
        }
        /// <summary>
        /// 
        /// </summary>
        public bool StartSearchResultProcess()
        {
            if(this._SearchItem == null || this._SearchItem.searchResult == null)
                throw new InvalidOperationException("No search item to process.");

            Advertisement.Advertisements _results = null;
            Stopwatch _stopwatch = new Stopwatch();

            _DirectoryProviderRoutineStage = DirectoryProviderRoutineStageEnum.ProcessStarting;
            bool _cancel = false;
            this.InvokeEventProcessStarting(new Handlers.EventHandlers.ProcessStartingEventArgs(_cancel));

            if(!_cancel)
            {
                _stopwatch.Reset();
                _stopwatch.Start();
                _results = this.StartSearchResultProcessCallback();
                _stopwatch.Stop();
            }

            _DirectoryProviderRoutineStage = DirectoryProviderRoutineStageEnum.ProcessFinished;
            this.InvokeEventProcessFinished(new Handlers.EventHandlers.ProcessFinishedEventArgs(_results, _stopwatch.Elapsed));

            if(_results != null)
            {
                this._Advertisements = _results;
                return _results.Count > 0;
            }
            return false;
        }
Esempio n. 3
0
 public ProcessFinishedEventArgs(Advertisement.Advertisements Advertisements, TimeSpan Elapsed)
 {
     this.Advertisements = Advertisements;
     this.Elapsed        = Elapsed;
 }