Ejemplo n.º 1
0
        public static void Init(Windows.UI.Xaml.Application app, CoreDispatcher dispatcher, string key)
        {
            SLWIOC.RegisterSingleton <ILogger>(new Loggers.AppCenterLogger(key));
            SLWIOC.RegisterSingleton <IDispatcherServices>(new DispatcherServices(dispatcher));
            SLWIOC.RegisterSingleton <IStorageService>(new StorageService());
            SLWIOC.RegisterSingleton <IPopupServices>(new PopupsService());

            SLWIOC.RegisterSingleton <IDeviceManager>(new DeviceManager());

            SLWIOC.RegisterSingleton <INetworkService>(new NetworkService());
            SLWIOC.Register <IImaging>(new Imaging());
            SLWIOC.Register <IBindingHelper>(new BindingHelper());

            SLWIOC.RegisterSingleton <ISSDPClient>(new SSDPClient());
            SLWIOC.RegisterSingleton <IWebServer>(new WebServer());

            SLWIOC.Register <ISSDPClient>(typeof(SSDPClient));
            SLWIOC.Register <IWebServer>(typeof(WebServer));
            SLWIOC.Register <ISecureStorage>(new SecureStorage());
            SLWIOC.Register <ISSDPServer>(new SSDPServer());

            SLWIOC.Register <ITimerFactory>(new TimerFactory());

            SLWIOC.Register <IDirectoryServices>(new DirectoryServices());

            IconFonts.IconFontSupport.RegisterFonts();
        }
 public void Init()
 {
     SLWIOC.RegisterSingleton <INetworkService>(_networkService.Object);
     SLWIOC.RegisterSingleton <IPopupServices>(_popupService.Object);
     SLWIOC.RegisterSingleton <IViewModelNavigation>(_vmNavigation.Object);
     SLWIOC.RegisterSingleton <ILogger>(_logger.Object);
 }
Ejemplo n.º 3
0
        private void InitServices()
        {
#if ENV_MASTER
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#elif ENV_STAGE
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#elif ENV_DEV
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "dev-api.nuviot.com",
            };
#elif ENV_LOCAL
            var serverInfo = new ServerInfo()
            {
                SSL     = false,
                RootUrl = "localhost:5001",
            };
#endif

            /* Configuring he IoC is something like this...be warned
             *
             * https://www.youtube.com/watch?v=7-FbfkUD78w
             */

            DeviceInfo.Register();

            var clientAppInfo = new ClientAppInfo();

            _appConfig = new AppConfig();

            SLWIOC.RegisterSingleton <IClientAppInfo>(clientAppInfo);
            SLWIOC.RegisterSingleton <IAppConfig>(_appConfig);

            var navigation = new ViewModelNavigation(this);
            LagoVista.XPlat.Core.Startup.Init(this, navigation);
            LagoVista.Client.Core.Startup.Init(serverInfo);

            navigation.Add <MainViewModel, Views.MainView>();
            navigation.Add <SplashViewModel, Views.SplashView>();

            navigation.Add <MonitorInstanceViewModel, Views.MonitorInstanceView>();
            navigation.Add <InstanceViewModel, Views.InstanceView>();
            navigation.Add <ListenerViewModel, Views.ListenerView>();
            navigation.Add <PipelineViewModel, Views.PipelineView>();
            navigation.Add <PlannerViewModel, Views.PlannerView>();
            navigation.Add <TelemetryViewModel, Views.TelemetryView>();

            navigation.Start <SplashViewModel>();

            SLWIOC.RegisterSingleton <IViewModelNavigation>(navigation);
        }
Ejemplo n.º 4
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            var rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                Xamarin.Forms.Forms.Init(e);


                SLWIOC.Register <IWebSocket, WebSocket>();
                LagoVista.Core.UWP.Startup.Init(this, rootFrame.Dispatcher, MOBILE_CENTER_KEY);

                SLWIOC.RegisterSingleton <IDeviceInfo>(new DeviceInfo());
                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                }

                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }

                Window.Current.Activate();
            }
        }
Ejemplo n.º 5
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            var rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();

                SLWIOC.RegisterSingleton <ILocationProvider>(new Services.LocationProvider());

                rootFrame.NavigationFailed += OnNavigationFailed;

                Xamarin.Forms.Forms.Init(e);
                Xamarin.FormsMaps.Init("s5miuLzzn4RuPyMXzOYF~pA3KRBwzLZ4JOHnyIaUAWA~AnoR9G-Mf6OR7_n8b6wVy_cd9wim48xfSp39TC31OlvLad6zT5Pf0XN35EPuEV5U");

                LagoVista.Core.UWP.Startup.Init(this, rootFrame.Dispatcher, "a8d44f67-212b-4357-aea8-d55d44156c59");

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

                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 6
0
        private void InitServices()
        {
#if ENV_PROD
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#elif ENV_DEV
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "dev-api.nuviot.com",
            };
#elif ENV_LOCAL
            var serverInfo = new ServerInfo()
            {
                SSL     = false,
                RootUrl = "localhost:5001",
            };
#elif ENV_LIVE
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#endif



            /* Configuring he IoC is something like this...be warned
             *
             * https://www.youtube.com/watch?v=7-FbfkUD78w
             */

            var clientAppInfo = new ClientAppInfo();

            SLWIOC.RegisterSingleton <IClientAppInfo>(clientAppInfo);
            SLWIOC.RegisterSingleton <IAppConfig>(new AppConfig());

            var navigation = new ViewModelNavigation(this);
            LagoVista.XPlat.Core.Startup.Init(this, navigation);
            LagoVista.Client.Core.Startup.Init(serverInfo);

            navigation.Add <MainViewModel, Views.MainView>();
            navigation.Add <DeviceExplorerViewModel, Views.DeviceExplorerView>();
            navigation.Add <ProvisionDeviceViewModel, Views.ProvisionDeviceView>();
            navigation.Add <DeviceTypePickerViewModel, Views.DeviceTypePickerView>();
            navigation.Add <MonitorDeviceViewModel, Views.MonitorDeviceView>();
            navigation.Add <ManageDeviceViewModel, Views.ManageDeviceView>();

            navigation.Add <SplashViewModel, Views.SplashView>();

            navigation.Start <SplashViewModel>();

            SLWIOC.RegisterSingleton <IViewModelNavigation>(navigation);
        }
Ejemplo n.º 7
0
        public static void Init(Context context, string key)
        {
            SLWIOC.RegisterSingleton <ILogger>(new Loggers.MobileCenterLogger(key));
            SLWIOC.Register <IStorageService>(new StorageService());
            SLWIOC.Register <IPopupServices>(new LagoVista.XPlat.Core.Services.PopupServices());
            SLWIOC.Register <INetworkService>(new NetworkService());
            SLWIOC.Register <IDeviceInfo>(new DeviceInfo());
            SLWIOC.Register <IDispatcherServices>(new DispatcherServices(context));

            IconFonts.IconFontSupport.RegisterFonts();
        }
Ejemplo n.º 8
0
        private void InitServices()
        {
#if ENV_STAGE
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#elif ENV_DEV
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "dev-api.nuviot.com",
            };
#elif ENV_LOCALDEV
            var serverInfo = new ServerInfo()
            {
                SSL     = false,
                RootUrl = "localhost:5001",
            };
#elif ENV_MASTER
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#endif

            var clientAppInfo = new ClientAppInfo();

            _appConfig = new AppConfig();
            SLWIOC.RegisterSingleton <IClientAppInfo>(clientAppInfo);
            SLWIOC.RegisterSingleton <IAppConfig>(_appConfig);

            var navigation = new ViewModelNavigation(this);
            LagoVista.XPlat.Core.Startup.Init(this, navigation);
            LagoVista.Client.Core.Startup.Init(serverInfo, new AppStyle());

            navigation.Add <MainViewModel, Views.MainView>();
            navigation.Add <DeviceExplorerViewModel, Views.DeviceExplorerView>();
            navigation.Add <ProvisionDeviceViewModel, Views.ProvisionDeviceView>();
            navigation.Add <DeviceTypePickerViewModel, Views.DeviceTypePickerView>();
            navigation.Add <MonitorDeviceViewModel, Views.MonitorDeviceView>();
            navigation.Add <DeviceMapViewModel, Views.DeviceMapView>();
            navigation.Add <ManageDeviceViewModel, Views.ManageDeviceView>();

            navigation.Add <SplashViewModel, Views.SplashView>();

            navigation.Start <SplashViewModel>();

            SLWIOC.Register <IDeviceManagementClient, DeviceManagementClient>();
            SLWIOC.RegisterSingleton <IViewModelNavigation>(navigation);
        }
Ejemplo n.º 9
0
        public static void Init(UIApplication app, string key)
        {
            SLWIOC.RegisterSingleton <ILogger>(new Loggers.MobileCenterLogger(key));
            SLWIOC.Register <IStorageService>(new StorageService());
            SLWIOC.Register <INetworkService>(new NetworkService());
            SLWIOC.Register <IDeviceInfo>(new DeviceInfo());
            SLWIOC.Register <IPopupServices>(new PopupServices());
            SLWIOC.Register <IWebSocket, Services.WebSocket>();
            SLWIOC.Register <IDispatcherServices>(new DispatcherService(app));
            SLWIOC.Register <IMqttNetworkChannel, MqttNetworkChannel>();
            SLWIOC.Register <IStorageService, SecureStorage>();

            IconFonts.IconFontSupport.RegisterFonts();
        }
Ejemplo n.º 10
0
        public static void Init(Context context, string key)
        {
            SLWIOC.RegisterSingleton <ILogger>(new Loggers.AppCenterLogger(key));
            SLWIOC.Register <IStorageService>(new StorageService());
            SLWIOC.Register <IPopupServices>(new LagoVista.XPlat.Core.Services.PopupServices());
            SLWIOC.Register <INetworkService>(new NetworkService());
            SLWIOC.Register <ITCPClient, Services.TCPClient>();
            SLWIOC.Register <IUDPClient, Services.UDPClient>();
            SLWIOC.Register <IWebSocket, Services.WebSocket>();
            SLWIOC.Register <ISecureStorage>(new SecureStorage());
            SLWIOC.Register <IDispatcherServices>(new DispatcherServices(context));

            IconFonts.IconFontSupport.RegisterFonts();
        }
Ejemplo n.º 11
0
        public App()
        {
            InitializeComponent();

            MainPage = new MainPage();

#if ENV_STAGE
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#elif ENV_DEV
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "dev-api.nuviot.com",
            };
#elif ENV_LOCALDEV
            var serverInfo = new ServerInfo()
            {
                SSL     = false,
                RootUrl = "localhost:5001",
            };
#elif ENV_MASTER
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#endif
            var clientAppInfo = new ClientAppInfo();

            var _appConfig = new AppConfig();
            SLWIOC.RegisterSingleton <IClientAppInfo>(clientAppInfo);
            SLWIOC.RegisterSingleton <IAppConfig>(_appConfig);


            var navigation = new ViewModelNavigation(this);
            LagoVista.XPlat.Core.Startup.Init(this, navigation);
            LagoVista.Client.Core.Startup.Init(serverInfo);

            navigation.Add <MainViewModel, Views.MainPage>();
            navigation.Add <SplashViewModel, Views.SplashView>();

            navigation.Start <SplashViewModel>();

            SLWIOC.RegisterSingleton <IViewModelNavigation>(navigation);
        }
Ejemplo n.º 12
0
        private void InitServices()
        {
#if ENV_STAGE
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#elif ENV_DEV
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "dev-api.nuviot.com",
            };
#elif ENV_LOCALDEV
            var serverInfo = new ServerInfo()
            {
                SSL     = false,
                RootUrl = "localhost:5001",
            };
#elif ENV_MASTER
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#endif
            var clientAppInfo = new ClientAppInfo();

            DeviceInfo.Register();

            SLWIOC.Register <IMavLinkMessageParser, MavLinkMessageParser>();
            SLWIOC.Register <ISerialTelemetryLink, SerialTelemetryLink>();
            SLWIOC.Register <IDroneAdapter, APMDroneAdapter>();
            SLWIOC.Register <IMissionPlanner, MissionPlanner>();
            SLWIOC.RegisterSingleton <IClientAppInfo>(clientAppInfo);
            SLWIOC.RegisterSingleton <IAppConfig>(new AppConfig());

            var navigation = new ViewModelNavigation(this);
            XPlat.Core.Startup.Init(this, navigation);
            Startup.Init(serverInfo);

            navigation.Add <MainViewModel, Views.MainPage>();
            navigation.Add <SplashViewModel, Views.SplashView>();

            navigation.Start <SplashViewModel>();

            SLWIOC.RegisterSingleton <IViewModelNavigation>(navigation);
        }
Ejemplo n.º 13
0
        public static void Init(ServerInfo serverInfo)
        {
            SLWIOC.RegisterSingleton <IAppStyle>(new AppStyle());

            SLWIOC.RegisterSingleton <ServerInfo>(serverInfo);
            SLWIOC.RegisterSingleton <IAuthClient>(new AuthClient());
            SLWIOC.RegisterSingleton <ITokenManager, TokenManager>();
            SLWIOC.RegisterSingleton <IAuthManager, AuthManager>();

            var client = new HttpClient();

            client.BaseAddress = serverInfo.BaseAddress;
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            SLWIOC.RegisterSingleton <HttpClient>(client);

            SLWIOC.RegisterSingleton <IRestClient, RawRestClient>();
        }
Ejemplo n.º 14
0
        private void InitServices()
        {
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "dev-api.nuviot.com",
            };

            var clientAppInfo = new ClientAppInfo()
            {
                MainViewModel = typeof(MainViewModel)
            };

            DeviceInfo.Register();

            SLWIOC.RegisterSingleton <IAppConfig>(new AppConfig());
            LagoVista.Client.Core.Startup.Init(serverInfo);
            SLWIOC.RegisterSingleton <IClientAppInfo>(clientAppInfo);

            var navigation = new ViewModelNavigation(this);

            navigation.Add <MainViewModel, MainPage>();
            navigation.Add <ServicesViewModel, ServicesView>();
            navigation.Add <SecureStorageViewModel, SecureStorageView>();
            navigation.Add <ControlSampleViewModel, ControlSampleView>();
            navigation.Add <ViewModel2, Model2View>();



            SLWIOC.RegisterSingleton <IViewModelNavigation>(navigation);

            try
            {
                LagoVista.XPlat.Core.Startup.Init(this, navigation);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }

            navigation.Start <MainViewModel>();
        }
Ejemplo n.º 15
0
        private void RegisterUWPServices(CoreDispatcher dispatcher)
        {
            SLWIOC.RegisterSingleton <IDispatcherServices>(new DispatcherServices(dispatcher));
            SLWIOC.RegisterSingleton <IStorageService>(new StorageService());
            SLWIOC.RegisterSingleton <IPopupServices>(new PopupsService());

            SLWIOC.RegisterSingleton <IDeviceManager>(new DeviceManager());

            SLWIOC.RegisterSingleton <INetworkService>(new NetworkService());
            SLWIOC.Register <IImaging>(new Imaging());
            SLWIOC.Register <IBindingHelper>(new BindingHelper());

            SLWIOC.RegisterSingleton <ISSDPClient>(new SSDPClient());
            SLWIOC.RegisterSingleton <IWebServer>(new WebServer());

            SLWIOC.Register <ISSDPClient>(typeof(SSDPClient));
            SLWIOC.Register <IWebServer>(typeof(WebServer));
            SLWIOC.Register <ISSDPServer>(new SSDPServer());

            SLWIOC.Register <ITimerFactory>(new TimerFactory());
        }
Ejemplo n.º 16
0
        public void SimpleSingletonInjectionTest()
        {
            SLWIOC.RegisterSingleton <IClassA, ClassA>();
            SLWIOC.RegisterSingleton <IClassB, ClassB>();
            SLWIOC.RegisterSingleton <IClassC, ClassC>();

            var classA = SLWIOC.Get <IClassA>();

            classA.PropertyA = "1234";

            Assert.Equal("1234", SLWIOC.Get <IClassA>().PropertyA);

            var classB = SLWIOC.Get <IClassB>();

            classB.PropertyA = "4567";

            Assert.Equal("4567", SLWIOC.Get <IClassB>().PropertyA);

            var classC = SLWIOC.Get <IClassC>();

            Assert.Equal(classC.ClassA.PropertyA, classA.PropertyA);
            Assert.Equal(classC.ClassB.PropertyA, classB.PropertyA);
        }
Ejemplo n.º 17
0
        private void InitServices()
        {
#if ENV_PROD
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#elif ENV_DEV
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "dev-api.nuviot.com",
            };
#elif ENV_LOCAL
            var serverInfo = new ServerInfo()
            {
                SSL     = false,
                RootUrl = "localhost:5001",
            };
#elif ENV_TEST
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "test-api.nuviot.com",
            };
#endif


            /* Configuring the IoC is something like this...be warned
             *
             * https://www.youtube.com/watch?v=7-FbfkUD78w
             */

            var clientAppInfo = new ClientAppInfo()
            {
                MainViewModel = typeof(MainViewModel)
            };

            SLWIOC.RegisterSingleton <IClientAppInfo>(clientAppInfo);
            SLWIOC.RegisterSingleton <IAppConfig>(new AppConfig());

            var navigation = new ViewModelNavigation(this);
            LagoVista.XPlat.Core.Startup.Init(this, navigation);
            LagoVista.Client.Core.Startup.Init(serverInfo);

            navigation.Add <MainViewModel, Views.MainView>();
            navigation.Add <SimulatorViewModel, Views.Simulator.SimulatorView>();
            navigation.Add <SimulatorEditorViewModel, Views.Simulator.SimulatorEditorView>();
            navigation.Add <MessageEditorViewModel, Views.Messages.MessageEditorView>();
            navigation.Add <SendMessageViewModel, Views.Messages.SendMessageView>();
            navigation.Add <MessageHeaderViewModel, Views.Messages.MessageHeaderView>();
            navigation.Add <DynamicAttributeViewModel, Views.Messages.DynamicAttributeView>();

            navigation.Add <SplashViewModel, Views.SplashView>();

            navigation.Start <SplashViewModel>();

            SLWIOC.Register <IMQTTAppClient, MQTTAppClient>();
            SLWIOC.Register <IMQTTDeviceClient, MQTTDeviceClient>();

            SLWIOC.RegisterSingleton <IViewModelNavigation>(navigation);
        }
Ejemplo n.º 18
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();
            }
        }
Ejemplo n.º 19
0
        //040f4f8a7a514d6d9f72b139cc277fedb7fd18fa

        protected async override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            _startTime = DateTime.Now;

            if (rootFrame == null)
            {
                rootFrame = new Frame();
                Navigation.Instance.Initialize(rootFrame);
                Window.Current.Content = rootFrame;

                RegisterUWPServices(Window.Current.Dispatcher);

                var mobileCenterAnalytics = new LagoVista.Core.UWP.Loggers.MobileCenterLogger("9b075936-0855-40ff-b332-86c57fffa6ae");
                SLWIOC.RegisterSingleton <ILogger>(mobileCenterAnalytics);

//                SLWIOC.RegisterSingleton<ILogger>(new LagoVista.IoT.Logging.DebugLogger());

                await SmartThingsHubs.Instance.InitAsync();

                UnhandledException += App_UnhandledException;

                Navigation.Instance.Add <FolderViewModel, FolderView>();
                Navigation.Instance.Add <DeviceDiscoveryViewModel, DeviceDiscoveryView>();

                _restClient = new RESTClient();
                _restClient.ShowDiagnostics = true;


                if (Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.IoT")
                {
                    var config = new LagoVista.Core.Networking.Models.UPNPConfiguration()
                    {
                        DefaultPageHtml  = "<html>HelloWorld</html>",
                        DeviceType       = "X_LagoVista_ISY_Kiosk_Device",
                        FriendlyName     = "ISY Remote Kiosk",
                        Manufacture      = "Software Logistics, LLC",
                        ManufactureUrl   = "www.TheWolfBytes.com",
                        ModelDescription = "ISY Remote UI and SmartThings Bridge",
                        ModelName        = "ISYRemoteKiosk",
                        ModelNumber      = "SL001",
                        ModelUrl         = "www.TheWolfBytes.com",
                        SerialNumber     = "KSK001"
                    };

                    try
                    {
                        await _restClient.MakeDiscoverableAsync(9301, config);
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(ex.Message);
                    }
                }

                ISYService.Instance.Connected              += Instance_Connected;
                ISYService.Instance.Disconnected           += Instance_Disconnected;
                ISYEventListener.Instance.ISYEventReceived += Instance_ISYEventReceived;

                await Managers.LedController.Instance.InitAsync(0x40, mobileCenterAnalytics);

                await Managers.ScreenManager.Instance.InitAsync(mobileCenterAnalytics);

                await ISYService.Instance.InitAsync();

                await ISYService.Instance.RefreshAsync();

                rootFrame.NavigationFailed += OnNavigationFailed;

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

                // Place the frame in the current Window
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 20
0
        private void InitServices()
        {
#if ENV_STAGE
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#elif ENV_DEV
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "dev-api.nuviot.com",
            };
#elif ENV_LOCALDEV
            var serverInfo = new ServerInfo()
            {
                SSL     = false,
                RootUrl = "localhost:5001",
            };
#elif ENV_MASTER
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#endif
            var clientAppInfo = new ClientAppInfo();

            DeviceInfo.Register();

            SLWIOC.Register <IHeartBeatManager, HeartBeatManager>();
            SLWIOC.Register <IMissionPlanner, MissionPlanner>();
            SLWIOC.Register <Uas.Core.INavigation, Uas.Core.Services.Navigation>();

            SLWIOC.RegisterSingleton <IClientAppInfo>(clientAppInfo);
            SLWIOC.RegisterSingleton <IAppConfig>(new AppConfig());
            SLWIOC.RegisterSingleton <IConfigurationManager>(new ConfigurationManager());
            SLWIOC.RegisterSingleton <ITelemetryService, TelemetryService>();

            SLWIOC.RegisterSingleton <IConnectedUasManager>(new ConnectedUasManager());

            SLWIOC.Register <IDeviceManagementClient, DeviceManagementClient>();

            var navigation = new ViewModelNavigation(this);
            XPlat.Core.Startup.Init(this, navigation);
            Startup.Init(serverInfo);

            navigation.Add <MotorsTestViewModel, Views.Testing.MotorTestsView>();
            navigation.Add <CompassCalibrationViewModel, Views.Calibration.CompassCalibrationView>();
            navigation.Add <AccCalibrationViewModel, Views.Calibration.AccCalibrationView>();
            navigation.Add <MissionPlannerViewModel, Views.Missions.MissionPlannerView>();
            navigation.Add <UasDetailViewModel, Views.Uas.UasDetail>();
            navigation.Add <UasManagerViewModel, Views.Uas.UasManager>();
            navigation.Add <UasTypeManagerViewModel, Views.Uas.UasTypeManager>();
            navigation.Add <MainViewModel, Views.MainPage>();
            navigation.Add <HudViewModel, Views.HudView>();
            navigation.Add <SplashViewModel, Views.SplashView>();

            navigation.Start <SplashViewModel>();

            SLWIOC.RegisterSingleton <IViewModelNavigation>(navigation);
        }
Ejemplo n.º 21
0
        private void InitServices()
        {
            _appConfig = new AppConfig();

#if ENV_MASTER
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
            _appConfig.Environment = Environments.Production;
#elif ENV_DEV
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "dev-api.nuviot.com",
            };
            _appConfig.Environment = Environments.Development;
#elif ENV_LOCAL
            var serverInfo = new ServerInfo()
            {
                SSL     = false,
                RootUrl = "localhost:5001",
            };
            _appConfig.Environment = Environments.Local;
#elif ENV_STAGE
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "stage-api.nuviot.com",
            };
            _appConfig.Environment = Environments.Staging;
#endif

            var clientAppInfo = new ClientAppInfo()
            {
                MainViewModel = typeof(MainViewModel)
            };

            DeviceInfo.Register();

            var deviceInfo = SLWIOC.Get <IDeviceInfo>();

            SLWIOC.RegisterSingleton <IClientAppInfo>(clientAppInfo);
            SLWIOC.RegisterSingleton <IAppConfig>(_appConfig);

            var navigation = new ViewModelNavigation(this);
            LagoVista.XPlat.Core.Startup.Init(this, navigation);
            LagoVista.Client.Core.Startup.Init(serverInfo);

            navigation.Add <MainViewModel, Views.MainView>();
            navigation.Add <SimulatorViewModel, Views.Simulator.SimulatorView>();
            navigation.Add <SimulatorEditorViewModel, Views.Simulator.SimulatorEditorView>();
            navigation.Add <MessageEditorViewModel, Views.Messages.MessageEditorView>();
            navigation.Add <SendMessageViewModel, Views.Messages.SendMessageView>();
            navigation.Add <MessageHeaderViewModel, Views.Messages.MessageHeaderView>();
            navigation.Add <PasswordEntryViewModel, Views.Simulator.PasswordEntryView>();
            navigation.Add <UnlockStorageViewModel, Views.Simulator.UnlockStorageView>();
            navigation.Add <SetStoragePasswordViewModel, Views.Simulator.SetStoragePasswordView>();
            navigation.Add <DynamicAttributeViewModel, Views.Messages.DynamicAttributeView>();

            navigation.Add <SplashViewModel, Views.SplashView>();

            navigation.Start <SplashViewModel>();

            SLWIOC.Register <IMQTTAppClient, MQTTAppClient>();
            SLWIOC.Register <IMQTTDeviceClient, MQTTDeviceClient>();

            SLWIOC.RegisterSingleton <IViewModelNavigation>(navigation);
        }