Esempio n. 1
0
        private static void OnDoWork(object sender, DoWorkEventArgs e)
        {
            AsyncLoadingProgressParams workParams       = (AsyncLoadingProgressParams)e.Argument;
            ILoadingProgressCallback   progressCallback = workParams.LoadingProgressCallback;
            bool             mergeConversations         = workParams.MergeConversations;
            IPhoneDeviceInfo deviceInfo = workParams.DeviceInfo;

            try
            {
                IConversationManager conversationManager = MainWindowModelBase.LoadConversationManager(progressCallback, deviceInfo, mergeConversations);

                progressCallback.End();

                e.Result = conversationManager;
            }
            catch (OperationCanceledException)
            {
                e.Cancel = true;
            }
        }
Esempio n. 2
0
        private void LoadConversationManagerAsync()
        {
            BackgroundWorker backgroundWorker = new BackgroundWorker();

            _progressCallback = new LoadingProgressCallback(backgroundWorker);

            backgroundWorker.WorkerReportsProgress      = true;
            backgroundWorker.WorkerSupportsCancellation = true;
            backgroundWorker.DoWork             += OnDoWork;
            backgroundWorker.ProgressChanged    += OnProgressChanged;
            backgroundWorker.RunWorkerCompleted += OnWorkerCompleted;

            _progressDialog         = new LoadingProgressDialogView();
            _progressDialog.Owner   = this;
            _progressDialog.Cancel += OnCancelProcess;
            AsyncLoadingProgressParams workParams = new AsyncLoadingProgressParams(_progressCallback, _displayOptions.MergeContacts, _deviceInfo);

            backgroundWorker.RunWorkerAsync(workParams);
            _progressDialog.ShowDialog();
        }
Esempio n. 3
0
        private void LoadConversationManagerAsync()
        {
            BackgroundWorker backgroundWorker = new BackgroundWorker();
            _progressCallback = new LoadingProgressCallback(backgroundWorker);

            backgroundWorker.WorkerReportsProgress = true;
            backgroundWorker.WorkerSupportsCancellation = true;
            backgroundWorker.DoWork += OnDoWork;
            backgroundWorker.ProgressChanged += OnProgressChanged;
            backgroundWorker.RunWorkerCompleted += OnWorkerCompleted;

            _progressDialog = new LoadingProgressDialogView();
            _progressDialog.Owner = this;
            _progressDialog.Cancel += OnCancelProcess;
            AsyncLoadingProgressParams workParams = new AsyncLoadingProgressParams(_progressCallback, _displayOptions.MergeContacts, _deviceInfo);

            backgroundWorker.RunWorkerAsync(workParams);
            _progressDialog.ShowDialog();
        }