//private static void OnProcessCmdKeyEvent(object sender, ProcessCmdKeyEventArgs args) //{ // Action act; // if (canvasController.Canvas.Focused && keyActions.TryGetValue(args.KeyData, out act)) // { // act(); // args.Handled = true; // } //} private static void ElementSelected(object controller, ElementEventArgs args) { elementProperties = null; if (args.Element != null) { GraphicElement el = args.Element; elementProperties = el.CreateProperties(); string code; el.Json.TryGetValue("Code", out code); if (el.GetType().Name == "PythonFileBox" || el.GetType().Name == "HtmlFileBox") { pythonCodeEditorService.SetText(code ?? String.Empty); } else { csCodeEditorService.SetText(code ?? String.Empty); } } else { pythonCodeEditorService.SetText(String.Empty); csCodeEditorService.SetText(String.Empty); } propGrid.SelectedObject = elementProperties; canvasController.Canvas.Focus(); }
protected void OnElementSelected(object controller, ElementEventArgs args) { ElementProperties elementProperties = null; IFlowSharpCodeEditorService csCodeEditorService = ServiceManager.Get <IFlowSharpCodeEditorService>(); IFlowSharpScintillaEditorService editorService = ServiceManager.Get <IFlowSharpScintillaEditorService>(); if (args.Element != null) { GraphicElement el = args.Element; System.Diagnostics.Trace.WriteLine("*** ON ELEMENT SELECTED " + el.Id.ToString()); elementProperties = el.CreateProperties(); if (!String.IsNullOrEmpty(csCodeEditorService.Filename)) { // Save last position. int curpos = csCodeEditorService.GetPosition(); fileCaretPos[csCodeEditorService.Filename] = curpos; System.Diagnostics.Trace.WriteLine("*** " + csCodeEditorService.Filename + " => SET CURRENT POS: " + curpos); } string code; el.Json.TryGetValue("Code", out code); csCodeEditorService.SetText("C#", code ?? String.Empty); string fn = el.Id.ToString(); // Use something that is unique for this shape's code. System.Diagnostics.Trace.WriteLine("*** " + fn + " => SET ID"); csCodeEditorService.Filename = fn; // Set the last known position if we have one. int pos; if (fileCaretPos.TryGetValue(fn, out pos)) { System.Diagnostics.Trace.WriteLine("*** " + fn + " => SET PREVIOUS POS: " + pos); csCodeEditorService.SetPosition(pos); } else { // A newly seen document, set the caret to pos 0 so the editor doesn't retain // the previous scrollbar location. csCodeEditorService.SetPosition(0); } el.Json.TryGetValue("python", out code); editorService.SetText("python", code ?? String.Empty); } else { csCodeEditorService.SetText("C#", String.Empty); editorService.SetText("python", String.Empty); } }
protected void OnElementSelected(object controller, ElementEventArgs args) { ElementProperties elementProperties = null; if (args.Element != null) { GraphicElement el = args.Element; elementProperties = el.CreateProperties(); string code; el.Json.TryGetValue("Code", out code); csCodeEditorService.SetText(code ?? String.Empty); } else { csCodeEditorService.SetText(String.Empty); } }
protected void OnElementSelected(object controller, ElementEventArgs args) { ElementProperties elementProperties = null; IFlowSharpCodeEditorService csCodeEditorService = ServiceManager.Get <IFlowSharpCodeEditorService>(); IFlowSharpScintillaEditorService editorService = ServiceManager.Get <IFlowSharpScintillaEditorService>(); if (args.Element != null) { GraphicElement el = args.Element; elementProperties = el.CreateProperties(); string code; el.Json.TryGetValue("Code", out code); csCodeEditorService.SetText("C#", code ?? String.Empty); el.Json.TryGetValue("python", out code); editorService.SetText("python", code ?? String.Empty); } else { csCodeEditorService.SetText("C#", String.Empty); editorService.SetText("python", String.Empty); } }