/// <summary> /// Set's Monaco Editor's Theme to the Selected Choice. /// </summary> /// <param name="theme"></param> public void SetTheme(MonacoTheme theme) { if (this.Document != null) { switch ((MonacoTheme)theme) { case MonacoTheme.Dark: this.Document.InvokeScript("SetTheme", new object[] { "Dark" }); break; case MonacoTheme.Light: this.Document.InvokeScript("SetTheme", new object[] { "Light" }); break; } } else { throw new Exception("Cannot set Monaco theme while Document is null."); } }
/// <summary> /// Set's Monaco editor's theme to the selected Choice. /// </summary> /// <param name="theme"></param> public void SetTheme(MonacoTheme theme) { if (!MonacoLoaded) { return; } switch (theme) { case MonacoTheme.Dark: this.ExecuteScriptAsync("SetTheme", "Dark"); break; case MonacoTheme.Light: this.ExecuteScriptAsync("SetTheme", "Light"); break; default: throw new ArgumentOutOfRangeException(nameof(theme), theme, null); } }
/// <summary> /// Set's Monaco Editor's Theme to the Selected Choice. /// </summary> /// <param name="theme"></param> public void SetTheme(MonacoTheme theme) { if (((this.chromeBrowser != null) && (isReady)) && (isReady)) { switch (theme) { case MonacoTheme.Dark: chromeBrowser.ExecuteScriptAsync("SetTheme('Dark')"); break; case MonacoTheme.Light: chromeBrowser.ExecuteScriptAsync("SetTheme('Light')"); break; case MonacoTheme.Black: chromeBrowser.ExecuteScriptAsync("SetTheme('Black')"); break; } } else { Console.WriteLine("Cannot set Monaco theme while browser is not initiated."); } }