Exemplo n.º 1
0
        public override void Perform(object obj)
        {
            HexMap hexmap = GetHexmap(obj);

            if (hexmap == null)
            {
                return;
            }

            // Find or create a camera view in tilemap editing mode
            CamViewPlugin camViewPlugin = DualityEditorApp.GetPlugin <CamViewPlugin>();

            if (camViewPlugin == null)
            {
                return;
            }
            CamView camView = camViewPlugin.CreateOrSwitchCamView(typeof(HexMapCamViewState));

            if (camViewPlugin == null)
            {
                return;
            }

            DualityEditorApp.Select(this, new ObjectSelection(hexmap));

            DualityEditorApp.Highlight(this, new ObjectSelection(hexmap), HighlightMode.Spatial);
        }
        protected override void OnDestroy()
        {
            base.OnDestroy();

            CamView?.FreeCameraMemory();
            //Controller.BcoreConnectionChanged -= OnConnectedBcore;
            //Controller.DisconnectBcore();
        }
        protected override void OnPause()
        {
            base.OnPause();

            if (!IsCamSuspended && (CamView?.IsStreaming ?? false))
            {
                CamView?.StopPlayback();
                IsCamSuspended = true;
            }

            FinishSensor();
        }
Exemplo n.º 4
0
        public override void OnHiddenChanged(bool hidden)
        {
            base.OnHiddenChanged(hidden);

            if (!hidden && !(CamView?.IsStreaming ?? true))
            {
                BeginStream();
            }
            else if (hidden && (CamView?.IsStreaming ?? false))
            {
                CamView.StopPlayback();
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (CamView != null)
            {
                CamView.Dispose();
                CamView = null;
            }

            if (FlashButton != null)
            {
                FlashButton.Dispose();
                FlashButton = null;
            }

            if (FlashImageView != null)
            {
                FlashImageView.Dispose();
                FlashImageView = null;
            }

            if (Label != null)
            {
                Label.Dispose();
                Label = null;
            }

            if (LabelForDocArea != null)
            {
                LabelForDocArea.Dispose();
                LabelForDocArea = null;
            }

            if (LabelForDocDistortion != null)
            {
                LabelForDocDistortion.Dispose();
                LabelForDocDistortion = null;
            }

            if (OverlayView != null)
            {
                OverlayView.Dispose();
                OverlayView = null;
            }

            if (ProgressView != null)
            {
                ProgressView.Dispose();
                ProgressView = null;
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            Addr = Intent.GetStringExtra(ExtraKeyAddr);
            if (string.IsNullOrEmpty(Addr))
            {
                Finish();
                return;
            }


            Pref = GaganPreference.Load(this);

            SetContentView(Resource.Layout.Control);

            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.controller_toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            CamView = FindViewById <MjpegView>(Resource.Id.CamView);
            CamView?.SetResolution(640, 480);

            BeginStream();

            //TextMessage = FindViewById<TextView>(Resource.Id.TextConnectMessage);

            //Controller = new GaganController(this);
            //Controller.BcoreConnectionChanged += OnConnectedBcore;
            //Controller.ConnectBcore(Addr);


            //SettingFragment = SettingFragment.newInstance();
            //SettingFragment.Controller = Controller;

            //ControllerFragment = ControllerFragment.NewInstance();
            //ControllerFragment.Controller = Controller;

            //var transaction = FragmentManager.BeginTransaction();
            //transaction.Add(Resource.Id.FrameFragment, ControllerFragment);
            //transaction.Hide(ControllerFragment);
            //transaction.Add(Resource.Id.FrameFragment, SettingFragment);
            //transaction.Hide(SettingFragment);
            //transaction.Commit();
        }
Exemplo n.º 7
0
        private void BeginStream()
        {
            var url = Pref.CamUrl;

            Task.Factory.StartNew(() =>
            {
                try
                {
                    return(MjpegInputStream.Read(url));
                }
                catch (Exception)
                {
                    return(null);
                }
            }).ContinueWith((t) =>
            {
                CamView.SetSource(t.Result);
                t.Result?.SetSkip(1);

                CamView.SetDisplayMode(MjpegView.SizeBestFit);
                CamView.ShowFps(false);
            });
        }
Exemplo n.º 8
0
        protected override void OnCurrentCameraChanged(CamView.CameraChangedEventArgs e)
        {
            base.OnCurrentCameraChanged(e);

            if (e.PreviousCamera != null) e.PreviousCamera.RemoveEditorRendererFilter(this.RendererFilter);
            if (e.NextCamera != null) e.NextCamera.AddEditorRendererFilter(this.RendererFilter);
        }
Exemplo n.º 9
0
		private void View_CurrentCameraChanged(object sender, CamView.CameraChangedEventArgs e)
		{
			this.OnCurrentCameraChanged(e);
		}
Exemplo n.º 10
0
		protected virtual void OnCurrentCameraChanged(CamView.CameraChangedEventArgs e) {}
Exemplo n.º 11
0
        public override void OnDestroy()
        {
            base.OnDestroy();

            CamView?.FreeCameraMemory();
        }