Esempio n. 1
0
        private void OnShowServerDetailsInvoked()
        {
            // Prepare the dialog window
            var dialog = new ServerDetailsDialog();

            dialog.HasMinimizeButton     = false;
            dialog.HasMaximizeButton     = false;
            dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;

            // Post async-request to fetch the server details
            _dispatchThreadServerRequestExecutor.Post(
                new DispatchThreadServerRequest {
                Id      = Guid.NewGuid().ToString(),
                Delay   = TimeSpan.Zero,
                Request = new GetDatabaseDetailsRequest {
                    MaxFilesByExtensionDetailsCount = 500,
                    MaxLargeFilesDetailsCount       = 4000,
                },
                OnDispatchThreadError = error => {
                    dialog.ViewModel.Waiting = false;
                    _shellHost.ShowErrorMessageBox("Error retrieving server index details", error);
                },
                OnDispatchThreadSuccess = typedResponse => {
                    var response       = (GetDatabaseDetailsResponse)typedResponse;
                    var projectDetails = response.Projects.Select(x => new ProjectDetailsViewModel {
                        ProjectDetails = x
                    }).ToList();
                    foreach (var x in projectDetails)
                    {
                        x.ShowProjectConfigurationInvoked += (sender, args) => { ShowProjectConfiguration(x); };
                    }

                    dialog.ViewModel.Projects.AddRange(projectDetails);
                    if (dialog.ViewModel.Projects.Count > 0)
                    {
                        dialog.ViewModel.SelectedProject = dialog.ViewModel.Projects[0];
                    }

                    dialog.ViewModel.Waiting = false;
                }
            });

            // Show the dialog right away, waiting for a response for the above request
            // (The dialog shows a "Please wait..." message while waiting)
            dialog.ShowModal();
        }
Esempio n. 2
0
        public void ShowProjectIndexDetailsDialog(string path)
        {
            // Prepare the dialog window
            var dialog = new ProjectDetailsDialog();

            dialog.HasMinimizeButton     = false;
            dialog.HasMaximizeButton     = false;
            dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            dialog.ViewModel.ShowProjectConfigurationInvoked += (sender, args) => {
                ShowProjectConfiguration(dialog.ViewModel);
            };

            // Post async-request to fetch the project details
            _dispatchThreadServerRequestExecutor.Post(new DispatchThreadServerRequest {
                Id      = Guid.NewGuid().ToString(),
                Delay   = TimeSpan.FromSeconds(0.0),
                Request = new GetProjectDetailsRequest {
                    ProjectPath = path,
                    MaxFilesByExtensionDetailsCount = 500,
                    MaxLargeFilesDetailsCount       = 4000
                },
                OnDispatchThreadError = error => {
                    dialog.ViewModel.Waiting = false;
                    _shellHost.ShowErrorMessageBox("Error", error.Message);
                },
                OnDispatchThreadSuccess = typedResponse => {
                    var response = (GetProjectDetailsResponse)typedResponse;
                    dialog.ViewModel.ProjectDetails = response.ProjectDetails;
                    dialog.ViewModel.Waiting        = false;
                },
            });

            // Show the dialog right away, waiting for a response for the above request
            // (The dialog shows a "Please wait..." message while waiting)
            dialog.ShowModal();
        }