public async Task RunAsync(ApplicationArguments args) { try { var projectsSynchronizer = new ProjectsSynchronizer(args); await projectsSynchronizer.MakeResourcesSubdirectoriesAndFilesLowercase(async() => { System.Console.WriteLine("Permissions to change original project has been requested and granted."); return(true); }); projectsSynchronizer.Sync(); } catch (Exception e) { System.Console.WriteLine(e.Message); } }
private static async void TestAsync() { //Just for test without integration to VS: string androidStudio = @"C:\Program Files\Android\Android Studio\bin\studio64.exe"; string testXamarinProject = @"C:\Projects\_[______________\KinderChat\Android\KinderChat.Android.csproj"; var projectsSynchronizer = new ProjectsSynchronizer(testXamarinProject, androidStudio); await projectsSynchronizer.MakeResourcesSubdirectoriesAndFilesLowercase(async() => { System.Console.WriteLine("Permissions to change original projec has been requested. Granted."); return(true); }); projectsSynchronizer.Sync(); }
/// <summary> /// This function is the callback used to execute a command when the a menu item is clicked. /// See the Initialize method to see how the menu item is associated to this function using /// the OleMenuCommandService service and the MenuCommand class. /// </summary> private async void MenuItemCallback(object sender, EventArgs e) { if (string.IsNullOrEmpty(Settings.Default.AnidePath)) { var dlg = new ConfigurationDialog(); dlg.ShowModal(); } if (string.IsNullOrEmpty(Settings.Default.AnidePath)) { return; } try { var envDte = await GetServiceAsync(typeof(DTE)) as DTE; var projectItem = envDte.SelectedItems.OfType <SelectedItem>().First().ProjectItem; var project = projectItem.ContainingProject; //it should have at least one item var fileName = project.FileName; var synchronizer = new ProjectsSynchronizer(fileName, Settings.Default.AnidePath); await synchronizer.MakeResourcesSubdirectoriesAndFilesLowercase(async() => await AskPermissionToChangeCsProj()); await ShowSuggestionsAsync(); synchronizer.Sync(projectItem.FileCount > 0 ? projectItem.FileNames[0] : string.Empty); project.Save(); } catch (OperationCanceledException) { } catch (CsprojEditFailedException exc) { await ShowErrorDuringSync(".csproj edit failed: {0} ", exc); } catch (FileRenameToLowercaseException exc) { await ShowErrorDuringSync("Renaming {0} to lowercase failed: {1}", exc.FileName, exc); } catch (Exception exc) { await ShowErrorDuringSync("General failure: {0}", exc); } }