Ejemplo n.º 1
0
        private static IServiceCollection AddApplicationManagerRoleServices(this IServiceCollection services)
        {
            ApplicationManagerOptions options = services.BuildServiceProvider().GetRequiredService <IOptions <ApplicationManagerOptions> >().Value;

            //Add internal role service
            services.AddMemoryCache();

            if (_isDevelopment)
            {
                services.AddSingleton <IRoleService, DevelopmentRoleService>();
                services.AddSingleton <IAppManCoreService, DevelopmentAppManCoreService>();
            }
            else
            {
                services.AddAppManCoreService(x => {
                    x.Password = options.Password;
                    x.UserName = options.UserName;
                    x.Url      = options.Url;
                });

                services.AddIsotopeOrderingRoleService(x => {
                    x.Token       = options.Token;
                    x.DefaultRole = UserRole.Customer.ToString();
                });
            }
            return(services);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="MainWindow" /> class.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
            #if DEBUG
            // Do not allow topmost window mode while debugging
            Topmost = false;
            #endif
            var options = new ApplicationManagerOptions
            {
                IsSpeechEnabled = true,
                ShowMindExplorerPage = true
            };

            _app = new ApplicationManager(CommonProvider.Container, options, this);

            // DataBindings rely on Alfred presently as there hasn't been a need for a page ViewModel yet
            DataContext = _app;

            _app.Console?.Log("WinClient.Initialize", Res.InitializationCompleteLogMessage.NonNull(), LogLevel.Verbose);
        }
Ejemplo n.º 3
0
        internal static ApplicationManager EnsureAlfredInstance()
        {
            if (_app == null)
            {
                var options = new ApplicationManagerOptions
                {
                    IsSpeechEnabled = true,
                    ShowMindExplorerPage = false
                };

                // Build out the app manager
                _app = new ApplicationManager(CommonProvider.Container, options);

                _app.Console?.Log(Resources.AlfredPackageInstantiatingAlfredLogHeader, Resources.AlfredPackageInstantiatingAlfredLogMessage, LogLevel.Verbose);

                // Auto Start
                Debug.Assert(Settings.Default != null);
                if (Settings.Default.AutoStartAlfred)
                {
                    _app.Console?.Log(Resources.AlfredPackageInstantiatingAlfredLogHeader, Resources.AlfredPackageEnsureAlfredInstanceAutoStartingLogMessage, LogLevel.Verbose);
                    _app.Start();
                }
            }

            return _app;
        }