Exemple #1
0
 public void EvaluateClicked()
 {
     var script = _control.JavaScript.Text;
     if (BusyStateChanged != null) BusyStateChanged(true, Properties.Resources.EvaluateJS_Evaluating);
     var task = new CancelableTask(() => DoEvaluate(script), null);
     task.Execute();
 }
        public void ShowDialog()
        {
            LoadSettings();

            var task = new CancelableTask(PopulateSourceTreeView, null);
            task.Execute();

            var ret = _dialog.ShowDialog();

            SaveSettings();
        }
        public void CreateIndexes(ConnectionInfo cnn, string database, string collection, IEnumerable<IndexDescriptor> indexes)
        {
            var operation = new OperationStatus
            {
                IsIndeterminate = true,
                Title = Properties.Resources.ManageIndexes_Applying,
                Description = Properties.Resources.ManageIndexes_Dropping
            };
            _mingApp.AddLongRunningOperation(operation);

            var task = new CancelableTask(() => DoCreateIndexes(operation, cnn, database, collection, indexes), null);
            task.Execute();
        }
        public void CopyCollections(IEnumerable<CopyCollectionDefinition> collections)
        {
            var operation = new OperationStatus
            {
                IsIndeterminate = true,
                Title = string.Format(Properties.Resources.CopyingCollections_Title, collections.Count()),
                Description = Properties.Resources.CopyingCollections_Counting
            };
            _mingApp.AddLongRunningOperation(operation);

            var task = new CancelableTask(() => DoCopyCollections(operation, collections), null);
            task.Execute();
        }
        public void CompactCollections(MingTreeViewItem node, ConnectionInfo cnnInfo, string database)
        {
            var confirm = new MessageBox();
            var message = database == null
                ? string.Format(Properties.Resources.CompactCollections_ConfirmAll, cnnInfo.Host, cnnInfo.Port)
                : string.Format(Properties.Resources.CompactCollections_Confirm, database);
            if (!confirm.ShowConfirm(_mingApp.MainWindow, message))
            {
                return;
            }

            var operation = new OperationStatus
            {
                IsIndeterminate = true,
                Title = Properties.Resources.CompactCollections_Title,
                Description = Properties.Resources.CompactCollections_DescCounting
            };
            _mingApp.AddLongRunningOperation(operation);
            var task = new CancelableTask(() => DoCompactCollections(operation, cnnInfo, database), null);
            task.Execute();
        }
 public void CopyCollection(MingTreeViewItem node, ConnectionInfo cnnInfo, string database, string collection)
 {
     var ted = new TextEntryDialogController(_mingApp.MainWindow, Properties.Resources.CopyCollection_Title, Properties.Resources.CreateCollection_Prompt);
     ted.Text = collection;
     if (!ted.ShowDialog())
     {
         return;
     }
     var name = ted.Text.Trim();
     if (string.IsNullOrWhiteSpace(name))
     {
         return;
     }
     var operation = new OperationStatus
     {
         IsIndeterminate = true,
         Title = Properties.Resources.CopyCollection_OpTitle,
         Description = Properties.Resources.CopyCollection_Counting
     };
     _mingApp.AddLongRunningOperation(operation);
     var task = new CancelableTask(() => DoCopyCollection(node, operation, cnnInfo, database, collection, name), null);
     task.Execute();
 }
        private void LoadChildren(MingTreeViewItem node)
        {
            MingApp.Instance.IndicateBusy(null);

            var cnn = GetNodeConnection(node);

            var plugin = PluginManager.Instance.GetPluginInstance(cnn.ServiceId);
            var loadtask = new CancelableTask<IEnumerable<MingTreeViewItem>>(
                () => plugin.TreeViewClient.NodeExpanded(node, cnn),
                result => TreeViewItemsLoaded(node, result));
            loadtask.Execute();
        }
Exemple #8
0
 private void StartScanCollectionForProperties()
 {
     _sortFields.Clear();
     _sortFieldsInfo.Clear();
     _sortFields.Add(Properties.Resources.CollectionView_Loading);
     _control.AddSort.IsEnabled = false;
     _control.SortFields.SelectedIndex = 0;
     _control.SortFields.IsEnabled = false;
     _control.AddFilter.IsEnabled = false;
     _control.FilterFields.SelectedIndex = 0;
     _control.FilterFields.IsEnabled = false;
     var scanTask = new CancelableTask(ScanCollectionForProperties, null);
     scanTask.Execute();
 }
Exemple #9
0
        private void ShowAsHierarchy()
        {
            var view = _control.MainListView.View as GridView;

            _collectionData.Clear();
            _pager.PropertyChanged -= PagerPropertyChanged;
            var loadTask = new CancelableTask<MongoCursor<BsonDocument>>(
                () =>
                LoadData(),
                result => DataLoaded(result));
            if (BusyStateChanged != null) BusyStateChanged(true, Properties.Resources.CollectionView_Loading);
            loadTask.Execute();
        }
Exemple #10
0
 private void DocumentPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "Value")
     {
         var doc = sender as MongoDocumentProperty;
         BsonValue bsonValue;
         if (MongoUtilities.TryConvertStringToBsonType(doc.Type, doc.Value, out bsonValue))
         {
             var updateTask = new CancelableTask<MongoDocumentProperty>(
                 () => UpdateDocument(doc), result => DocumentUpdated(result));
             doc.IsInError = false;
             doc.IsUpdating = true;
             updateTask.Execute();
         }
         else
         {
             doc.IsInError = true;
         }
     }
 }
Exemple #11
0
        public bool ShowDialog()
        {
            LoadSettings();

            var task = new CancelableTask(PopulateSourceTreeView, null);
            task.Execute();

            _result = new List<CopyCollectionDefinition>();
            var ret = (bool) _dialog.ShowDialog();

            SaveSettings();

            return ret;
        }
Exemple #12
0
 private void LoadAvailableLogs()
 {
     var task = new CancelableTask(DoLoadAvailableLogs, null);
     task.Execute();
 }
Exemple #13
0
 private void GetLogLevel()
 {
     var task = new CancelableTask(DoGetLogLevel, null);
     task.Execute();
 }
Exemple #14
0
        private void TargetServerSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            _targetDatabases.Clear();
            if (e.AddedItems.Count < 1)
            {
                return;
            }

            var task = new CancelableTask(() => PopulateTargetDatabases(e.AddedItems[0] as TargetConnection), null);
            task.Execute();
        }
Exemple #15
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();
                    }
                }
            }
        }
Exemple #16
0
 private void SetLogLevel(int level)
 {
     var task = new CancelableTask(() => DoSetLogLevel(level), null);
     task.Execute();
 }
Exemple #17
0
 private void DeleteSelectedDocument()
 {
     var item = _control.MainListView.SelectedItem as MongoDocumentProperty;
     var task = new CancelableTask(() => DeleteDocument(item.DocumentObjectId), null);
     task.Execute();
 }
Exemple #18
0
 private void RecordTrialEvent(string eventText)
 {
     var task = new CancelableTask(() => DoRecordTrialEvent(eventText), null);
     task.Execute();
 }
Exemple #19
0
 private void StartLoadProperties()
 {
     var scanTask = new CancelableTask(LoadProperties, null);
     scanTask.Execute();
 }