static void Main(string[] args) { GenericPrincipal principal = new GenericPrincipal( new GenericIdentity("kapilb"), new string[] { "Administrators", "CarRentalAdmin" }); Thread.CurrentPrincipal = principal; ObjectBase.Container = MEFLoader.Init(); Console.WriteLine("Starting up the service..."); Console.WriteLine(""); SM.ServiceHost InventoryManagerHost = new SM.ServiceHost(typeof(InventoryManager)); SM.ServiceHost AccountManagerHost = new SM.ServiceHost(typeof(AccountManager)); SM.ServiceHost RentalManagerHost = new SM.ServiceHost(typeof(RentalManager)); ServiceHost(InventoryManagerHost, "Inventory Manager"); ServiceHost(AccountManagerHost, "Account Manager"); ServiceHost(RentalManagerHost, "Rental Manager"); Console.WriteLine(""); Console.WriteLine("Press [Enter] to exit."); Console.ReadLine(); StopService(InventoryManagerHost, "Inventory Manager"); StopService(AccountManagerHost, "Account Manager"); StopService(RentalManagerHost, "Rental Manager"); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); Thread.CurrentThread.CurrentCulture = new CultureInfo("es"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("es"); ObjectBase.Container = MEFLoader.Init(new List <ComposablePartCatalog>() { new AssemblyCatalog(Assembly.GetExecutingAssembly()) }); // Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; // new LoginWindow().ShowDialog(); // new Shell().Show(); // new ShellWindow().Show(); //new MainWindow().Show(); // new Shell().Show(); //new ShellDock().Show(); //ShellDockDesign NewWindowB = new ShellDockDesign(); //Current.MainWindow.WindowState = WindowState.Maximized; // NewWindowB.Show(); // new ShellDockDesign(); }
static void Main(string[] args) { GenericPrincipal principal = new GenericPrincipal( new GenericIdentity("Kabaji"), new string[] { "Administrators", "JobMtaaniAdmin" }); Thread.CurrentPrincipal = principal; ObjectBase.Container = MEFLoader.Init(); Console.WriteLine("Starting up services"); Console.WriteLine(""); SM.ServiceHost hostAdManager = new SM.ServiceHost((typeof(AdManager))); SM.ServiceHost hostAccountManager = new SM.ServiceHost((typeof(AccountManager))); StartService(hostAdManager, "Ad Manager"); StartService(hostAccountManager, "Account Manager"); Console.WriteLine(""); Console.WriteLine("Press [ ENTER ] to exit"); Console.ReadLine(); StopService(hostAdManager, "Ad Manager"); StopService(hostAccountManager, "Account Manager"); }
public void Initialize() { GenericPrincipal genericPrinciple = new GenericPrincipal(new GenericIdentity("kapilb"), new string[] { "CarRentalAdmin" }); Thread.CurrentPrincipal = genericPrinciple; ObjectBase.Container = MEFLoader.Init(); }
static void Main(string[] args) { try { //GenericPrincipal principal = new GenericPrincipal( // new GenericIdentity("Osita"), new string[] { OCOApp.Security.User, OCOApp.Security.Admin }); //Thread.CurrentPrincipal = principal; Console.WriteLine("\nInitializing components ..."); ObjectBase.Container = MEFLoader.Init(); // DI: repositories and business engines _logger = ObjectBase.Container.GetExportedValue <IEventLogger>(); _logger.LogToConsole = true; Console.WriteLine("\nComponents initialized."); // Console.WriteLine("\nBootstrapping database ..."); MarketMinerContextBootstrapper.Init(); // initializes the MarketMinerContext Console.WriteLine("\nDatabase ready."); // //ConnectToSignalR(); StartServices(); // Console.WriteLine("\nMarketMiner services are started and running."); } catch (Exception ex) { string message = "\nMarketMiner.Services experienced an unhandled exception."; if (_logger != null) { _logger.LogException(ex, message); } else { Console.WriteLine("\nERROR: " + ex.Message); } } finally { Console.WriteLine("\nPlease press [Enter] to Exit"); Console.ReadLine(); // wcf StopService(_hostAccountManager, "AccountManager"); StopService(_hostMetadataManager, "MetadataManager"); StopService(_hostParticipationManager, "ParticipationManager"); StopService(_hostSubscriptionManager, "SubscriptionManager"); StopService(_hostStrategyManager, "StrategyManager"); Console.WriteLine("\nServices stopped."); // signalr //_connection.Stop(); Console.WriteLine("\nSignalR service stopped.\n"); } }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); ObjectBase.Container = MEFLoader.Init(new List <ComposablePartCatalog>() { new AssemblyCatalog(Assembly.GetExecutingAssembly()) }); }
protected override void OnStartup(StartupEventArgs e) { //TODO: consolidate with MefBootstrapper from prism! base.OnStartup(e); ObjectBase.Container = MEFLoader.Init(new List <ComposablePartCatalog> { new AssemblyCatalog(Assembly.GetExecutingAssembly()) }); this.ShutdownMode = ShutdownMode.OnMainWindowClose; }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); AggregateCatalog catalog = new AggregateCatalog(); catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly())); CompositionContainer container = MEFLoader.Init(catalog.Catalogs); ObjectBase.Container = container; DependencyResolver.SetResolver(new MefDependencyResolver(container)); }
void Application_Start(object sender, EventArgs e) { // Code that runs on application startup AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); RouteConfig.RegisterRoutes(RouteTable.Routes); AggregateCatalog catalog = new AggregateCatalog(); catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly())); CompositionContainer container = MEFLoader.Init(catalog.Catalogs); DependencyResolver.SetResolver(new MefDependencyResolver(container)); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AggregateCatalog catalog = new AggregateCatalog(); catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly())); CompositionContainer container = MEFLoader.Init(catalog.Catalogs); ObjectBase.Container = MEFLoader.Init(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); ObjectBase.Container = MEFLoader.Init(new List <ComposablePartCatalog>() { new AssemblyCatalog(Assembly.GetExecutingAssembly()) }); eventAggregator = new EventAggregator(); var compositionBatch = new CompositionBatch(); compositionBatch.AddExportedValue(this.eventAggregator); ObjectBase.Container.Compose(compositionBatch); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AggregateCatalog catalog = new AggregateCatalog(); catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly())); CompositionContainer container = MEFLoader.Init(catalog.Catalogs); DependencyResolver.SetResolver(new MefDependencyResolver(container)); // view controllers GlobalConfiguration.Configuration.DependencyResolver = new MefAPIDependencyResolver(container); // web api controllers }
public InventoryManager() { ObjectBase.Container = MEFLoader.Init(); ObjectBase.Container.SatisfyImportsOnce(this); //mapping Mapper.CreateMap <Product, ProductDto>(); Mapper.CreateMap <ProductDto, Product>(); Mapper.CreateMap <Category, CategoryDto>(); Mapper.CreateMap <CategoryDto, Category>(); var cfg = new Configuration(); cfg.Configure("hibernate.cfg.xml"); _sessionFactory = cfg.CurrentSessionContext <WcfOperationSessionContext>().BuildSessionFactory(); ObjectBase.Container.ComposeExportedValue(_sessionFactory); }
public DiscordConnectionService() { MEFLoader.SatisfyImportsOnce(this); Client = new DiscordSocketClient(new DiscordSocketConfig { LogLevel = LogSeverity.Debug }); Client.Log += async(message) => await Task.Run(() => Log.LogInformation($"LOG: {message.ToJsonString()}")); Commands = new CommandService(new CommandServiceConfig { CaseSensitiveCommands = true, DefaultRunMode = RunMode.Async, LogLevel = LogSeverity.Debug }); }
static void Main(string[] args) { System.Console.WriteLine("Starting up services..."); System.Console.WriteLine(""); ObjectBase.Container = MEFLoader.Init(); SM.ServiceHost hostProjectManager = new SM.ServiceHost(typeof(ProjectManager)); StartService(hostProjectManager, "ProjectManager"); System.Console.WriteLine(""); System.Console.WriteLine("Press [Enter] to exit."); System.Console.ReadLine(); StopService(hostProjectManager, "ProjectManager"); System.Console.ReadLine(); }
public App() : base() { try { splash.Show(TimeSpan.FromSeconds(0)); Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; Dispatcher.UnhandledException += OnDispatcherUnhandledException; if (!Core.Common.Utils.ProcessExtentions.IsProcessOpen("WCFConsoleHost")) { Process p = new Process(); p.StartInfo = new ProcessStartInfo("WCFConsoleHost.exe"); p.StartInfo.CreateNoWindow = true; p.StartInfo.UseShellExecute = false; p.Start(); } // LoginRoutine(); ClientObjectBase.Container = MEFLoader.Init(new List <ComposablePartCatalog>() { new AssemblyCatalog(Assembly.GetExecutingAssembly()) }); if (!SystemRepository.Instance.ValidateInstallation()) { MessageBox.Show("Invalid Installation"); Current.Shutdown(); } AsycudaDocumentSetExRepository.Instance.BaseDataModelInitialize().Wait(); } catch (Exception ex) { if (ex.Message.Contains("Invalid Configuration")) { throw; } MessageBox.Show(ex.Message + "|" + ex.StackTrace); } }
static void Main(string[] args) { GenericPrincipal principal = new GenericPrincipal( new GenericIdentity("Servando"), new string[] { "CarRentalAdmin" } ); Thread.CurrentPrincipal = principal; ObjectBase.Container = MEFLoader.Init(); Console.WriteLine("Starting up services..."); Console.WriteLine(""); SM.ServiceHost hostInventoryManager = new System.ServiceModel.ServiceHost(typeof(InventoryManager)); SM.ServiceHost hostRentalManager = new System.ServiceModel.ServiceHost(typeof(RentalManager)); SM.ServiceHost hostAccountManager = new System.ServiceModel.ServiceHost(typeof(AccountManager)); StartService(hostInventoryManager, "InventoryManager"); StartService(hostRentalManager, "RentalManager"); StartService(hostAccountManager, "AccountManager"); System.Timers.Timer timer = new System.Timers.Timer(10000); timer.Elapsed += Timer_Elapsed; timer.Start(); Console.WriteLine("Reservation monitor started."); Console.WriteLine(""); Console.WriteLine("Press [Enter] to exit."); Console.ReadLine(); timer.Stop(); Console.WriteLine("Reservation monitor stopped."); StopService(hostInventoryManager, "InventoryManager"); StopService(hostRentalManager, "RentalManager"); StopService(hostAccountManager, "AccountManager"); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); logger.Info("Bom.Desktop version {0} started on {1}.", Assembly.GetExecutingAssembly().GetName().Version, System.Environment.MachineName); ObjectBase.Container = MEFLoader.Init(new List <ComposablePartCatalog>() { new AssemblyCatalog(Assembly.GetExecutingAssembly()) }); //ToDo remove this for production use //seting up user role for dev testing purposes GenericPrincipal principal = new GenericPrincipal( new GenericIdentity("DebugUser"), new string[] { "Administrators", Security.BomAdminRole }); Thread.CurrentPrincipal = principal; }
static void Main(string[] args) { ObjectBase.Container = MEFLoader.Init(); Console.WriteLine("Starting up services"); Console.WriteLine(""); SM.ServiceHost hostStudentService = new SM.ServiceHost(typeof(StudentService)); StartService(hostStudentService, "StudentService"); Console.WriteLine(""); Console.WriteLine("Press [Enter] to exit."); Console.ReadLine(); Console.WriteLine("Reservation Monitor Stopped"); StopService(hostStudentService, "StudentService"); }
public void Start() { try { _mfLoader = new MEFLoader(); foundCmds = _mfLoader.LoadByType <CommandBase>(commandFolder); if (foundCmds == null || foundCmds.Count == 0) { throw new NullReferenceException(string.Format("MEF was unable to load any command classes from {0}", commandFolder)); } _workerTask = Task.Factory.StartNew(Execute, _tokenSource.Token); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
static void Main() { Security.AddGenericPrincipal(); ObjectBase.Container = MEFLoader.Init(); ConsoleColor defaultColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Starting up services..."); Console.ForegroundColor = defaultColor; Console.WriteLine(); SM.ServiceHost hostInventoryManager = new SM.ServiceHost(typeof(InventoryManager)); SM.ServiceHost hostRentalManager = new SM.ServiceHost(typeof(RentalManager)); SM.ServiceHost hostAccountManager = new SM.ServiceHost(typeof(AccountManager)); StartService(hostInventoryManager, "InventoryManager"); StartService(hostRentalManager, "RentalManager"); StartService(hostAccountManager, "AccountManager"); var timer = new Timer(10000); timer.Elapsed += OnTimerElapsed; timer.Start(); Console.WriteLine("Reservation monitor started."); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Press [Enter] to exit."); Console.ForegroundColor = defaultColor; Console.ReadLine(); timer.Stop(); Console.WriteLine("Reservation monitor stopped."); Console.WriteLine(); StopService(hostInventoryManager, "InventoryManager"); StopService(hostRentalManager, "RentalManager"); StopService(hostAccountManager, "AccountManager"); }
static void Main(string[] args) { try { FileIOPermission f2 = new FileIOPermission(FileIOPermissionAccess.Read, Environment.CurrentDirectory + "\\WaterNut-EnterpriseDB.mdf"); f2.AddPathList(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, Environment.CurrentDirectory + "\\WaterNut-EnterpriseDB.mdf"); FileIOPermission f3 = new FileIOPermission(FileIOPermissionAccess.Read, Environment.CurrentDirectory + "\\WaterNut-EnterpriseDB_log.ldf"); f3.AddPathList(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, Environment.CurrentDirectory + "\\WaterNut-EnterpriseDB_log.ldf"); BusinessObjectBase.Container = MEFLoader.Init(); Services = BusinessObjectBase.Container.GetExportedValues <IBusinessService>().ToList(); //container.Compose(this); Parallel.ForEach(Services.OfType <IBusinessService>(), service => { var s = new ServiceHost(service.GetType()); StartService(s); s.Faulted += s_Faulted; } ); Console.WriteLine(""); Console.WriteLine("Press [Enter] to exit."); Console.ReadLine(); Console.WriteLine(""); //StopService(BatchServiceHost, "BatchService"); } catch (Exception ex) { Debugger.Break(); Console.WriteLine(ex.Message); Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine(ex.StackTrace); } }
static void Main(string[] args) { logger.Info("Bom.ServiceHost.Console version {0} started on {1}", Assembly.GetExecutingAssembly().GetName().Version, System.Environment.MachineName); SetDataDirectory(); GenericPrincipal principal = new GenericPrincipal( new GenericIdentity("Console"), new string[] { Security.BomAdminRole }); Thread.CurrentPrincipal = principal; ObjectBase.Container = MEFLoader.Init(); Console.WriteLine("Starting up services..."); Console.WriteLine(""); SM.ServiceHost hostSupplierManager = new SM.ServiceHost(typeof(SupplierManager)); SM.ServiceHost hostStockManager = new SM.ServiceHost(typeof(StockManager)); SM.ServiceHost hostPartManager = new SM.ServiceHost(typeof(PartManager)); SM.ServiceHost hostOrderManager = new SM.ServiceHost(typeof(OrderManager)); StartService(hostSupplierManager, "SupplierManager"); StartService(hostStockManager, "StockManager"); StartService(hostPartManager, "PartManager"); StartService(hostOrderManager, "OrderManager"); Console.WriteLine(""); Console.WriteLine("Press [Enter] to exit."); Console.ReadLine(); StopService(hostSupplierManager, "SupplierManager"); StopService(hostStockManager, "StockManager"); StopService(hostPartManager, "PartManager"); StopService(hostOrderManager, "OrderManager"); logger.Info("Bom.ServiceHost.Console exit"); }
static void InitializeContainer() { DirectoryCatalog moduleCatalog = new DirectoryCatalog(ConfigurationManager.AppSettings["moduleFolder"], "*.dll"); /// monitor the Modules folder for dlls _watcher = new FileSystemWatcher(ConfigurationManager.AppSettings["moduleFolder"], "*.dll"); _watcher.Created += (sender, e) => { moduleCatalog.Refresh(); }; _watcher.Changed += (sender, e) => { moduleCatalog.Refresh(); }; _watcher.EnableRaisingEvents = true; // load Mef container ObjectBase.Container = MEFLoader.Init(new List <ComposablePartCatalog>() { moduleCatalog , new AssemblyCatalog(Assembly.GetExecutingAssembly()) , new AssemblyCatalog(typeof(AlgorithmBase).Assembly) //, new DirectoryCatalog(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath)) }); // start the strategy algorithm if one was added ObjectBase.Container.ExportsChanged += (sender, e) => { foreach (var item in e.AddedExports) { if (item.ContractName == "MarketMiner.Algorithm.Common.Contracts.IAlgorithm") { Console.WriteLine(string.Format("\nNew {0} snap-in detected.", item.ContractName)); //ObjectBase.Container.ComposeExportedValue(item); IAlgorithm algorithm = item as IAlgorithm; _algorithms.Add(algorithm); AsyncPump.Run(() => Task.Factory.StartNew(() => StartAlgorithm(algorithm))); //Task.Factory.StartNew(() => StartAlgorithm(algorithm)); } } }; }
static void Main(string[] args) { ObjectBase.Container = MEFLoader.Initialize(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainForm form = new MainForm(); MainController controller = new MainController(form); using (SingletonController singletonController = new SingletonController("TVShowRename", form)) { if (singletonController.IsFirstInstance) { Application.Run((MainForm)singletonController.Enforcer); } else { singletonController.SendMessageToFirstInstance(args); } } }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); Thread.CurrentThread.CurrentCulture = new CultureInfo("es"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("es"); ObjectBase.Container = MEFLoader.Init(new List <ComposablePartCatalog>() { new AssemblyCatalog(Assembly.GetExecutingAssembly()) }); // Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; // new LoginWindow().ShowDialog(); //new Shell().Show(); //------> reporte de inventario telerik new Window1().Show(); //new MainWindow().Show(); // new Shell().Show(); // new //().Show(); GlobalModule.bytSUCURSAL = Convert.ToByte(GlobalModule.GetSetting("GrupoGuadiana", "Config", "SucursalID", String.Empty)); GlobalModule.bytEMPRESA = Convert.ToByte(GlobalModule.GetSetting("GrupoGuadiana", "Config", "EmpresaID", String.Empty)); ShellDockDesign NewWindowB = new ShellDockDesign(); //Current.MainWindow.WindowState = WindowState.Maximized; NewWindowB.Show(); // new ShellDockDesign(); }
static void Main(string[] args) { GenericPrincipal principal = new GenericPrincipal( new GenericIdentity("Kolya"), new string[] { Security.CAR_RENTAL_ADMIN } ); Thread.CurrentPrincipal = principal; ObjectBase.Container = MEFLoader.Init(); System.Console.WriteLine("Starting up service"); System.Console.WriteLine(""); SM.ServiceHost inventoryManagerHost = new SM.ServiceHost(typeof(InventoryManager)); StartService(inventoryManagerHost, "InventoryManager"); SM.ServiceHost accountManagerHost = new SM.ServiceHost(typeof(AccountManager)); StartService(accountManagerHost, "AccountManager"); SM.ServiceHost rentalManagerHost = new SM.ServiceHost(typeof(RentalManager)); StartService(rentalManagerHost, "RentalManager"); System.Timers.Timer timer = new System.Timers.Timer(100000); timer.Elapsed += OnTimerElapsed; timer.Start(); System.Console.WriteLine(""); System.Console.WriteLine("Press [Enter] to exit..."); System.Console.ReadLine(); timer.Stop(); System.Console.WriteLine("Reservation monitor started"); StopService(inventoryManagerHost, "InventoryManager"); StopService(accountManagerHost, "AccountManager"); StopService(rentalManagerHost, "RentalManager"); }
public void Initialize() { ObjectBase.Container = MEFLoader.Init(); }
public ServiceBase() { _name = this.GetType().Name; _logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); _mefLoader = new MEFLoader(); }
public DiasLaboralesManager() { ObjectBase.Container = MEFLoader.Init(); ObjectBase.Container.SatisfyImportsOnce(this); }