示例#1
0
        public CameraShooter(CameraType type)
        {
            try
            {
                if (PhotoCamera.IsCameraTypeSupported(type) == true)
                {
                    AppManager.Instance.Activated += Instance_Activated;
                    AppManager.Instance.Deactivated += Instance_Deactivated;
                    AppManager.Instance.Closed += Instance_Closed;
                    this.Type = type;
                    InitDT();
                    decountText = new TextBlock();
                    decountText.Text = "";
                    decountText.FontSize = 300;
                    decountText.TextAlignment = TextAlignment.Center;
                    decountText.VerticalAlignment = VerticalAlignment.Center;
                    this.Children.Add(decountText);
                    sc = new SoundController();

                    brush = new VideoBrush();
                    videoBrushTransform = new CompositeTransform();
                    videoBrushTransform.CenterX = .5;
                    videoBrushTransform.CenterY = .5;

                    if (type == CameraType.FrontFacing)
                    {
                        videoBrushTransform.ScaleX = -1;
                    }

                    brush.RelativeTransform = videoBrushTransform;

                    HeightBinding = new Binding();
                    HeightBinding.Source = this;
                    HeightBinding.Path = new PropertyPath("Height");

                    WidthBinding = new Binding();
                    WidthBinding.Source = this;
                    WidthBinding.Path = new PropertyPath("Width");

                    this.Background = brush;
                }
            }
            catch (Exception ex) { }
        }
示例#2
0
        public CameraShooter(CameraType type)
        {
            if (PhotoCamera.IsCameraTypeSupported(type) == true)
            {
                this.Type = type;
                InitDT();
                decountText = new TextBlock();
                decountText.Text = "";
                decountText.FontSize = 300;
                decountText.TextAlignment = TextAlignment.Center;
                decountText.VerticalAlignment = VerticalAlignment.Center;
                this.Children.Add(decountText);
                sc = new SoundController();

                brush = new VideoBrush();
                videoBrushTransform = new CompositeTransform();
                videoBrushTransform.CenterX = .5;
                videoBrushTransform.CenterY = .5;

                brush.RelativeTransform = videoBrushTransform;

                HeightBinding = new Binding();
                HeightBinding.Source = this;
                HeightBinding.Path = new PropertyPath("Height");

                WidthBinding = new Binding();
                WidthBinding.Source = this;
                WidthBinding.Path = new PropertyPath("Width");

                this.Background = brush;
            }
        }