Пример #1
0
        private void PrepareToCopyComplete(string result)
        {
            _prepareTask = null;
            if (_prepareProgress != null)
            {
                _prepareProgress.Hide();
                _prepareProgress = null;
            }

            if (result != null)
            {
                var msg = new MingPluginInterfaces.Forms.MessageBox();
                msg.ShowMessage(_dialog, result, Properties.Resources.CopyCollections_ErrorMessageTitle);
                return;
            }

            _targetCollections.ToList().ForEach(item =>
                _result.Add(new CopyCollectionDefinition(
                    new CollectionDefinition(_sourceConnection, item.SourceDatabase, item.SourceCollection),
                    new CollectionDefinition(_targetConnection.ConnectionInfo, item.TargetDatabase, item.NewCollectionName))));

            _dialog.DialogResult = true;
            _dialog.Hide();
        }
Пример #2
0
        private void CopyButtonClick(object sender, RoutedEventArgs e)
        {
            if (ValidatePreCopy())
            {
                _prepareProgress = new ProgressDialog();
                _prepareProgress.Title = Properties.Resources.CopyCollections_PrepareTitle;
                _prepareProgress.Owner = _dialog;

                _targetConnection = _dialog.TargetServer.SelectedItem as TargetConnection;

                _prepareTask = new CancelableTask<string>(() => PrepareToCopy(), PrepareToCopyComplete);
                _prepareTask.Execute();
                if (!(bool)_prepareProgress.ShowDialog())
                {
                    _prepareProgress = null;
                    if (_prepareTask != null)
                    {
                        _prepareTask.Cancel();
                    }
                }
            }
        }