Esempio n. 1
0
 public QuoteProvider(string[] symbols, string username, string password)
 {
     this._symbols = symbols;
     this._username = username;
     this._password = password;
     this._jsonApi = new JSONApi();
     this._jsonApi.OnConnected += new ConnectedEventHandler(this._jsonApi_OnConnected);
     this._jsonApi.OnStatusChanged += new StatusChangedEventHandler(this._jsonApi_OnStatusChanged);
     this._jsonApi.OnStreamingUpdate += new StreamingUpdateEventHandler(this._jsonApi_OnStreamingUpdate);
     this._jsonApi.OnDisconnected += new DisconnectedEventHandler(this._jsonApi_OnDisconnected);
     this._jsonApi.DefaultDataProvider = "netdania_fxa";
     this._jsonApi.setConnectParams("http://balancer.netdania.com/StreamingServer/StreamingServer", this._username, this._password);
     this._jsonApi.selectProtocol((byte)1);
     this._jsonApi.setPollingInterval(500);
     this._jsonApi.Connect();
 }
Esempio n. 2
0
    IEnumerator GetInfo()
    {
        imageName = Path.Combine(Application.streamingAssetsPath, "foto.jpeg");
        byte[] bytesImage = UnityEngine.Windows.File.ReadAllBytes(imageName);

        var headers = new Dictionary <string, string>()
        {
            { "Ocp-Apim-Subscription-Key", visionKey },
            { "Content-Type", "application/octet-stream" }
        };

        WWW www = new WWW(resourceURL, bytesImage, headers);

        yield return(www);

        responseData = www.text;
        Debug.Log(responseData);
        JSONApi answer = JsonConvert.DeserializeObject <JSONApi>(www.text);

        GameObject.Find("Response").GetComponent <Text>().text = answer.categories[0].detail.landmarks[0].name.ToString().ToUpper();
    }
Esempio n. 3
0
 private void Reconnect()
 {
     Task.Delay(10000).Wait();
     //Thread.Sleep(10000);
     if (this._isConnected)
         return;
     this._jsonApi = (JSONApi)null;
     GC.Collect();
     this._jsonApi = new JSONApi();
     this._jsonApi.OnConnected += new ConnectedEventHandler(this._jsonApi_OnConnected);
     this._jsonApi.OnStatusChanged += new StatusChangedEventHandler(this._jsonApi_OnStatusChanged);
     this._jsonApi.OnStreamingUpdate += new StreamingUpdateEventHandler(this._jsonApi_OnStreamingUpdate);
     this._jsonApi.OnDisconnected += new DisconnectedEventHandler(this._jsonApi_OnDisconnected);
     this._jsonApi.DefaultDataProvider = "netdania_fxa";
     this._jsonApi.setConnectParams("http://balancer.netdania.com/StreamingServer/StreamingServer", this._username, this._password);
     this._jsonApi.selectProtocol((byte)1);
     this._jsonApi.setPollingInterval(500);
     this._jsonApi.Connect();
 }