コード例 #1
0
    private async void MonitorRequestTimeout(HTTPRequest request, int timeout, string url)
    {
        Timer t = new Timer();

        t.WaitTime  = timeout;
        t.Autostart = true;
        Global.Instance.AddChild(t);
        await ToSignal(t, "timeout");

        t.QueueFree();

        if (request.GetHttpClientStatus() == HTTPClient.Status.Connecting ||
            request.GetHttpClientStatus() == HTTPClient.Status.ConnectionError ||
            request.GetHttpClientStatus() == HTTPClient.Status.CantConnect)
        {
            // timed out, log the error and kill the request
            BasicPopup.Notify("Could not connect to server! Connection timed out");
            Global.Error(string.Format("Request to {0} timed out after {1} second(s)", url, timeout));
            request.QueueFree();
        }
    }
コード例 #2
0
 ///////////////////////////////////
 //  Public virtual methods
 ///////////////////////////////////
 public virtual void ShowMenu()
 {
     Global.Log("Here we goooo.");
     BasicPopup.Notify("Building clicked");
 }