Exemple #1
0
        async void WifiSettingsPage_Loaded(object sender, RoutedEventArgs e)
        {
            ComboBoxWifi.Focus(Windows.UI.Xaml.FocusState.Programmatic);

            deviceParams = await device.GetParams();

            ShowParameters(deviceParams);

            CheckBoxAll.Visibility = (DataStore.Instance.Cameras.Count < 2) ? Visibility.Collapsed : Visibility.Visible;
        }
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            // bring up camera details page...
            Log.WriteLine("FoscamDetailsPage OnNavigatedTo");

            CameraInfo camera = (CameraInfo)e.Parameter;

            device = new FoscamDevice()
            {
                CameraInfo = camera
            };

            device.Error           += OnDeviceError;
            device.FrameAvailable  += OnFrameAvailable;
            camera.PropertyChanged += OnCameraPropertyChanged;

            if (camera.UpdateAvailable != null)
            {
                //ButtonUpdate.Visibility = Windows.UI.Xaml.Visibility.Visible;
            }

            this.Reconnect();

            this.DataContext = camera;

            if (camera.IpAddress != null)
            {
                deviceParams = await device.GetParams();

                ShowParameters(deviceParams);
            }

            OnRotationChanged();

            //SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested;

            if (camera.IpAddress != null)
            {
                var p = await device.GetCameraParams();

                if (p.HasValue("brightness"))
                {
                    device.CameraInfo.Brightness = p.GetValue <byte>("brightness");
                }
                if (p.HasValue("contrast"))
                {
                    device.CameraInfo.Contrast = p.GetValue <byte>("contrast");
                }
            }
        }