public void SendNotification(NotificationType notificationType, string message, int timeout = 1000)
        {
            string t;

            switch (notificationType)
            {
            case NotificationType.Info:
            default:
                t = "info";
                break;

            case NotificationType.Danger:
                t = "error";
                break;

            case NotificationType.Warning:
                t = "warning";
                break;

            case NotificationType.Success:
                t = "success";
                break;
            }
            AttachedBrowser.ExecuteScriptAsyncWhenPageLoaded("toastr." + t + "('" + HttpUtility.JavaScriptStringEncode(message) + "', '', {timeOut: " + timeout + "});");
        }
Esempio n. 2
0
 public void Dispose()
 {
     if (AttachedBrowser != null)
     {
         AttachedBrowser.Dispose();
         AttachedBrowser = null;
     }
 }
 public void ApplyUser(OsuUser user)
 {
     if (displayedUser == null || displayedUser.ID != user.ID)
     {
         BrowserViewModel.Instance.AttachedBrowser.ExecuteScriptAsyncWhenPageLoaded("$(\"#tab_session_loader_view\").show();");
         BrowserViewModel.Instance.AttachedBrowser.ExecuteScriptAsyncWhenPageLoaded("$(\"#tab_session_default_view\").hide();");
         RegionInfo countryInfo = new RegionInfo(user.CountryCode);
         string     query       = "" +
                                  "$('#sessionUsername').html('" + user.Name + "');" +
                                  //"$('#sessionFlag').attr('src', './img/flags/" + user.CountryCode + ".png');" +
                                  //"$('#sessionFlag').attr('data-original-title', '" + (countryInfo.DisplayName) + "');" +
                                  "$('#sessionFlag').html('<i data-toggle=\"tooltip\" title=\"" + countryInfo.DisplayName + "\" class=\"material-tooltip-main twf twf-s twf-" + user.CountryCode.ToLower() + "\"></i>');" +
                                  "$('#sessionProfileImage').attr('src', 'https://a.ppy.sh/" + user.ID + "');" +
                                  "$('#sessionHeaderImage').attr('src', '" + ApiHelper.GetOsuUserHeaderUrl("https://osu.ppy.sh/users/" + user.ID) + "');" +
                                  "$('[data-toggle=\"tooltip\"]').tooltip();" +
                                  "";
         AttachedBrowser.ExecuteScriptAsyncWhenPageLoaded(query);
         BrowserViewModel.Instance.AttachedBrowser.ExecuteScriptAsyncWhenPageLoaded("$(\"#tab_session_loader_view\").hide();");
         BrowserViewModel.Instance.AttachedBrowser.ExecuteScriptAsyncWhenPageLoaded("$(\"#tab_session_default_view\").show();");
         displayedUser = user;
     }
 }
 public void ApplySession(Session session)
 {
     AttachedBrowser.ExecuteScriptAsyncWhenPageLoaded("ApplySession('" + session.ConvertToJson() + "', " + Convert.ToInt32(SettingsManager.Instance.Settings["display"]["roundingValue"]) + ");");
 }
 public void LoadPage(string page)
 {
     AttachedBrowser.Load(string.Format(@"{0}\wwwroot\" + page, FileManager.GetExecutableDirectory()));
 }