示例#1
0
            public RscOptItemDesc()
            {
                m_grp = null;

                m_strTitle = "N/A";
                m_bCurrent = false;

                m_imgChb = null;

                Tag = null;
            }
示例#2
0
            public RscOptItemDesc(RscOptItemDesc grp)
            {
                m_grp = grp;
                m_grp.m_aOpts.Add(this);

                m_strTitle = "N/A";
                m_bCurrent = false;

                m_imgChb = null;

                Tag = null;
            }
示例#3
0
        private void AddOpt(RscOptItemDesc it)
        {
            int idx = spOpts.Children.Count + 1;

            Grid grdOut = new Grid();

            grdOut.Name = "grdOut_" + idx.ToString();
            if (it.Group && idx > 1)
            {
                grdOut.Margin = new Thickness(0, 12, 0, 4);
            }
            else
            {
                grdOut.Margin = new Thickness(0, 0, 0, 4);
            }
            ColumnDefinition cd;

            cd = new ColumnDefinition(); cd.Width = GridLength.Auto; grdOut.ColumnDefinitions.Add(cd);
            cd = new ColumnDefinition(); grdOut.ColumnDefinitions.Add(cd);
            spOpts.Children.Add(grdOut);

            if (!it.Group)
            {
                it.m_imgChb = new RscIconButton(grdOut, Grid.ColumnProperty, 0, 20, 20, Rsc.Visible);
                if (it.m_bCurrent)
                {
                    it.m_imgChb.Image.Source = m_isChbOn;
                }
                else
                {
                    it.m_imgChb.Image.Source = m_isChbOff;
                }
                it.m_imgChb.Click += new System.Windows.RoutedEventHandler(Item_Click);

                it.m_imgChb.Tag = it;
            }

            Rectangle rc;

            rc = new Rectangle();
            if (it.Group)
            {
                rc.Fill = new SolidColorBrush(m_Theme.ThemeColors.TreeContainerBack);                   //Colors.Orange);
            }
            else
            {
                rc.Fill = new SolidColorBrush(m_Theme.ThemeColors.TreeLeafBack);                  //Colors.Blue);
            }
            rc.Opacity = 0.5;
            rc.SetValue(Grid.ColumnProperty, 1);
            grdOut.Children.Add(rc);

            Button btnMore = new Button();

            btnMore.Name    = "btnMore_" + idx.ToString();
            btnMore.Content = it.m_strTitle;
            btnMore.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left;
            btnMore.BorderThickness            = new Thickness(0);
            if (it.Group)
            {
                btnMore.FontSize   = 20;
                btnMore.Foreground = new SolidColorBrush(m_Theme.ThemeColors.TreeContainerFore);                   //Colors.White);
            }
            else
            {
                btnMore.FontSize   = 16;
                btnMore.Foreground = new SolidColorBrush(m_Theme.ThemeColors.TreeLeafFore);                   //Colors.White);
            }
            btnMore.Foreground = new SolidColorBrush(Colors.White);
            btnMore.Margin     = new Thickness(-12, -10, -12, -12);
            btnMore.SetValue(Grid.ColumnProperty, 1);
            grdOut.Children.Add(btnMore);

            if (!it.Group)
            {
                btnMore.Tag    = it;
                btnMore.Click += new System.Windows.RoutedEventHandler(Item_Click);
            }
        }
示例#4
0
        private void FillOpts()
        {
            RscOptItemDesc itHead;
            RscOptItemDesc it;

            // //
            //

            spOpts.Children.Clear();

            itHead            = new RscOptItemDesc();
            itHead.m_strTitle = "Save to";
            AddOpt(itHead);

            {
                it            = new RscOptItemDesc(itHead);
                it.m_strTitle = "Media Library";
                it.m_bCurrent = (m_bSaveToMediaLibrary);
                it.Tag        = true;
                AddOpt(it);
            }
            {
                it            = new RscOptItemDesc(itHead);
                it.m_strTitle = "Isolated Storage";
                it.m_bCurrent = (!m_bSaveToMediaLibrary);
                it.Tag        = false;
                AddOpt(it);
            }

            //
            // //
            //

            itHead            = new RscOptItemDesc();
            itHead.m_strTitle = "Flash";
            AddOpt(itHead);

            if (cam.IsFlashModeSupported(FlashMode.Off))
            {
                it            = new RscOptItemDesc(itHead);
                it.m_strTitle = "Off";
                it.m_bCurrent = (cam.FlashMode == FlashMode.Off);
                it.Tag        = FlashMode.Off;
                AddOpt(it);
            }
            if (cam.IsFlashModeSupported(FlashMode.On))
            {
                it            = new RscOptItemDesc(itHead);
                it.m_strTitle = "On";
                it.m_bCurrent = (cam.FlashMode == FlashMode.On);
                it.Tag        = FlashMode.On;
                AddOpt(it);
            }
            if (cam.IsFlashModeSupported(FlashMode.Auto))
            {
                it            = new RscOptItemDesc(itHead);
                it.m_strTitle = "Auto";
                it.m_bCurrent = (cam.FlashMode == FlashMode.Auto);
                it.Tag        = FlashMode.Auto;
                AddOpt(it);
            }
            if (cam.IsFlashModeSupported(FlashMode.RedEyeReduction))
            {
                it            = new RscOptItemDesc(itHead);
                it.m_strTitle = "Red Eye";
                it.m_bCurrent = (cam.FlashMode == FlashMode.RedEyeReduction);
                it.Tag        = FlashMode.RedEyeReduction;
                AddOpt(it);
            }

            //
            // //
            //

            itHead            = new RscOptItemDesc();
            itHead.m_strTitle = "Resolution";
            AddOpt(itHead);

            var resolutions = cam.AvailableResolutions.ToList();

            for (int i = 0; i < resolutions.Count; i++)
            {
                it            = new RscOptItemDesc(itHead);
                it.m_strTitle = resolutions[i].Width.ToString() + "x" + resolutions[i].Height.ToString();
                it.m_bCurrent = (cam.Resolution == resolutions[i]);
                it.Tag        = resolutions[i];
                AddOpt(it);
            }

            //
            // //
        }
        public void InitializeVideoRecorder()
        {
            if (captureSource == null)
            {
                // Create the VideoRecorder objects.
                captureSource = new CaptureSource();
                fileSink      = new FileSink();

                videoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();

                // //
                //

                spOpts.Children.Clear();

                RscOptItemDesc itHead;
                RscOptItemDesc it;

                itHead            = new RscOptItemDesc();
                itHead.m_strTitle = "Resolution";
                AddOpt(itHead);
                int iCnt = 0;
                foreach (VideoFormat vf in videoCaptureDevice.SupportedFormats)
                {
                    iCnt++;

                    /*
                     * //On WP7x no VideoCaptureDevice.DesiredFormat setting!!! Limit...
                     * if( iCnt > 1 ) break;
                     */

                    //On Win10Mo unable change DesiredFormat...
                    if (iCnt > 1)
                    {
                        break;
                    }

                    //Duplicated values...
                    if (iCnt % 2 == 0)
                    {
                        continue;
                    }

                    it            = new RscOptItemDesc(itHead);
                    it.m_strTitle = vf.FramesPerSecond.ToString() + "fps" + "\r\n" + vf.PixelWidth.ToString() + "x" + vf.PixelHeight.ToString();
                    it.m_bCurrent = (iCnt == 1);                     //(videoCaptureDevice.DesiredFormat == vf);
                    it.Tag        = vf;
                    AddOpt(it);
                }

                //
                // //

                // Add eventhandlers for captureSource.
                captureSource.CaptureFailed += new EventHandler <ExceptionRoutedEventArgs>(OnCaptureFailed);

                // Initialize the camera if it exists on the phone.
                if (videoCaptureDevice != null)
                {
                    // Create the VideoBrush for the viewfinder.
                    videoRecorderBrush = new VideoBrush();
                    videoRecorderBrush.SetSource(captureSource);

                    // Display the viewfinder image on the rectangle.
                    viewfinderRectangle.Fill = videoRecorderBrush;

                    // Start video capture and display it on the viewfinder.
                    captureSource.Start();

                    // Set the button state and the message.
                    UpdateUI(ButtonState.Initialized, "Tap record to start recording...");
                }
                else
                {
                    // Disable buttons when the camera is not supported by the phone.
                    UpdateUI(ButtonState.CameraNotSupported, "A camera is not supported on this phone.");
                }
            }
        }