Пример #1
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            telemetryPage = this;
            if (IsFirstTime)
            {
                LoadConSettings();
            }

            service_cs = Azure_IoTHub_Connections.MyConnections.IoTHubConnectionString;
            device_id  = Azure_IoTHub_Connections.MyConnections.DeviceId;
            device_cs  = Azure_IoTHub_Connections.MyConnections.DeviceConnectionString;


            if (IsFirstTime)
            {
                AppBarButton_Click(BtnFeatureMode, null);
                AppBarButton_Click(BtnFeatureMode2, null);

                ListviewTransports2.ItemsSource  = ListEnum;
                ListviewTransports2.SelectedItem = Azure_IoTHub_DeviceStreaming.DeviceStreamingCommon.device_transportType;
                ListviewTransports2.ScrollIntoView(ListviewTransports2.SelectedItem);
                Azure_IoTHub_Connections.MyConnections.OnStatusUpdateD = OnSvcStatusUpdate;
                LstDeviceAction.ItemsSource  = ListEnum2;
                LstDeviceAction.SelectedItem = ListEnum2[1];
                LstDeviceAction.ScrollIntoView(ListEnum2[1]);
                if (Azure_IoTHub_Toolbox_App.AppSettingsValues.Settings.AutoStartDevice)
                {
                    Button_Click_Device(null, null);
                }

                if (Azure_IoTHub_Toolbox_App.AppSettingsValues.Settings.AutoStartSvc)
                {
                    Button_Click_Svc(null, null);
                }
                IsFirstTime = false;
                //tbTelemetryDelay.DataContext = Azure_IoTHub_Connections.MyConnections.TelemetryDelayBtwReadings;
                this.DataContext = Azure_IoTHub_Toolbox_App.AppSettingsValues.Settings;
            }
        }
Пример #2
0
        private void  NavigationView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
        {
            if (args.IsSettingsSelected)
            {
                DoSettings();
            }
            else
            {
                switch (currentPage)
                {
                case 0:
                    NewHub.Stop();
                    break;

                case 1:
                    HomePage.Stop();
                    break;

                case 2:
                    MainPage.Stop();
                    break;

                case 3:
                    TelemetryPage.Stop();
                    break;

                case 4:
                    ControlDeviceTelemetryPage.Stop();
                    break;

                case 5:
                    break;

                case 6:
                    break;

                case 7:
                    break;
                }
                var eventargs = (NavigationViewSelectionChangedEventArgs)args;
                if (int.TryParse((string)((Control)eventargs.SelectedItem).Tag, out int newPage))
                {
                    if ((new List <int>()
                    {
                        1, 2, 3, 4, 5, 6, 7
                    }).Contains(newPage))                                           //,8}).Contains(newPage))
                    {
                        currentPage = newPage;

                        switch (currentPage)
                        {
                        case 1:
                            NavigationFrame.Navigate(typeof(Pages.HomePage), false);
                            break;

                        case 2:
                            NavigationFrame.Navigate(typeof(Pages.MainPage), null);
                            break;

                        case 3:
                            NavigationFrame.Navigate(typeof(Pages.TelemetryPage), null);
                            break;

                        case 4:
                            NavigationFrame.Navigate(typeof(Pages.ControlDeviceTelemetryPage), null);
                            break;

                        //case 8:
                        //    NavigationFrame.Navigate(typeof(Pages.ProxyPage), null);
                        //    break;
                        case 5:
                            NavigationFrame.Navigate(typeof(Pages.DeployToDevice), null);
                            break;

                        case 6:
                            NavigationFrame.Navigate(typeof(Pages.LinksPage), null);
                            break;

                        case 7:
                            NavigationFrame.Navigate(typeof(Pages.AboutPage), true);
                            break;
                        }
                    }
                }
            }
        }