Esempio n. 1
0
        public MainPage()
        {
            this.InitializeComponent();
            StatusField.Text = "Please ensure the sensor is connected";

            tagreader = new TagReaderService();

            eventHubWriterTimer = new DispatcherTimer();
            eventHubWriterTimer.Interval = new TimeSpan(0, 0, 1);
            eventHubWriterTimer.Tick += OnEventHubWriterTimerTick;

            localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            if(ServiceBusNamespaceField.Text == string.Empty)    ServiceBusNamespaceField.Text = Convert.ToString(localSettings.Values["ServiceBusNamespaceField"]);
            if(EventHubNameField.Text == string.Empty)           EventHubNameField.Text = Convert.ToString(localSettings.Values["EventHubNameField"]);
            if(SharedAccessPolicyNameField.Text == string.Empty) SharedAccessPolicyNameField.Text = Convert.ToString(localSettings.Values["SharedAccessPolicyNameField"]);
            if(SharedAccessPolicyKeyField.Text == string.Empty)  SharedAccessPolicyKeyField.Text = Convert.ToString(localSettings.Values["SharedAccessPolicyKeyField"]);
            if(SensorNameField.Text == string.Empty)             SensorNameField.Text = Convert.ToString(localSettings.Values["SensorNameField"]);

            getVersionNumberOfApp();

        }
Esempio n. 2
0
        private async Task startTracking()
        {
            // get the list of devices to track
            await deviceInfoService.Initialize();

            SensorInformation.Text = "";
            foreach (GattDeviceService deviceService in deviceInfoService.deviceServices)
            {
                TagReaderService tagReader = new TagReaderService();
                await tagReader.InitializeSensor();
                SensorInformation.Text += await tagReader.GetSensorID(deviceService);
                if (tagReader != null)
                    this.tagReaders.Add(tagReader);
            }


            eventHubService = new EventHubService(app.ServiceBusNamespace,
            app.EventHubName, app.SharedAccessPolicyName, app.SharedAccessPolicyKey);

            //StatusField.Text = "The sensor is connected";
            txtError.Text = "";
            eventHubWriterTimer.Start();
            StartCommand.Content = "Stop";
            StartCommand.Tag = "STARTED";


            numberOfFailedCallsToEventHub = numberOfCallsDoneToEventHub = 0;
            EventHubInformation.Text = $"Calls: {numberOfCallsDoneToEventHub}, Failed Calls: {numberOfFailedCallsToEventHub}";
        }