Ejemplo n.º 1
0
            protected override async Task RunAsync()
            {
                if (System.IO.Directory.Exists(path) && System.IO.Directory.EnumerateFileSystemEntries(path).Any())
                {
                    var result = await Runtime.RunInMainThread(() => AskForCheckoutPath());

                    if (result == AlertButton.Cancel)
                    {
                        return;
                    }

                    FileService.DeleteDirectory(path);
                    FileService.CreateDirectory(path);
                }

                await vc.CheckoutAsync(path, null, true, Monitor);

                if (Monitor.CancellationToken.IsCancellationRequested)
                {
                    Monitor.ReportSuccess(GettextCatalog.GetString("Checkout operation cancelled"));
                    return;
                }

                if (!System.IO.Directory.Exists(path))
                {
                    Monitor.ReportError(GettextCatalog.GetString("Checkout folder does not exist"), null);
                    return;
                }

                foreach (string str in System.IO.Directory.EnumerateFiles(path, "*", System.IO.SearchOption.AllDirectories))
                {
                    if (MonoDevelop.Projects.Services.ProjectService.IsWorkspaceItemFile(str))
                    {
                        await Runtime.RunInMainThread(delegate {
                            IdeApp.Workspace.OpenWorkspaceItem(str);
                        });

                        break;
                    }
                }

                Monitor.ReportSuccess(GettextCatalog.GetString("Solution checked out"));
            }