Ejemplo n.º 1
0
        public static void RequestMatch(jQueryEvent e)
        {
            jQueryObject   button     = jQuery.FromElement(e.CurrentTarget);
            jQueryUIObject dialog     = (jQueryUIObject)jQuery.Select("#challengeDialog");
            jQueryUIObject datePicker = (jQueryUIObject)dialog.Find(".datepicker");

            Utility.WireLocationAutoComplete((jQueryUIObject)dialog.Find(".placesAutoFill"), (jQueryUIObject)dialog.Find(".placesAutoValue"));

            string id = button.GetElement(0).ID;

            datePicker.DatePicker("disable");

            dialog.Dialog(
                new JsonObject(
                    "width", "260",
                    "height", "324",
                    "modal", true,
                    "title", button.GetAttribute("Title"),
                    "buttons", new JsonObject(
                        "Challenge!", (jQueryEventHandler) delegate(jQueryEvent ex)
            {
                CreateMatch(id);
            }
                        ),
                    "open", (Callback) delegate()
            {
                dialog.Find(".comments").Focus();
                datePicker.DatePicker("enable");
            },
                    "position", "top"
                    )
                );
        }
Ejemplo n.º 2
0
        private void ReportScore(jQueryEvent e)
        {
            jQueryObject   button = jQuery.FromElement(e.CurrentTarget);
            jQueryUIObject dialog = (jQueryUIObject)jQuery.Select("#scoredialog");

            string score       = button.Siblings(".score").GetValue();
            string offerId     = button.Siblings(".offerId").GetValue();
            string requestName = button.Siblings(".requestName").GetValue();
            string acceptName  = button.Siblings(".acceptName").GetValue();

            dialog.Find("input").Value("");
            string[] scores = score.Split(", ");

            for (int i = 0; i < scores.Length; ++i)
            {
                string[] parts = scores[i].Split('-');

                jQuery.Select("#request" + i).Value(parts[0]);
                jQuery.Select("#accept" + i).Value(parts[1]);
            }

            dialog.Find(".requestName").Html(requestName);
            dialog.Find(".acceptName").Html(acceptName);

            dialog.Dialog(
                new JsonObject(
                    "width", "210",
                    "height", "305",
                    "modal", "true",
                    "buttons", new JsonObject(
                        "Report Score", (jQueryEventHandler) delegate(jQueryEvent ex)
            {
                PostResults(dialog, offerId);
            }
                        ),
                    "position", "top"
                    )
                );
        }
Ejemplo n.º 3
0
        private static void CreateMatch(string id)
        {
            jQueryUIObject dialog = (jQueryUIObject)jQuery.Select("#challengeDialog");

            string date      = dialog.Find(".datepicker").GetValue();
            string time      = dialog.Find(".time").GetValue();
            string ampm      = dialog.Find(".ampm").GetValue();
            string comments  = dialog.Find(".comments").GetValue();
            string courtData = dialog.Find(".placesAutoValue").GetValue();

            string datetime = date + " " + time + ampm;

            ArrayList ids = new ArrayList();

            dialog.Find(".cities input").Each((ElementIterationCallback) delegate(int index, Element element)
            {
                ids.Add(((CheckBoxElement)element).Value);
            });

            JsonObject parameters = new JsonObject("date", datetime, "locations", ids, "comments", comments, "opponentId", 0);

            QuickMatch.DoCreateMatch(dialog, datetime, ids, courtData, comments, id, (Callback) delegate() { dialog.Dialog("close"); });
        }