예제 #1
0
        public void ShowMessage(string message, UserFeedbackLevel level)
        {
            string levelLowercased = level.ToString().ToLower();
            var    m = message.Replace("\n", "\\n").Replace("'", "\\'");

            if (!string.IsNullOrEmpty(message))
            {
                if (_browser.IsBrowserInitialized)
                {
                    _browser.ExecuteScriptAsync($"{Dispatch}(data.showMessage('{m}', '{levelLowercased}'));");
                }
                else
                {
                    Logger.Warn($"Attempted to display message \"{message}\" but browser is not yet initialized");
                }
            }
        }
예제 #2
0
        public void ShowMessage(string message, UserFeedbackLevel level, string helpUrl = null)
        {
            string levelLowercased = level.ToString().ToLowerInvariant();
            var    m = message.Replace("\n", "\\n").Replace("'", "\\'");

            if (!string.IsNullOrEmpty(message))
            {
                if (BrowserControl.CanExecuteJavascriptInMainFrame)
                {
                    var ret = new Dictionary <string, string> {
                        { "message", m },
                        { "type", levelLowercased }
                    };

                    BrowserControl.ExecuteScriptAsync("window.showMessage", JsonConvert.SerializeObject(ret, _settings));
                }
                else
                {
                    Logger.Warn($"Attempted to display message \"{message}\" but browser is not yet initialized");
                }
            }
        }
예제 #3
0
        public void ShowMessage(string message, UserFeedbackLevel level, string helpUrl = null)
        {
            string levelLowercased = level.ToString().ToLowerInvariant();
            var    m = message.Replace("\n", "\\n").Replace("'", "\\'");

            if (!string.IsNullOrEmpty(message))
            {
                if (_browser.CanExecuteJavascriptInMainFrame)
                {
                    if (!string.IsNullOrEmpty(helpUrl))
                    {
                        _browser.ExecuteScriptAsync($"{Dispatch}(data.showMessage('{m}', '{levelLowercased}', '{helpUrl}'));");
                    }
                    else
                    {
                        _browser.ExecuteScriptAsync($"{Dispatch}(data.showMessage('{m}', '{levelLowercased}', undefined));");
                    }
                }
                else
                {
                    Logger.Warn($"Attempted to display message \"{message}\" but browser is not yet initialized");
                }
            }
        }
예제 #4
0
 public UserFeedback(UserFeedbackLevel level, string message, string url)
 {
     this.Level   = level;
     this.Message = message;
 }