Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }