/// <summary> /// Shows the dialog to select users from the player grid /// </summary> /// <param name="e"></param> private void SelectUserDialog(jQueryEvent e) { jQueryObject button = jQuery.FromElement(e.CurrentTarget); // Get the offer id from the button's attribute string offerId = button.GetAttribute("data-offerId"); // Find the user selection dialog and communicate the offer id to the dialog so it can be posted on the dialog's select user event jQueryUIObject dialog = (jQueryUIObject)jQuery.Select("#playerGridCard"); dialog.Children().First().Html("Loading..."); dialog.Attribute("data-offerId", offerId); // Post the request to get the users who have accepted this offer JsonObject parameters = new JsonObject("page", 0, "offerId", offerId); jQuery.Post("/services/AcceptPlayerGrid?signed_request=" + Utility.GetSignedRequest(), Json.Stringify(parameters), (AjaxRequestCallback <object>) delegate(object data, string textStatus, jQueryXmlHttpRequest <object> request) { Utility.ProcessResponse((Dictionary)data); } ); // Display the dialog in modal fashion dialog.Dialog( new JsonObject( "width", jQuery.Window.GetWidth() - 120, "height", jQuery.Window.GetHeight() - 40, "modal", true, "title", "Select Your Opponent", "closeOnEscape", true, "position", "top" ) ); }
private void MoreClick(jQueryEvent e) { jQueryUIObject dialog = (jQueryUIObject)jQuery.Select("#playerGridCard"); dialog.Children().First().Html("Loading..."); JsonObject parameters = new JsonObject("page", 0); jQuery.Post("/services/PlayerGrid?signed_request=" + Utility.GetSignedRequest(), Json.Stringify(parameters), (AjaxRequestCallback <object>) delegate(object data, string textStatus, jQueryXmlHttpRequest <object> request) { Utility.ProcessResponse((Dictionary)data); } ); dialog.Dialog( new JsonObject( "width", jQuery.Window.GetWidth() - 40, "height", jQuery.Window.GetHeight() - 20, "modal", true, "title", "Similar Players", "closeOnEscape", true, "position", "top" ) ); }
/// <summary> /// Popup for the calendar page showing potential and accepted offers by date. /// </summary> /// <param name="ev"></param> public static void Calendar(jQueryEvent ev) { jQueryUIObject dialog = (jQueryUIObject)jQuery.Select("#calendarCard"); dialog.Children().First().Html("Loading..."); JsonObject parameters = new JsonObject("page", 0); jQuery.Post("/services/Calendar?signed_request=" + Utility.GetSignedRequest(), Json.Stringify(parameters), (AjaxRequestCallback <object>) delegate(object data, string textStatus, jQueryXmlHttpRequest <object> request) { Utility.ProcessResponse((Dictionary)data); } ); // BUGBUG: currently the sizes are hard-coded and too big - need to fix this. dialog.Dialog( new JsonObject( "width", jQuery.Window.GetWidth() - 120, "height", jQuery.Window.GetHeight() - 40, "modal", true, "closeOnEscape", true, "title", "Calendar", "position", "top" ) ); }