示例#1
0
        public HTMLBox addBox(string text = null, Action onClick = null)
        {
            HTMLBox box = new HTMLBox(text, onClick);

            div.AppendChild(box.box);
            list.Add(box);
            sizeElements();
            return(box);
        }
示例#2
0
        public static void addArduinoLightBox(HTMLBoxStructure parent, string text, string url, string json = null)
        {
            HTMLBox box = new HTMLBox(text);

            box.Action(delegate {
                Action <Event> actionError = delegate(Event e) {
                    Bridge.Console.Error("Error", e);
                    box.Color(error, 1000);
                };
                Action <Event> actionSucces = delegate(Event e) {
                    Bridge.Console.Info("Succes", e);
                    box.Color(succes, 1000);
                    Vibrate(250);
                };
                XMLHttpRequest request = new XMLHttpRequest();
                if (json != null)
                {
                    request.Open("POST", url, true);
                    request.SetRequestHeader("Content-Type", "application/json");
                    request.Timeout = 1250;
                    request.Send(json);
                }
                else
                {
                    request.Open("GET", url, true);
                    request.Timeout = 1250;
                    request.Send();
                }
                request.OnTimeout += actionError;
                request.OnAbort   += actionError;
                request.OnError   += actionError;
                request.OnLoad    += (Event e) => {
                    if (request.ResponseText.Contains("Geaccepteerd"))
                    {
                        actionSucces(e);
                    }
                    else
                    {
                        actionError(e);
                    }
                };
            });
            parent.addBox(box);
        }
示例#3
0
 public void addBox(HTMLBox box)
 {
     div.AppendChild(box.box);
     list.Add(box);
     sizeElements();
 }