private async void btnLoadStream_Click(object sender, RoutedEventArgs e)
        {
            keyList.DataContext = "";
            //setup the stream
            infoText.Content = "Loading data stream";
            await uiE.SetupDataStream(true, accountName.Text, accountKey.Text, homeID.Text, appID.Text, streamID.Text);

            //make a list of keys for this stream
            keys = uiE.GetKeys();
            keyList.DataContext = keys;
            infoText.Content    = "Finished loading data stream";

            btnGetLatest.IsEnabled = true;
        }
 private void timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     if (running)
     {
         // 1. open the datastream
         ExportUI exportUI = new ExportUI();
         exportUI.SetupDataStream(true, accountName.Text, accountKey.Text, homeID.Text, appID.Text, streamID.Text);
         // 2. get latest
         Dictionary <IKey, Tuple <IValue, DateTime> > latestVals = getLatestHelper(exportUI);
         // 3. check rules
         checkRules(latestVals);
         // 4. close datastream
         exportUI.CloseDataStream();
     }
 }