Exemple #1
0
 public BaseRepository()
 {
     context  = new Entities();
     retMsg   = new ObjectParameter("RetMsg", "");
     retValue = new ObjectParameter("RetVal", 0);
     al       = new AppLogManager();
 }
        protected override void Configure()
        {
            InitializeApplicationDataDirectory();

            var composeTask = Task.Factory.StartNew(() =>
            {
                // var aggregateCatalog = new AggregateCatalog(AssemblySource.Instance.Select(x => new AssemblyCatalog(x)));
                var aggregateCatalog = new AggregateCatalog(new AssemblyCatalog(GetType().Assembly), new AssemblyCatalog(typeof(AutoCaptureEngine).Assembly), new AssemblyCatalog(typeof(IRepository <>).Assembly));
                Container            = new CompositionContainer(aggregateCatalog);
                var batch            = new CompositionBatch();
                batch.AddExportedValue(Container);
                batch.AddExportedValue <IEventAggregator>(new EventAggregator());
                batch.AddExportedValue <IWindowManager>(new CustomWindowManager());
                batch.AddExportedValue <Func <IMessageBox> >(() => Container.GetExportedValue <IMessageBox>());
                batch.AddExportedValue <Func <HearthStatsDbContext> >(() => new HearthStatsDbContext());

                // batch.AddExportedValue<IWindowManager>(new AppWindowManager());
                // batch.AddExportedValue(MessageBus.Current);

                var compose = Container.GetExportedValue <CompositionBuilder>();
                compose.Compose(batch);
                // var composeTasks = this.GetAllInstances<ICompositionTask>();
                // composeTasks.Apply(s => s.Compose(batch));
                Container.Compose(batch);
            });

            var initDbTask = Task.Factory.StartNew(InitializeDatabase);

            Task.WaitAll(composeTask, initDbTask);

            var logPath = Path.Combine((string)AppDomain.CurrentDomain.GetData("DataDirectory"), "logs");

            _logManager = Container.GetExportedValue <IAppLogManager>();
            _logManager.Initialize(logPath);
            Container.GetExportedValue <CrashManager>().WireUp();

            // Apply xaml/wpf fixes
            var currentUICult = Thread.CurrentThread.CurrentUICulture.Name;
            var currentCult   = Thread.CurrentThread.CurrentCulture.Name;

            Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(currentUICult);
            Thread.CurrentThread.CurrentCulture   = CultureInfo.GetCultureInfo(currentCult);

            FrameworkElement.LanguageProperty.OverrideMetadata(
                typeof(FrameworkElement),
                new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

            // Hook caliburn filter
            FilterFrameworkCoreCustomization.Hook();

            // Hook application events
            Application.Activated   += (s, e) => Container.GetExportedValue <IEventAggregator>().PublishOnCurrentThread(new ApplicationActivatedEvent());
            Application.Deactivated += (s, e) => Container.GetExportedValue <IEventAggregator>().PublishOnCurrentThread(new ApplicationDeActivatedEvent());
        }
        protected override void Configure()
        {
            InitializeApplicationDataDirectory();

            var composeTask = Task.Factory.StartNew(() =>
                {
                    // var aggregateCatalog = new AggregateCatalog(AssemblySource.Instance.Select(x => new AssemblyCatalog(x)));
                    var aggregateCatalog = new AggregateCatalog(new AssemblyCatalog(GetType().Assembly), new AssemblyCatalog(typeof(AutoCaptureEngine).Assembly), new AssemblyCatalog(typeof(IRepository<>).Assembly));
                    Container = new CompositionContainer(aggregateCatalog);
                    var batch = new CompositionBatch();
                    batch.AddExportedValue(Container);
                    batch.AddExportedValue<IEventAggregator>(new EventAggregator());
                    batch.AddExportedValue<IWindowManager>(new CustomWindowManager());
                    batch.AddExportedValue<Func<IMessageBox>>(() => Container.GetExportedValue<IMessageBox>());
                    batch.AddExportedValue<Func<HearthStatsDbContext>>(() => new HearthStatsDbContext());

                    // batch.AddExportedValue<IWindowManager>(new AppWindowManager());
                    // batch.AddExportedValue(MessageBus.Current);

                    var compose = Container.GetExportedValue<CompositionBuilder>();
                    compose.Compose(batch);
                    // var composeTasks = this.GetAllInstances<ICompositionTask>();
                    // composeTasks.Apply(s => s.Compose(batch));
                    Container.Compose(batch);
                });

            var initDbTask = Task.Factory.StartNew(InitializeDatabase);

            Task.WaitAll(composeTask, initDbTask);

            var logPath = Path.Combine((string)AppDomain.CurrentDomain.GetData("DataDirectory"), "logs");
            _logManager = Container.GetExportedValue<IAppLogManager>();
            _logManager.Initialize(logPath);
            Container.GetExportedValue<CrashManager>().WireUp();

            // Apply xaml/wpf fixes
            var currentUICult = Thread.CurrentThread.CurrentUICulture.Name;
            var currentCult = Thread.CurrentThread.CurrentCulture.Name;

            Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(currentUICult);
            Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo(currentCult);

            FrameworkElement.LanguageProperty.OverrideMetadata(
                typeof(FrameworkElement),
                new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

            // Hook caliburn filter
            FilterFrameworkCoreCustomization.Hook();

            // Hook application events
            Application.Activated += (s, e) => Container.GetExportedValue<IEventAggregator>().PublishOnCurrentThread(new ApplicationActivatedEvent());
            Application.Deactivated += (s, e) => Container.GetExportedValue<IEventAggregator>().PublishOnCurrentThread(new ApplicationDeActivatedEvent());
        }
Exemple #4
0
 public EventLogic()
 {
     eventAccess    = new EventAccess();
     iAppLogManager = new AppLogManager();
 }
 public AppSessionManager()
 {
     iAppLogManager = new AppLogManager();
 }
 public CrashManager(IAppLogManager appLogManager)
 {
     this.appLogManager = appLogManager;
 }
Exemple #7
0
 public EventAccess()
 {
     iAppLogManager = new AppLogManager();
 }
 public CrashManager(IAppLogManager appLogManager)
 {
     this.appLogManager = appLogManager;
 }
Exemple #9
0
 public APPCacheManager()
 {
     baseLogic      = new BaseLogic();
     iAppLogManager = new AppLogManager();
 }
 public BaseAccess()
 {
     iAppLogManager = new AppLogManager();
 }