예제 #1
0
        void ActivatedFirstTime()
        {
            ScriptIDE.ScriptParamBase = new BotSharp.ScriptParam
            {
                ImportAssembly    = Script.ToScriptImport.ImportAssembly?.ToArray(),
                ImportNamespace   = Limbara.Script.ToScriptImport.ImportNamespace?.ToArray(),
                CompilationOption = BotSharp.CodeAnalysis.CompilationOption.Default,

                ScriptRunClientBuildDelegate = ScriptRunClientBuild,
                CompilationGlobalsType       = ToScriptGlobalsConstruct(null)?.GetType(),
            };

            ScriptIDE.ChooseScriptFromIncludedScripts.SetScript =
                ListScriptIncluded?.Select(scriptIdAndContent => new KeyValuePair <string, Func <string> >(scriptIdAndContent.Key, () => scriptIdAndContent.Value))?.ToArray();
            ScriptIDE.ScriptWriteToOrReadFromFile.DefaultFilePath = DefaultScriptPath;
            ScriptIDE.ScriptWriteToOrReadFromFile.ReadFromFile();

            if ((ScriptIDE.Editor.Document.Text).IsNullOrEmpty())
            {
                ScriptIDE.Editor.Document.Text = ListScriptIncluded?.FirstOrDefault().Value ?? "";
            }

            Window?.AddHandler(System.Windows.Controls.Primitives.ButtonBase.ClickEvent, new RoutedEventHandler(ButtonClicked));

            Window?.Main?.ConfigFromModelToView(ExeConfig.Default);

            ConfigFileControl.DefaultFilePath         = ConfigFilePath;
            ConfigFileControl.CallbackGetValueToWrite = ConfigReadFromUISerialized;
            ConfigFileControl.CallbackValueRead       = ConfigWriteToUIDeSerialized;
            ConfigFileControl.ReadFromFile();

            MainControl.Interface.LicenseDataContext.LicenseKeyStore = LicenseKeyStore;

            TimerConstruct();
        }
예제 #2
0
        void ActivatedFirstTime()
        {
            ScriptIDE.ScriptParamBase = new BotSharp.ScriptParam()
            {
                ImportAssembly  = Script.ToScriptImport.ImportAssembly?.ToArray(),
                ImportNamespace = Sanderling.Script.Impl.ToScriptImport.ImportNamespace?.ToArray(),

                ScriptRunClientBuildDelegate = ScriptRunClientBuild,

                CompilationGlobalsType = typeof(Sanderling.Script.ToScriptGlobals),
            };

            ScriptIDE.ChooseScriptFromIncludedScripts.SetScript =
                ListScriptIncluded?.Select(scriptIdAndContent => new KeyValuePair <string, Func <string> >(scriptIdAndContent.Key, () => scriptIdAndContent.Value))?.ToArray();

            ScriptIDE.ScriptWriteToOrReadFromFile.DefaultFilePath = DefaultScriptPath;
            ScriptIDE.ScriptWriteToOrReadFromFile?.ReadFromFile();
            if (!(0 < ScriptIDE.Editor.Document.Text?.Length))
            {
                ScriptIDE.Editor.Document.Text = ListScriptIncluded?.FirstOrDefault().Value ?? "";
            }

            Window.KeyDown += Window_KeyDown;
            Window?.AddHandler(System.Windows.Controls.Primitives.ButtonBase.ClickEvent, new RoutedEventHandler(ButtonClicked));

            TimerConstruct();
        }
예제 #3
0
        void ActivatedFirstTime()
        {
            ScriptIDE.ScriptRunGlobalsFunc = ToScriptGlobalsConstruct;

            ScriptIDE.ScriptParamBase = new BotScript.ScriptParam()
            {
                ImportAssembly    = Script.ToScriptImport.ImportAssembly?.ToArray(),
                ImportNamespace   = Sanderling.Script.ToScriptImport.ImportNamespace?.ToArray(),
                CompilationOption = new BotScript.CodeAnalysis.CompilationOption()
                {
                    InstrumentationOption = BotScript.CodeAnalysis.Default.InstrumentationOption,
                },
                PreRunCallback = new Action <BotScript.ScriptRun>(ScriptRun =>
                {
                    ScriptRun.InstrumentationCallbackSynchronousFirstTime = new Action <BotScript.SourceLocation>(ScriptSourceLocation =>
                    {
                        //	make sure script runs on same culture independend of host culture.
                        System.Threading.Thread.CurrentThread.CurrentCulture = Parse.Culture.ParseCulture;
                    });
                }),
            };

            ScriptIDE.ChooseScriptFromIncludedScripts.SetScript =
                ListScriptIncluded?.Select(ScriptIdAndContent => new KeyValuePair <string, Func <string> >(ScriptIdAndContent.Key, () => ScriptIdAndContent.Value))?.ToArray();

            ScriptIDE.ScriptWriteToOrReadFromFile.DefaultFilePath = DefaultScriptPath;
            ScriptIDE.ScriptWriteToOrReadFromFile?.ReadFromFile();
            if (!(0 < ScriptIDE.Editor.Document.Text?.Length))
            {
                ScriptIDE.Editor.Document.Text = ListScriptIncluded?.FirstOrDefault().Value ?? "";
            }

            Window.KeyDown += Window_KeyDown;
            Window?.AddHandler(System.Windows.Controls.Primitives.ButtonBase.ClickEvent, new RoutedEventHandler(ButtonClicked));

            Window?.Main?.ConfigFromModelToView(ConfigDefaultConstruct());

            ConfigFileControl.DefaultFilePath         = ConfigFilePath;
            ConfigFileControl.CallbackGetValueToWrite = ConfigReadFromUISerialized;
            ConfigFileControl.CallbackValueRead       = ConfigWriteToUIDeSerialized;
            ConfigFileControl.ReadFromFile();

            TimerConstruct();
        }