///////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Creates a new instance of the <c>CancellationTracker</c> class.
 /// </summary>
 /// <param name="tracker">Cancel tracker.</param>
 public CancellationTracker(ImportCancelTracker tracker)
 {
     Debug.Assert(null != tracker); // created
     _tracker = tracker;
 }
        /// <summary>
        /// Starts import process.
        /// </summary>
        /// <param name="parentPage">Page requirest importing.</param>
        /// <param name="profile">Import profile.</param>
        /// <param name="defaultDate">Default date for default initialize imported objects.</param>
        /// <param name="dataProvider">Data provider.</param>
        private void _StartImportProcess(AppPages.Page parentPage,
                                         ImportProfile profile,
                                         DateTime defaultDate,
                                         IDataProvider dataProvider)
        {
            Debug.Assert(null != parentPage); // created
            Debug.Assert(null != profile); // created
            Debug.Assert(null != dataProvider); // creatde

            // reset state
            _importer = null;
            _geocoder = null;

            // subscribe to events
            App currentApp = App.Current;
            currentApp.MainWindow.Closed += new EventHandler(_MainWindow_Closed);

            // create background worker
            Debug.Assert(null == _worker); // only once
            SuspendBackgroundWorker worker = _CreateBackgroundWorker();

            // create internal objects
            var tracker = new ImportCancelTracker(worker);
            var cancelTracker = new CancellationTracker(tracker);
            _informer = new ProgressInformer(parentPage, profile.Type, tracker);
            _informer.SetStatus("ImportLabelImporting");

            var infoTracker = new ProgressInfoTracker(worker,
                                                      _informer.ParentPage,
                                                      _informer.ObjectName,
                                                      _informer.ObjectsName);
            _importer = new Importer(infoTracker);

            if (PropertyHelpers.IsGeocodeSupported(profile.Type))
            {
                _geocoder = new Geocoder(infoTracker);
            }

            // set precondition
            string message = currentApp.GetString("ImportProcessStarted", _informer.ObjectName);
            currentApp.Messenger.AddInfo(message);

            // lock GUI
            currentApp.UIManager.Lock(true);

            // run worker
            var parameters = new ProcessParams(profile,
                                               defaultDate,
                                               dataProvider,
                                               cancelTracker,
                                               infoTracker);
            worker.RunWorkerAsync(parameters);
            _worker = worker;
        }