|
@@ -1,6 +1,7 @@
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.ComponentModel;
|
|
|
+using System.Linq;
|
|
|
using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
using System.Windows.Media;
|
|
@@ -8,19 +9,20 @@ using InABox.Core;
|
|
|
|
|
|
namespace InABox.DynamicGrid
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
public class ScriptEditorControl : DynamicEditorControl<string>
|
|
|
{
|
|
|
private Button Editor;
|
|
|
|
|
|
private string script = "";
|
|
|
- public event OnScriptEditorCalled OnScriptEditorCalled;
|
|
|
public ScriptEditorControl()
|
|
|
{
|
|
|
SyntaxLanguage = SyntaxLanguage.CSharp;
|
|
|
}
|
|
|
public SyntaxLanguage SyntaxLanguage { get; set; }
|
|
|
|
|
|
+ public event OnEditorClicked OnEditorClicked;
|
|
|
+
|
|
|
protected override FrameworkElement CreateEditor()
|
|
|
{
|
|
|
Editor = new Button
|
|
@@ -37,6 +39,27 @@ namespace InABox.DynamicGrid
|
|
|
}
|
|
|
|
|
|
private void Editor_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ if (EditorDefinition.GetType() == typeof(ScriptEditor))
|
|
|
+ {
|
|
|
+ CheckTemplateEditor();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ ShowEditor();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CheckTemplateEditor()
|
|
|
+ {
|
|
|
+ var edt = EditorDefinition as ScriptEditor;
|
|
|
+
|
|
|
+ if (edt.Type == ScriptEditorType.TemplateEditor)
|
|
|
+ edt.InvokeEvent();
|
|
|
+
|
|
|
+ else
|
|
|
+ ShowEditor();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ShowEditor()
|
|
|
{
|
|
|
var editor = new ScriptEditorWindow(script, SyntaxLanguage);
|
|
|
if (editor.ShowDialog() == true)
|
|
@@ -46,6 +69,7 @@ namespace InABox.DynamicGrid
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
public override int DesiredHeight()
|
|
|
{
|
|
|
return 25;
|