示例#1
0
        protected override void OnResume()
        {
            base.OnResume();
            UrhoSurface.OnResume();

            MessagingCenter.Send(this, "OnResume");
        }
        protected override void OnResume()
        {
            base.OnResume();
            UrhoSurface.OnResume();

            // if was resumed by the Camera Permission dialog
            LaunchUrho();
        }
        //public void OnPreviewFrame(byte[] data, Camera camera)
        //{
        //	//TODO: NV21 to RGB?
        //	lastFrame = data;
        //}

        protected override void OnResume()
        {
            UrhoSurface.OnResume();
            camera.StartBackgroundThread();
            previewSize = camera.OpenCamera(new Size(640, 480));
            //previewSize = camera.OpenCamera(new Size(768, 1024));
            base.OnResume();
        }
示例#4
0
 void OnPause(object sender, EventArgs e)
 {
     paused = !paused;
     if (paused)
     {
         UrhoSurface.OnPause();
     }
     else
     {
         UrhoSurface.OnResume();
     }
 }
示例#5
0
 protected override void OnResume()
 {
     UrhoSurface.OnResume();
     base.OnResume();
 }
示例#6
0
        public UrhoPage()
        {
            var restartBtn = new Button {
                Text = "Restart"
            };

            restartBtn.Clicked += (sender, e) => StartUrhoApp();

            bool paused   = false;
            var  pauseBtn = new Button {
                Text = "(Un)pause"
            };

            pauseBtn.HorizontalOptions = LayoutOptions.EndAndExpand;
            pauseBtn.Clicked          += (sender, e) =>
            {
                paused = !paused;
                if (paused)
                {
                    UrhoSurface.OnPause();
                }
                else
                {
                    UrhoSurface.OnResume();
                }
            };


            var newpageBtn = new Button {
                Text = "New page"
            };

            newpageBtn.HorizontalOptions = LayoutOptions.CenterAndExpand;
            newpageBtn.Clicked          += (sender, e) => Navigation.PushAsync(new UrhoPage());

            urhoSurface = new UrhoSurface();
            urhoSurface.VerticalOptions = LayoutOptions.FillAndExpand;

            Slider rotationSlider = new Slider(0, 500, 250);

            rotationSlider.ValueChanged += (s, e) =>
            {
                if (urhoApp?.IsActive == true)
                {
                    Urho.Application.InvokeOnMain(() => urhoApp.Rotate((float)(e.NewValue - e.OldValue)));
                }
            };

            selectedBarSlider = new Slider(0, 5, 2.5);
            selectedBarSlider.ValueChanged += OnValuesSliderValueChanged;

            Title   = " UrhoSharp + Xamarin.Forms";
            Content = new StackLayout
            {
                Padding         = new Thickness(12, 12, 12, 40),
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    urhoSurface,
                    new StackLayout {
                        Orientation       = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Children          =
                        {
                            restartBtn,
                            newpageBtn,
                            pauseBtn
                        }
                    },
                    new Label {
                        Text = "ROTATION::"
                    },
                    rotationSlider,
                    new Label {
                        Text = "SELECTED VALUE:"
                    },
                    selectedBarSlider,
                }
            };
        }