public AnotherDataStore(IAddData addData, IGetData getData) { this.addData = addData; this.addData.DataAdded += (s, e) => DataAdded?.Invoke(s, e); this.getData = getData; this.getData.DataRetrieved += (s, e) => DataRetrieved?.Invoke(s, e); }
public void OnDataChange(DataSnapshot snapshot) { float num; if (snapshot.Value != null) { num = (float)snapshot.GetValue(false); } else { num = 0; } DataRetrieved.Invoke(this, new DataEventArgs { dataPoint = num }); }
protected virtual void OnDataRetrieve(AMCPEventArgs e) { if (e.Error == AMCPError.FileNotFound) { DataRetrieved?.Invoke(this, new DataRetrieveEventArgs(string.Empty)); } if (e.Error == AMCPError.None && e.Data.Any()) { DataRetrieved?.Invoke(this, new DataRetrieveEventArgs(e.Data.FirstOrDefault())); } else { DataRetrieved?.Invoke(this, new DataRetrieveEventArgs(string.Empty)); } }
private async Task <bool> PollDataAsync() { var request = new DataPullRequest { RequestId = Guid.NewGuid().ToString(), DestinationNode = DestinationNode }; var pullResponse = Client.PullData(request); if (await pullResponse.ResponseStream.MoveNext() && !string.IsNullOrEmpty(pullResponse.ResponseStream.Current.Name)) { var responseStreamContext = new ResponseStreamContext <DataPullResponse>(pullResponse.ResponseStream.Current, pullResponse.ResponseStream); DataRetrieved?.Invoke(this, responseStreamContext); return(true); } return(false); }
/// <summary> /// Once a valid access token is retrieved, place the GET request to retrieve /// RemoteConfig data from firebase. /// </summary> private static void PlaceRemoteConfigGetRequest() { var req = UnityWebRequest.Get(remoteConfigUrl); req.SetRequestHeader("Authorization", $"Bearer {accessToken}"); req.SendWebRequest().completed += op => { if (!op.isDone) { return; } if (req.responseCode == 401L) { // Access Token has expired - get a new one and retry. accessToken = null; GetAccessToken(PlaceRemoteConfigGetRequest); return; } SetCurrentData(req.downloadHandler.text); DataRetrieved?.Invoke(CurrentData, CurrentData); }; }
internal void OnDataRetrieved(string data) { DataRetrieved?.Invoke(this, new DataEventArgs(data)); }
private void OnPullDataRetrieved(object sender, ResponseStreamContext <DataPullResponse> e) { DataRetrieved?.Invoke(sender, e); }
public void CallDataRetrieved(GetDataEventArgs e) { DataRetrieved?.Invoke(this, e); }
internal void Get(int pageNumber, int pageSize, Dictionary parameters, DataRetrieved dataRetrievedCallback, NoDataRetrieved noDataRetrievedCallback) { this.dataRetrievedCallback = dataRetrievedCallback; this.noDataRetrievedCallback = noDataRetrievedCallback; this.pageNumber = pageNumber; this.pageSize = pageSize; this.parameters = parameters; this.key = GetKey(parameters); object[] requestedPageData = new object[0]; // leave as zero in declaration to fill up and expand later bool someRequestedDataIsNotInTheCacheAlready = false; // 1, 10: 0..9 for (int i = (pageNumber - 1) * pageSize; i < pageNumber * pageSize - 1; i++) { if (cachedData[i] != null) { if (cachedData[i] is NoMoreData) { break; } requestedPageData[requestedPageData.Length] = cachedData[i]; } else { someRequestedDataIsNotInTheCacheAlready = true; break; } } if (someRequestedDataIsNotInTheCacheAlready && !thereIsNoMoreDataInDatabase) { int cachePageSize = cachePageSizeMultiplier * pageSize; this.firstRowIndexToGet = (int)Math.Floor((pageNumber - 1) / cachePageSizeMultiplier) * cachePageSize; this.lastRowIndexToGet = firstRowIndexToGet + cachePageSize - 1; if (this.cachedData != null) { // 1, 10: 0..9 for (; firstRowIndexToGet < lastRowIndexToGet; firstRowIndexToGet++) { if (this.cachedData[firstRowIndexToGet] == null) { break; } } } provider.CallWebService(this.firstRowIndexToGet, this.lastRowIndexToGet + 1, parameters, successCallback, failureCallback, null); } else { dataRetrievedCallback(requestedPageData, this.totalKnownDataItems, !this.thereIsNoMoreDataInDatabase); } }
private void startTestToolStripMenuItem_Click(object sender, EventArgs e) { _reading = true; graphTrans.GraphPane.CurveList.Clear(); graphTrans.AxisChange(); graphTrans.Refresh(); DAQTestHarness.DAQTest daTest1 = new DAQTestHarness.DAQTest(0); LineItem lItem = graphTrans.GraphPane.AddCurve("Test", null, Color.Red, ZedGraph.SymbolType.None); _daqInterface = new DAQTestHarness.DAQInterfaceTest(); _daqInterface.Setup(new DataRetrieved(RetrievedData), new IDAQ[] { daTest1 }); DataRetrieved dataRetrieved = new DataRetrieved(RetrievedData); _readingThread = new Thread(new ThreadStart(_daqInterface.StartReading)); _readingThread.Start(); }
private void RetrievedData(Dictionary<IDAQ, IDAQPoint[]> readings) { if (this.InvokeRequired) { lock (this) { if (!_reading) { return; } DataRetrieved dr = new DataRetrieved(RetrievedData); this.Invoke(dr, new object[] { readings }); return; } } if (!_reading) { return; } graphTrans.GraphPane.Legend.IsVisible = true; int curveListIndex = 0; foreach (KeyValuePair<IDAQ, IDAQPoint[]> readingItem in readings) { foreach (IDAQPoint point in readingItem.Value) { graphTrans.GraphPane.CurveList[curveListIndex].AddPoint(point.Time, point.PSI); } curveListIndex++; } graphTrans.AxisChange(); graphTrans.Refresh(); }
public void Setup(DataRetrieved dataRetrieved, IDAQ[] daqs) { _daqArray = daqs; _dataRetrieved = dataRetrieved; }