示例#1
0
        private static void RegisterAllServices()
        {
            var services = new ServiceCollection();

            TrmrkCoreServiceCollectionBuilder.RegisterAll(services);

            ServiceProviderContainer.Instance.Value.RegisterServices(services);
        }
示例#2
0
        static void Main()
        {
            var services = new ServiceCollection();

            TrmrkCoreServiceCollectionBuilder.RegisterAll(services);

            ServiceProviderContainer.Instance.Value.RegisterServices(services);

            // To customize application configuration such as set high DPI settings or default font,
            // see https://aka.ms/applicationconfiguration.
            ApplicationConfiguration.Initialize();
            Application.Run(new MainForm());
        }
示例#3
0
        static void Main()
        {
            var services = new ServiceCollection();

            TrmrkCoreServiceCollectionBuilder.RegisterAll(services);

            services.AddSingleton <ActionComponentFactory>();
            ServiceProviderContainer.Instance.Value.RegisterServices(services);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
示例#4
0
        public async Task Launch(string[] args)
        {
            var programArgs = new ProgramArgsParser().Parse(args);

            var services = new ServiceCollection();
            var appSvcs  = TrmrkCoreServiceCollectionBuilder.RegisterAll(services);

            services.AddSingleton(programArgs);
            services.AddSingleton <MainFormViewModel>();
            services.AddSingleton <MainFormEventsViewModel>();
            services.AddTransient <FsExplorerViewModel>();

            ServiceProviderContainer.Instance.Value.RegisterServices(services);
            ServiceProviderContainer.Instance.Value.IsDesignMode = false;

            await using (var app = new App())
            {
                app.Run(programArgs);
            }
        }
示例#5
0
        static void Main(string[] args)
        {
            var programArgs = new ProgramArgsParser().Parse(args);

            var services = new ServiceCollection();

            TrmrkCoreServiceCollectionBuilder.RegisterAll(services);

            services.AddSingleton(programArgs);
            services.AddSingleton <MainFormViewModel>();
            services.AddSingleton <MainFormEventsViewModel>();
            services.AddTransient <FsExplorerViewModel>();

            ServiceProviderContainer.Instance.Value.RegisterServices(services);
            ServiceProviderContainer.Instance.Value.IsDesignMode = false;

            bool          openMainForm = !programArgs.IsSingleInstance;
            HubConnection connection   = null;

            try
            {
                if (programArgs.IsSingleInstance)
                {
                    /* string uri = string.Concat(
                     *  Settings.Default.BackgroundAspNetCoreAppBaseUri,
                     *  HubsH.MAIN_HUB_ADDRESS); */

                    string uri = Settings.Default.BackgroundAspNetCoreAppBaseUri;

                    connection = new HubConnection(uri);

                    //Make proxy to hub based on hub name on server
                    var  mainHub   = connection.CreateHubProxy(HubsH.MAIN_HUB_ADDRESS);
                    bool connected = false;

                    //Start connection
                    connection.Start().ContinueWith(task =>
                    {
                        if (task.IsFaulted)
                        {
                            MessageBox.Show(
                                string.Format(
                                    "There was an error opening the connection:{0}",
                                    task.Exception.GetBaseException()),
                                "Error",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                        }
                        else
                        {
                            connected = true;
                        }
                    }).Wait();

                    openMainForm = connected;
                }

                if (openMainForm)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    Application.Run(new MainForm());
                }
            }
            finally
            {
                connection?.Dispose();
            }
        }