/// <summary> /// Initializes a new instance of the MyHost class. Keep /// a reference to the host application object so that it /// can be informed of when to exit. /// </summary> public ScriptingHost(ApplicationSettings settings, RunspaceConfiguration runspaceConfiguration) { this.runspaceConfiguration = runspaceConfiguration; ui = new ScriptingHostUserInterface(settings); pushedRunspaces = new Stack<Runspace>(); privateData = new ScriptingHostPrivateData(this); CloseRunner = false; }
public ScriptingHostRawUserInterface(ApplicationSettings settings) { Output = new OutputBuffer(); backgroundColor = settings.BackgroundColor; foregroundColor = settings.ForegroundColor; cursorPosition = new Coordinates(0, 0); windowPosition = new Coordinates(0, 0); cursorSize = 1; bufferSize = new Size(settings.HostWidth, Int32.MaxValue); windowSize = bufferSize; }
public static ApplicationSettings GetInstance(string applicationName, bool personalizedSettings) { var settingsPath = GetSettingsName(applicationName, personalizedSettings); ApplicationSettings instance = null; lock (instances) { if (instances.ContainsKey(settingsPath)) { instance = instances[settingsPath]; } if (instance == null || !instance.Loaded) { instance = new ApplicationSettings(applicationName); instance.Load(); instances.Add(settingsPath, instance); } } return instance; }
public ScriptingHostUserInterface(ApplicationSettings settings) { rawUi = new ScriptingHostRawUserInterface(settings); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); Settings = ApplicationSettings.GetInstance(ApplicationNames.Context, false); HttpContext.Current.Response.AddHeader("X-UA-Compatible", "IE=edge"); var settings = ApplicationSettings.GetInstance(ApplicationNames.AjaxConsole, false); if (!Context.ClientPage.IsEvent) { Options.Text = @"<script type=""text/JavaScript"" language=""javascript"">" + @"$ise(function() { cognifide.powershell.setOptions({ initialPoll: " + WebServiceSettings.InitialPollMillis + @", maxPoll: " + WebServiceSettings.MaxmimumPollMillis + @" });});</script>" + @"<style>.terminal, .terminal .terminal-output, .terminal .terminal-output div," + @".terminal .terminal-output div div, .cmd, .terminal .cmd span, .terminal .cmd div {" + @"color: " + OutputLine.ProcessHtmlColor(settings.ForegroundColor) + ";" + @"background-color: " + OutputLine.ProcessHtmlColor(settings.BackgroundColor) + ";}</style>"; } }
public ScriptingHostUserInterface(ApplicationSettings settings, ScriptingHost host) { rawUi = new ScriptingHostRawUserInterface(settings); this.host = host; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); Settings = ApplicationSettings.GetInstance(ApplicationNames.Context, false); HttpContext.Current.Response.AddHeader("X-UA-Compatible", "IE=edge"); var settings = ApplicationSettings.GetInstance(ApplicationNames.AjaxConsole, false); if (!Context.ClientPage.IsEvent) { var db = Factory.GetDatabase(ApplicationSettings.ScriptLibraryDb); var fonts = db.GetItem(ApplicationSettings.FontNamesPath); var font = string.IsNullOrEmpty(settings.FontFamily) ? "monospace" : settings.FontFamily; var fontItem = fonts.Children[font]; font = fontItem != null ? fontItem["Phrase"] : "Monaco, Menlo, \"Ubuntu Mono\", Consolas, source-code-pro, monospace"; Options.Text = @"<script type='text/javascript'>" + @"$ise(function() { cognifide.powershell.setOptions({ initialPoll: " + WebServiceSettings.InitialPollMillis + @", maxPoll: " + WebServiceSettings.MaxmimumPollMillis + @", fontSize: " + settings.FontSize + $", fontFamily: '{font}' }});}});</script>" + @"<style>.terminal, .terminal .terminal-output, .terminal .terminal-output div," + @".terminal .terminal-output div div, .cmd, .terminal .cmd span, .terminal .cmd div {" + $"color: {OutputLine.ProcessHtmlColor(settings.ForegroundColor)};" + $"background-color: {OutputLine.ProcessHtmlColor(settings.BackgroundColor)};" + $"font-family: inherit;" + "}</style>"; } SheerResponse.SetDialogValue("ok"); }