public void TestEditCode() { VSCodeHandler vsc = new VSCodeHandler("c#"); string newText; bool res = vsc.EditCode("code", out newText); Debugger.Log(0, "", $"{res}"); }
public void TestPastFormatCut() { VSCodeHandler vsc = new VSCodeHandler("code"); vsc.InitialForFormat(); vsc.ChangeLanguageMode("C#"); vsc.PasteFormatCut(); vsc.Close(); }
public void OnOpenInVSCode(IRibbonControl control) { OneNotePageHandler page = new OneNotePageHandler(app); string text = page.GetSelectedText(); var isCell = false; if (string.IsNullOrEmpty(text)) { isCell = true; var cell = page.GetCursorElement("Cell"); if (cell == null) { MessageBox.Show("Please select text or set input cursor into a table."); return; } else { text = page.GetInnerText(cell); } } CopyToClipboard(text); VSCodeHandler codeHandler = new VSCodeHandler(setting.VSCode); if (codeHandler.EditCode(GetDefaultValue("cmbStyle"), out string newText)) { CopyToClipboard(newText); FormatByVSCode(false); wordHandler.PasteAndCopy(true); if (isCell) { // 单元格替换 SendKeys.SendWait("^(aav)"); } else { SendKeys.SendWait("^(v)"); } } }