Chapi Assistant provides comprehensive workspace management to handle multiple .NET WPF projects simultaneously. Easily switch between projects, track their status, and maintain an organized development environment.
Workspace management is built on the IProjectRepository interface, which persists project information and preferences.
Retrieve all projects registered in your workspace:
var result = await loadProjectsUseCase.ExecuteAsync();if (result.IsSuccess){ var projects = result.Value; foreach (var project in projects) { Console.WriteLine($"{project.Name} - {project.Path}"); }}
Basic Usage
With Filtering
Error Handling
Load and display all projects:
var result = await loadProjectsUseCase.ExecuteAsync();if (result.IsSuccess){ var projects = result.Value; if (!projects.Any()) { Console.WriteLine("No projects in workspace"); } else { Console.WriteLine($"Found {projects.Count()} projects"); }}else{ Console.WriteLine($"Error: {result.Error}");}
Filter and organize loaded projects:
var result = await loadProjectsUseCase.ExecuteAsync();if (result.IsSuccess){ var projects = result.Value; // Filter by criteria var recentProjects = projects .Where(p => p.LastAccessedDate > DateTime.Now.AddDays(-7)) .OrderByDescending(p => p.LastAccessedDate); var activeProjects = projects .Where(p => p.IsActive);}
Handle loading errors gracefully:
try{ var result = await loadProjectsUseCase.ExecuteAsync(); if (!result.IsSuccess) { // "Error cargando proyectos: {message}" LogError(result.Error); ShowDefaultWorkspace(); }}catch (Exception ex){ // Handle critical errors ShowErrorDialog(ex.Message);}
Change the currently active project in your workspace:
var result = await switchProjectUseCase.ExecuteAsync( projectPath: @"C:\Projects\CustomerApp");if (result.IsSuccess){ var project = result.Value; Console.WriteLine($"Switched to: {project.Name}");}
// Validates:// - Path is not null or whitespace// - Directory exists on filesystem// - Project is registered in workspaceif (string.IsNullOrWhiteSpace(projectPath)) return Result<Project>.Fail("La ruta del proyecto no puede estar vacía");if (!Directory.Exists(projectPath)) return Result<Project>.Fail("El directorio no existe");
Project Existence
var project = await _projectRepository.GetProjectAsync(projectPath);if (project == null) return Result<Project>.Fail("Proyecto no encontrado");
The project must be previously registered in the workspace.
var result = await addProjectUseCase.ExecuteAsync( projectPath: @"C:\Projects\ExistingApp");if (result.IsSuccess){ Console.WriteLine("Project added to workspace");}
Add Single Project
Add Multiple Projects
With Validation
var result = await addProjectUseCase.ExecuteAsync( @"C:\Projects\MyApp");if (result.IsSuccess){ // Project is now tracked in workspace await RefreshProjectList();}
var projectPaths = new[]{ @"C:\Projects\App1", @"C:\Projects\App2", @"C:\Projects\App3"};foreach (var path in projectPaths){ var result = await addProjectUseCase.ExecuteAsync(path); if (!result.IsSuccess) { Console.WriteLine($"Failed to add {path}: {result.Error}"); }}
var projectPath = @"C:\Projects\NewApp";// Pre-validateif (!Directory.Exists(projectPath)){ Console.WriteLine("Directory does not exist"); return;}var result = await addProjectUseCase.ExecuteAsync(projectPath);if (!result.IsSuccess){ // Possible errors: // - "La ruta del proyecto no puede estar vacía" // - "El directorio no existe" // - "Error agregando proyecto: {exception}" HandleError(result.Error);}
public class Project{ public string Path { get; set; } // Full directory path public string Name { get; set; } // Project name public bool IsActive { get; set; } // Currently active? public DateTime LastAccessedDate { get; set; } public string CurrentBranch { get; set; } // Git branch public int UncommittedChanges { get; set; } public string BuildStatus { get; set; } // ... additional properties}
// 1. Load all projectsvar projects = await loadProjectsUseCase.ExecuteAsync();// 2. Switch to project you want to work onawait switchProjectUseCase.ExecuteAsync( @"C:\Projects\CustomerApp");// 3. Work on the project...// Generate code, commit changes, etc.// 4. Update project statusawait updateProjectIndicatorsUseCase.ExecuteAsync( currentProjectPath);// 5. Switch to another project when neededawait switchProjectUseCase.ExecuteAsync( @"C:\Projects\OrderApp");
// Get all projectsvar result = await loadProjectsUseCase.ExecuteAsync();var projects = result.Value;// Find old or inactive projectsvar oldProjects = projects .Where(p => p.LastAccessedDate < DateTime.Now.AddMonths(-6)) .ToList();// Remove from workspaceforeach (var project in oldProjects){ await removeProjectUseCase.ExecuteAsync(project.Path);}// Optionally delete directories// (Handle this carefully!)