public FlightStickService(NiVekFlightStick stick, CoreDispatcher dispatcher, INavigation navigation)
        {
            this._flightStick = stick ?? throw new ArgumentNullException(nameof(stick));
            this._navigation  = navigation ?? throw new ArgumentNullException(nameof(navigation));
            this._dispatcher  = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));

            _timer = new Timer(Timer_callBack, null, 100, 100);

            Gamepad.GamepadAdded += Gamepad_GamepadAdded;
            RawGameController.RawGameControllerAdded += RawGameController_RawGameControllerAdded;
        }
示例#2
0
        public MainPage()
        {
            _flightStick = new Controller.NiVekFlightStick(Dispatcher);

            this.InitializeComponent();

            _flightRecorder = SLWIOC.Get <IFlightRecorder>();

            var uasMgr         = SLWIOC.Get <IConnectedUasManager>();
            var missionPlanner = new MissionPlanner(uasMgr);

            _navigation   = new LagoVista.Uas.Core.Services.Navigation(uasMgr, missionPlanner, _flightRecorder);
            _hudViewModel = new HudViewModel(uasMgr, _navigation, _flightRecorder, _flightStick.State);
            _timer        = new Timer(Timer_callBack, null, 100, 100);
        }
示例#3
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if ENV_STAGE
            var mobileCenterKey = "d3f162da-76c5-4880-b19c-7a038d6af46f";
            var serverInfo      = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#elif ENV_DEV
            var mobileCenterKey = "d3f162da-76c5-4880-b19c-7a038d6af46f";
            var serverInfo      = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "dev-api.nuviot.com",
            };
#elif ENV_LOCALDEV
            var mobileCenterKey = "d3f162da-76c5-4880-b19c-7a038d6af46f";
            var serverInfo      = new ServerInfo()
            {
                SSL     = false,
                RootUrl = "localhost:5001",
            };
#elif ENV_MASTER
            var mobileCenterKey = "d3f162da-76c5-4880-b19c-7a038d6af46f";
            var serverInfo      = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#endif

            var rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                Window.Current.Content = rootFrame;
            }

            var dispatcherService = new DispatcherService(Window.Current.Dispatcher);

            this.DebugSettings.EnableFrameRateCounter = false;

            var uasMgr = new ConnectedUasManager();


            var flightStick = new Controller.NiVekFlightStick(rootFrame.Dispatcher);

            SLWIOC.Register <INiVekFlightStick>(flightStick);
            SLWIOC.Register <IHeartBeatManager, HeartBeatManager>();
            SLWIOC.RegisterSingleton <IConnectedUasManager>(uasMgr);
            SLWIOC.Register <IMissionPlanner, MissionPlanner>();
            SLWIOC.RegisterSingleton <IConfigurationManager>(new ConfigurationManager());
            SLWIOC.RegisterSingleton <ITelemetryService, TelemetryService>();
            SLWIOC.RegisterSingleton <IFlightRecorder>(new FlightRecorder(dispatcherService));

            SLWIOC.RegisterSingleton <IClientAppInfo>(new ClientAppInfo());
            SLWIOC.RegisterSingleton <IAppConfig>(new UwpAppConfig());
            SLWIOC.RegisterSingleton <IDeviceInfo>(new UWPDeviceInfo());
            SLWIOC.RegisterSingleton <INavigation, LagoVista.Uas.Core.Services.Navigation>();

            LagoVista.Core.UWP.Startup.Init(this, rootFrame.Dispatcher, mobileCenterKey);

            Startup.Init(serverInfo);

            var navigation = new LagoVista.UWP.UI.Navigation();
            navigation.Initialize(rootFrame);

            navigation.Add <SplashViewModel, SplashView>();
            navigation.Add <LoginViewModel, LoginView>();
            navigation.Add <FlightViewModel, FlightView>();
            navigation.Add <DroneConnectViewModel, DroneConnectView>();

            _flightStickService = new FlightStickService(flightStick, rootFrame.Dispatcher, SLWIOC.Get <INavigation>());

            SLWIOC.Register <IViewModelNavigation>(navigation);

            //new DJIDrone(uasMgr, Window.Current.Dispatcher);
            new TelloDrone(uasMgr, Window.Current.Dispatcher);

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    navigation.Navigate <SplashViewModel>();
                }

                Window.Current.Activate();
            }
        }