Esempio n. 1
0
        public FrmMain()
        {
            CLog4net.LogInfo("System starting!");

            InitializeComponent();
            this.systemController = new SystemController();
            FrmLoading frmLoading = new FrmLoading(this.systemController);

            frmLoading.ShowDialog();

            if (frmLoading.DialogResult == DialogResult.OK)
            {
                frmLoading.Hide();
                frmLoading.Close();
            }

            this.boxsManager      = BoxsManager.GetInstance();
            this.packageManager   = PackageManager.GetInstance();
            this.voiceService     = ServicesFactory.GetInstance().GetVoicService();
            this.serverService    = ServicesFactory.GetInstance().GetServerService();
            this.cameraService    = ServicesFactory.GetInstance().GetCameraService();
            this.about            = AboutConfig.GetInstance().GetAbout();
            this.infoCenterLister = InfoCenterLister.GetInsatnce();
            this.adManager        = ADManager.GetInstance();

            this.AddUCScene(Roster.Home, new Home(this, 0));
            this.AddUCScene(Roster.P_ControlPanel, new PostmanControlPanel(this, 5));
            this.AddUCScene(Roster.P_D_Verify, new PostmanVerify(this, 60));
            this.AddUCScene(Roster.P_D_ChooseBox, new PostmanChooseBox(this, 60));
            this.AddUCScene(Roster.P_D_DeliverPG, new PostmanDeliverPG(this, 120));
            this.AddUCScene(Roster.P_D_EntryPGInfo, new PostmanEntryPGInfo(this, 60));
            this.AddUCScene(Roster.P_D_PGVerify, new PostmanPGVerify(this, 60));
            this.AddUCScene(Roster.P_D_FinishWork, new PostmanFinishWork(this, 10));
            this.AddUCScene(Roster.P_D_Cancel, new PostmanCancelTask(this, 60));
            this.AddUCScene(Roster.P_D_CancelTask, new PostmanCancelTask(this, 60));
            this.AddUCScene(Roster.P_T_EntryPGInfo, new PostmanTBEntryPGInfo(this, 60));
            this.AddUCScene(Roster.P_T_FinishWork, new PostmanTBFinishWork(this, 60));
            this.AddUCScene(Roster.P_S_PGDelivered, new PostmanSPGDelivered(this, 60));
            this.AddUCScene(Roster.P_R_PGRegister, new PostmanRegister(this, 180));

            this.AddUCScene(Roster.C_ControlPanel, new CustomerControlPanel(this, 5));
            this.AddUCScene(Roster.C_T_Verify, new CustomerTBVerify(this, 60));
            this.AddUCScene(Roster.C_T_FinishWork, new CustomerTBFinishWork(this, 60));
            this.AddUCScene(Roster.C_S_EntryPGInfo, new CustomerSEntryPGInfo(this, 60));
            this.AddUCScene(Roster.C_S_PGSearched, new CustomerPGSearched(this, 60));

            this.AddUCScene(Roster.A_Verify, new AdminVerify(this, 60));
            this.AddUCScene(Roster.A_P_EntryBoxCode, new AdminProxyEntryBoxCode(this, 60));
            this.AddUCScene(Roster.A_P_FinishWork, new AdminProxyFinishWork(this, 60));
            this.AddUCScene(Roster.A_ControlPanel, new AdministratorControlPanel(this, 360));

            this.SceneTransit(Roster.Home);
            this.timerSceneInfo.Enabled = true;
            this.timerMain.Enabled      = true;

            CLog4net.LogInfo("启动完成");
        }
Esempio n. 2
0
        private async void KioskPreview_Loaded(Object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            App.Current.Suspending += Application_Suspending;
            var camera = await DeviceService.Instance.GetCameraAsync();

            cameraService = CameraService.Instance;
            await cameraService.InitializeAsync(camera.Id);

            await cameraService.Preview.StartAsync(PreviewControl);
        }
Esempio n. 3
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            await CameraService.InitializeServiceAsync();

            preview.Source = CameraService.mediaCapture;
            CameraService.StartServiceAsync();

            frame.Navigate(typeof(KeyboardPage));
        }
Esempio n. 4
0
        public OperationResult SetTargetTemperature(double celsius)
        {
            var result = CameraService.SetTargetTemperature(celsius);

            if (!result.IsError)
            {
                Cooler.SetTargetTemperature(celsius);
            }

            return(result);
        }
Esempio n. 5
0
 public override void Cleanup()
 {
     VisualizationService.Stop();
     TrackerService.Destroy();
     CameraService.Destroy();
     Messenger.Default.Send(new RemoveCameraMessage(Camera));
     // todo remove after message with feedback?
     SimpleIoc.Default.Unregister<CameraViewModel>(Camera.GUID);
         
     base.Cleanup();
 }
Esempio n. 6
0
        private void OnStackedFrameReady(CameraService sender, PictureFrame frame)
        {
            InvokeAsync(
                () =>
            {
                StackedImgData    = frame.ImageUrl;
                StackedFocusScore = frame.FocusScore;

                StateHasChanged();
            }
                );
        }
Esempio n. 7
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            //Configure logger ASAP so that if the app crashes latter we can have logs of the crash
            ConfigureLogger();

            services.AddMvc().AddSessionStateTempDataProvider();
            //Add session support
            services.AddSession();
            // Allow the use of the MySQL Database as a service in this project.
            // Uses connection string from the project configuration
            // Passing it as a service ensures everything in the project will use this query service and use this connection string
            DatabaseQueryService dbQueryService = new DatabaseQueryService(Configuration.GetConnectionString("DefaultConnection"));
            EmailService         emailService   = new EmailService(Configuration.GetSection("EmailServiceConfiguration")["SourceEmailAddress"],
                                                                   Configuration.GetSection("EmailServiceConfiguration")["SourceEmailPassword"]);
            IConfigurationSection alertMonitoringConfig = Configuration.GetSection("AlertMonitoringServiceConfiguration");

            if (alertMonitoringConfig != null && Convert.ToBoolean(alertMonitoringConfig["Enabled"]))
            {
                Thread alertMonitoringThread = new Thread(delegate()
                {
                    int snoozeDurationMinutes = Convert.ToInt32(alertMonitoringConfig["SnoozeDurationMinutes"]);
                    AlertMonitoringService alertMonitoringService = new AlertMonitoringService(dbQueryService, emailService, snoozeDurationMinutes);
                    alertMonitoringService.StartMonitoring();
                });
                alertMonitoringThread.Start();
            }

            // Other services are constructed using the database query service, meaning they all use the same connection string
            AbstractGraphStatisticService graphStatisticService = new GraphStatisticService(dbQueryService);
            AbstractLocationService       locationService       = new LocationService(dbQueryService);
            AbstractCameraService         cameraService         = new CameraService(dbQueryService, graphStatisticService, locationService);
            AbstractAuthenticationService authenticationService = new AuthenticationService(dbQueryService);
            AbstractDataMessageService    dataMessageService    = new DataMessageService(dbQueryService);
            AbstractNotificationService   notificationService   = new NotificationService(dbQueryService);
            AbstractAlertService          alertService          = new AlertService(dbQueryService, cameraService, notificationService);
            AbstractAPIKeyService         apiKeyService         = new APIKeyService(dbQueryService);
            AbstractUserService           userService           = new UserService(dbQueryService, notificationService, Configuration.GetSection("WebServiceConfiguration")["Hostname"], emailService, apiKeyService);

            IConfigurationSection alertSummaryConfig = Configuration.GetSection("AlertSummaryServiceConfiguration");
            bool sendFramesAsJpg = alertMonitoringConfig != null && Convert.ToBoolean(alertSummaryConfig["SendFramesAsJpg"]);
            AlertSummaryService alertSummaryService = new AlertSummaryService(alertService, sendFramesAsJpg);

            services.Add(new ServiceDescriptor(typeof(AbstractAuthenticationService), authenticationService));
            services.Add(new ServiceDescriptor(typeof(AbstractCameraService), cameraService));
            services.Add(new ServiceDescriptor(typeof(AbstractDataMessageService), dataMessageService));
            services.Add(new ServiceDescriptor(typeof(AbstractLocationService), locationService));
            services.Add(new ServiceDescriptor(typeof(AbstractGraphStatisticService), graphStatisticService));
            services.Add(new ServiceDescriptor(typeof(AbstractAlertService), alertService));
            services.Add(new ServiceDescriptor(typeof(AbstractNotificationService), notificationService));
            services.Add(new ServiceDescriptor(typeof(AbstractUserService), userService));
            services.Add(new ServiceDescriptor(typeof(AbstractAPIKeyService), apiKeyService));
            services.Add(new ServiceDescriptor(typeof(AlertSummaryService), alertSummaryService));
        }
        protected override void OnCreate(Bundle bundle)
        {
            SetContentView(Resource.Layout.AddSeekiosLayout);
            base.OnCreate(bundle);

            GetObjectsFromView();
            SetDataToView();
            _cameraService = new CameraService(this);

            SetSupportActionBar(ToolbarPage);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
        }
Esempio n. 9
0
        public FrmMain()
        {
            CLog4net.LogInfo("System starting!");
            InitializeComponent();

            //读取配置文件和Logo图片
            try
            {
                CLog4net.LogInfo("读取配置文件和Logo图片");
                string imagepath = Environment.CurrentDirectory + "\\configInfo\\logo.png";
                Image  image     = Image.FromFile(imagepath);
                Size   size      = new Size(logoPic.Width, logoPic.Height);
                Bitmap b         = new Bitmap(image, size);
                this.logoPic.BackgroundImage = b;

                IniConfigManager iniConfig = new IniConfigManager();
                tel.Text = iniConfig.GetAboutTel();
                url.Text = iniConfig.GetAboutUrl();
            }
            catch (Exception e)
            {
                CLog4net.LogError(e.ToString());
            }
            this.systemController = new SystemController();
            FrmLoading frmLoading = new FrmLoading(this.systemController);

            frmLoading.ShowDialog();

            if (frmLoading.DialogResult == DialogResult.OK)
            {
                frmLoading.Hide();
                frmLoading.Close();
            }

            this.boxsManager      = BoxsManager.GetInstance();
            this.packageManager   = PackageManager.GetInstance();
            this.voiceService     = ServicesFactory.GetInstance().GetVoicService();
            this.serverService    = ServicesFactory.GetInstance().GetServerService();
            this.cameraService    = ServicesFactory.GetInstance().GetCameraService();
            this.about            = AboutConfig.GetInstance().GetAbout();
            this.infoCenterLister = InfoCenterLister.GetInsatnce();

            timerNav.Interval = 1000;
            timerNav.Stop();

            this.timerMain.Enabled = true;
            this.timerMain.Start();

            currentPanel = panelName.mainPanel;
            mainPanel1.BringToFront();
            CLog4net.LogInfo("启动完成");
        }
Esempio n. 10
0
    public void Start()
    {
        PlayerFactory f = new PlayerFactory();
        PlayerProduct p = f.CreatePlayer(0, 0, bornPoint.transform.position);

        ICameraService m_cc = new CameraService(camera);

        ServiceLocator.prodive(m_cc);

        // 通过工厂创建时技能的释放过程。
        // 那技能的加载就是将技能命令提取出来。

        IInputEventService m_ec = new InputEventService();

        m_ec.SetKeyMapping();
        ServiceLocator.prodive(m_ec);

        IMapService m_mpc = new MapService(terrain);

        ServiceLocator.prodive(m_mpc);

        // 控制器分开比较好,根据不同类型的命令分别写
        IMoveControlService m_ic = new MoveControlService();

        m_ic.AddCommand(IInputEventService.VertualKey.MOVE_FORWARD, new MoveForwardCommandImpl());
        m_ic.AddCommand(IInputEventService.VertualKey.MOVE_BACK, new MoveBackCommandImpl());
        m_ic.AddCommand(IInputEventService.VertualKey.MOVE_LEFT, new MoveLeftCommandImpl());
        m_ic.AddCommand(IInputEventService.VertualKey.MOVE_RIGHT, new MoveRightCommandImpl());
        m_ic.AddCommand(IInputEventService.VertualKey.MOVE_JUMP, new MoveJumpCommandImpl());
        ServiceLocator.prodive(m_ic);

        IMouseControlService m_mc = new MouseControlService();

        m_mc.AddCommand(IInputEventService.VertualKey.MOUSE_RIGHTBUTTON_DOWN, new CameraRightCommandImpl());
        m_mc.AddCommand(IInputEventService.VertualKey.MOUSE_LEFTBUTTON_DOWN, new CameraLeftCommandImpl());
        m_mc.AddCommand(IInputEventService.VertualKey.MOUSE_MIDBUTTON_DOWN, new CameraZoomCommandImpl());
        ServiceLocator.prodive(m_mc);

        IActionControlService m_sc = new ActionControlService();

        m_sc.AddCommand(IInputEventService.VertualKey.NUM_1, ACTION_ID.ACTION_RangeAttack1);
        m_sc.AddCommand(IInputEventService.VertualKey.NUM_2, ACTION_ID.ACTION_RangeAttack2);
        m_sc.AddCommand(IInputEventService.VertualKey.NUM_3, ACTION_ID.ACTION_SpecialAttack1);
        m_sc.AddCommand(IInputEventService.VertualKey.NUM_4, ACTION_ID.ACTION_SpecialAttack2);
        m_sc.AddCommand(IInputEventService.VertualKey.NUM_5, ACTION_ID.ACTION_Uppercut);
        m_sc.AddCommand(IInputEventService.VertualKey.NUM_6, ACTION_ID.ACTION_DasheBackward);
        m_sc.AddCommand(IInputEventService.VertualKey.NUM_7, ACTION_ID.ACTION_DasheForward);
        m_sc.AddCommand(IInputEventService.VertualKey.NUM_8, ACTION_ID.ACTION_Kick);
        m_sc.AddCommand(IInputEventService.VertualKey.NUM_9, ACTION_ID.ACTION_MoveAttack1);

        ServiceLocator.prodive(m_sc);
    }
Esempio n. 11
0
        public OperationResult ConnectCamera()
        {
            var result = CameraService.Connect(this);

            if (!result.IsError)
            {
                Focus.Configure(Camera);
                StartMonitorCoolingTask();
                ExposureChange(Focus.ExposureMinute, Focus.ExposureSecond, Focus.ExposureMillisecond);
            }

            return(result);
        }
Esempio n. 12
0
 private async void ActivatePreview()
 {
     if (Element.PreviewActive)
     {
         await Task.Run(() => {
             if (Element.IsEnabled)
             {
                 CameraService.StartPreview(Control.Holder);
                 CameraService.ToggleTorch(Element.Torch);
             }
         });
     }
 }
Esempio n. 13
0
        public OperationResult DisconnectCamera()
        {
            if (Cooler.IsOn && !WarnAboutCooler())
            {
                return(OperationResult.Ok);
            }

            var result = CameraService.Disconnect(this);

            StopMonitorCoolingTask();

            return(result);
        }
Esempio n. 14
0
        protected void OnFrameReady(CameraService sender, PictureFrame frame)
        {
            InvokeAsync(
                () =>
            {
                ImgData    = frame.ImageUrl;
                FocusScore = frame.FocusScore;
                ++FrameCount;

                StateHasChanged();
            }
                );
        }
Esempio n. 15
0
 private void Start()
 {
     _cameraService = CameraService.Get();
     _cameraService.FrameUpdated.Bind(frame => {
         uiTimestampText.text = $"Timestamp: {frame.Timestamp}";
     });
     if (_cameraService.CurrentState == ServiceState.Running)
     {
         var range = _cameraService.Device.GetPropertyRange(Property.EType.FrameRate);
         Debug.Log(
             $"Frame rate range is {range.low} - {range.high}");
     }
 }
Esempio n. 16
0
        public OperationResult SetGainMode(string value)
        {
            if (Camera.IsGainDiscrete)
            {
                throw new ArgumentException();
            }

            CameraService.SetGainMode(value);

            Camera.ChangeGainMode(Camera.Gains.IndexOf(Camera.Gains.Single(x => x.Value == value)));

            return(OperationResult.Ok);
        }
Esempio n. 17
0
        private async Task <bool> StartFrameReaderAsync()
        {
            if (sync)
            {
                CameraService.FrameArrived += CameraServiceOnFrameArrivedSync;
            }
            else
            {
                CameraService.FrameArrived += CameraServiceOnFrameArrivedAsync;
            }

            return(await CameraService.StartCapture());
        }
Esempio n. 18
0
        public override async void Execute()
        {
            await Task.Delay(1000);

            ViewManager.Initialize();
            SaveManager.Initialize();
            ShortcutService.Initialize();
            BrushService.Initialize();
            DrawService.Initialize();
            BackgroundService.Initialize();
            CameraService.Initialize();
            ProjectService.Initialize();
            AudioPeerService.Initialize();
        }
        public void GetAllCameraKeyValuePairShouldReturnZeroWhenEmpty()
        {
            var list = new List <Camera>();

            var repository = new Mock <IDeletableEntityRepository <Camera> >();

            repository.Setup(r => r.AllAsNoTracking()).Returns(() => list.AsQueryable());
            var service = new CameraService(repository.Object);

            var cameras = service.GetAllCamerasAsKeyValuePair();

            Assert.Empty(cameras);
            repository.Verify(x => x.AllAsNoTracking(), Times.Once);
        }
Esempio n. 20
0
 public override void Execute()
 {
     CameraService.ToggleDrawMode();
     if (!DrawModeEnabled)
     {
         BackgroundService.Refresh();
         ViewManager.ChangeView("RenderView");
     }
     else
     {
         BackgroundService.ResetBackgroundColor();
         ViewManager.ChangeView("BrushView");
     }
 }
Esempio n. 21
0
        private async Task PanTilt(MouseEventArgs e, Common.Direction panDirection, Common.Direction tiltDirection)
        {
            switch (e.Type)
            {
            case "mousedown":
                await CameraService.PanTilt(1, panDirection, tiltDirection);

                break;

            default:
                await CameraService.PanTilt(1, Common.Direction.Stop, Common.Direction.Stop);

                break;
            }
        }
Esempio n. 22
0
        public void CameraServiceTest_GetCameraFromDictionary_ReturnsRightCamera()
        {
            ICameraService cameraService = new CameraService();
            Camera         camera0       = cameraService.CreateCamera();
            Camera         camera1       = cameraService.CreateCamera();
            Camera         camera2       = cameraService.CreateCamera();
            Camera         camera3       = cameraService.CreateCamera();

            Assert.IsNotNull(camera0, "Failed to create camera instance");
            Assert.IsNotNull(camera1, "Failed to create camera instance");
            Assert.IsNotNull(camera2, "Failed to create camera instance");
            Assert.IsNotNull(camera3, "Failed to create camera instance");

            Assert.AreEqual(cameraService.GetCamera(camera2.Guid), camera2, "Wrong Camera returned");
        }
Esempio n. 23
0
        public BackgroundManager(ContentManager Content, ParticleManager particleManager, SpriteBatch spriteBatch, CameraService cameraService, Random r)
        {
            _particleManager = particleManager;
            _spriteBatch     = spriteBatch;

            _cameraService = cameraService;

            this.r         = r;
            tex_Background = Content.Load <Texture2D>(@"Client.Monogame.Content/Space/Starfield");
            tex_Star1      = Content.Load <Texture2D>(@"Client.Monogame.Content/Space/stara");
            tex_Star2      = Content.Load <Texture2D>(@"Client.Monogame.Content/Space/star2a");
            tex_Star3      = Content.Load <Texture2D>(@"Client.Monogame.Content/Space/star3a");
            tex_Star4      = Content.Load <Texture2D>(@"Client.Monogame.Content/Space/star4a");
            tex_Dust1      = Content.Load <Texture2D>(@"Client.Monogame.Content/Space/Dust1");
        }
        public override void Initialize(IServiceProvider provider, Game game)
        {
            var wo = (IServiceContainer)provider.GetService(typeof(IServiceContainer));

            if (IsPerspective)
            {
                var camera = new CameraService(provider, game, fieldOfView, aspectRatio, nearPlane, farPlane);
                wo.AddService(typeof(CameraService), camera);
            }
            else
            {
                var camera = new CameraService(provider, game, left, right, bottom, top, nearPlane, farPlane);
                wo.AddService(typeof(CameraService), camera);
            }
        }
Esempio n. 25
0
        private async Task Zoom(MouseEventArgs e, Common.Direction direction)
        {
            switch (e.Type)
            {
            case "mousedown":
                await CameraService.Zoom(1, direction);

                break;

            default:
                await CameraService.Zoom(1, Common.Direction.Stop);

                break;
            }
        }
Esempio n. 26
0
        public OperationResult TurnOffCooler()
        {
            if (Cooler.IsOn && !WarnAboutCooler())
            {
                return(OperationResult.Ok);
            }

            var result = CameraService.ToggleCooling(false);

            if (!result.IsError)
            {
                Cooler.TurnOff();
            }

            return(result);
        }
Esempio n. 27
0
        private async Task RedirectToCameraAsync()
        {
            var video = await CameraService.TakeVideoAsync();

            var url = await VideoService.UploadVideoAsync(video);


            var parameters = new NavigationParameters();

            parameters.Add("username", Username);
            parameters.Add("videoUrl", url);

            var item = await CrossMediaManager.Current.Extractor.CreateMediaItem(url);

            item.MediaType = MediaType.Hls;
            await CrossMediaManager.Current.Play(item);
        }
Esempio n. 28
0
 private void ChangeVideoParameter(LocatableCameraProfile parameter, ColorFormat format)
 {
     // skip first change
     if (videoParameterSelectionInit)
     {
         if (_status != Status.Running)
         {
             return;
         }
         CameraService.ChangeVideoParameter(parameter, format);
         Debug.Log($"Changed video parameter to {parameter} and format {format}");
     }
     else
     {
         videoParameterSelectionInit = true;
     }
 }
        /// <summary>
        /// Creates a new game
        /// </summary>
        /// <param name="playerName">Player's name</param>
        public void NewGame(string playerName = null)
        {
            _camera = new CameraService(0.25f, new Vector2(_config.WindowWidth / 2, _config.WindowHeight / 2))
            {
                MinScale    = 0.20f,
                MaxScale    = 0.75f,
                ScaleFactor = 0.05f
            };
            _level = new Level( );
            _level.GenerateMap(20, 20);
            List <WorldTile> tiles = _level.Map.Where(tile => !tile.IsWall).ToList( );
            WorldTile        tile  = tiles.ElementAt(RandomService.GetRandomInt(tiles.Count));

            _player = new Player(_content, _config, playerName ?? "Unknown", tile.DisplayX, tile.DisplayY);

            LogService.Add($"Player spawned at [{tile.X}, {tile.Y}] ({_player.X:0}, {_player.Y:0})");
        }
Esempio n. 30
0
        static void Main()
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new MainForm());
            var camera = CameraService.GetActiveCamera();

            // shows in the output window
            if (camera != null)
            {
                Console.WriteLine($"{camera.Name} is on.");
            }
            else
            {
                Console.WriteLine($"No cameras are on.");
            }
        }