public SimpleEventStore(IStoreSettings<IDbConnection> settings, IServiceBus serviceBus, ISerialize serializer, ISnapshotStore snapshotStore)
 {
     _settings = settings;
     _serviceBus = serviceBus;
     _serializer = serializer;
     _snapshotStore = snapshotStore;
 }
        public NEventStore(IStoreSettings<IStoreEvents> settings, IServiceBus serviceBus)
        {
            _settings = settings;
            _serviceBus = serviceBus;

            _store = _settings.GetConnection();
            _eventStream = _store.OpenStream("main");
        }
Example #3
0
 public JsonWindowLoaderService(IWindowsManagerService windowsManager,
                                IWindowsFactory windowsFactory,
                                IStoreSettings storeSettings)
 {
     _windowsManager = windowsManager ?? throw new ArgumentNullException(nameof(windowsManager));
     _windowsFactory = windowsFactory ?? throw new ArgumentNullException(nameof(windowsFactory));
     _storeSettings  = storeSettings ?? throw new ArgumentNullException(nameof(storeSettings));
 }
Example #4
0
        public RemotingServer(FMSImplementation p, string dataDir)
        {
            plugin = p;

            settingsServer = new SettingStore(dataDir);

            AppDomain.CurrentDomain.AssemblyResolve += ResolveEventHandler;
            AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += ResolveEventHandler;

            //Configure .NET Remoting
            if (System.IO.File.Exists(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile))
            {
                RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, false);
            }
            if (System.Runtime.Remoting.Channels.ChannelServices.RegisteredChannels.Count() == 0)
            {
                var clientFormatter = new System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider();
                var serverFormatter = new System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider();
                serverFormatter.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
                var props = new System.Collections.Hashtable();
                props["port"] = 8086;
                System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(new System.Runtime.Remoting.Channels.Tcp.TcpChannel(props, clientFormatter, serverFormatter), false);

                System.Runtime.Remoting.Lifetime.LifetimeServices.LeaseTime            = TimeSpan.FromMinutes(3);
                System.Runtime.Remoting.Lifetime.LifetimeServices.SponsorshipTimeout   = TimeSpan.FromMinutes(2);
                System.Runtime.Remoting.Lifetime.LifetimeServices.RenewOnCallTime      = TimeSpan.FromMinutes(1);
                System.Runtime.Remoting.Lifetime.LifetimeServices.LeaseManagerPollTime = TimeSpan.FromSeconds(10);
                System.Runtime.Remoting.RemotingConfiguration.CustomErrorsMode         = System.Runtime.Remoting.CustomErrorsModes.Off;
            }

            var jobDb      = plugin.Backend.JobDatabase();
            var logDb      = plugin.Backend.LogDatabase();
            var inspServer = plugin.Backend.InspectionControl();
            var jobControl = plugin.Backend.JobControl();
            var oldJob     = plugin.Backend.OldJobDecrement();

            singletons = new RemoteSingletons();

            singletons.RemoteSingleton(typeof(IJobDatabase),
                                       "JobDB",
                                       jobDb);
            singletons.RemoteSingleton(typeof(ILogDatabase),
                                       "LogDB",
                                       logDb);
            singletons.RemoteSingleton(typeof(IInspectionControl),
                                       "InspectionControl",
                                       inspServer);
            singletons.RemoteSingleton(typeof(IJobControl),
                                       "JobControl",
                                       jobControl);
            singletons.RemoteSingleton(typeof(IOldJobDecrement),
                                       "OldJobDecrement",
                                       oldJob);
            singletons.RemoteSingleton(typeof(IStoreSettings),
                                       "Settings",
                                       settingsServer);
        }
Example #5
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            WcfMutexSingleInstanceRunner instanceRunner = new WcfMutexSingleInstanceRunner("8E756836-F0DE-490E-AEA5-EDAADF9C5FF8");

            if (!instanceRunner.Run(e))
            {
                instanceRunner.Dispose();
                Shutdown(0);
            }
            m_dispatcher = new DispatcherWrapper(Dispatcher.CurrentDispatcher);
            instanceRunner.SecondInstanceStarted += CreateSettingsWindow;


            #region Upgrade settings
            if (!HandMeAFile.Properties.Settings.Default.Updated)
            {
                HandMeAFile.Properties.Settings.Default.Updated = true;
                HandMeAFile.Properties.Settings.Default.Upgrade();
                HandMeAFile.Properties.Settings.Default.Save();
            }
            #endregion

            IClipboard clipboard = new ClipboardWrapper();
            m_packsRepository = new ClipboardFilesRepository(new ClipboardNotifier(), clipboard);
            m_settings        = new SettingsStorage(m_packsRepository, new FilePackSerializer(new XDocumentProvider()));
            m_packsRepository.Init(m_settings.FilePacks.Select(p => p.SetCount((p.ClipboardCount + 1) / 2)).ToArray());


            IProvideContextMenu contextMenuProvider = new ContextMenuProvider();

            IContextMenu     contextMenu      = contextMenuProvider.Provide(new IMenuItem[0]);
            IProvideMenuItem menuItemProvider = new MenuItemProvider();
            IMenuItem        settingsMenuItem = menuItemProvider.Provide("Settings");
            IMenuItem        exitMenuItem     = menuItemProvider.Provide("Exit");
            contextMenu.Add(menuItemProvider.Provide("-"));
            contextMenu.Add(settingsMenuItem);
            contextMenu.Add(exitMenuItem);
            settingsMenuItem.Click += CreateSettingsWindow;
            exitMenuItem.Click     += (senderObj, args) => Shutdown(0);
            m_contextUpdater        = new ContextMenuUpdater(m_packsRepository, contextMenu, menuItemProvider, clipboard);


            IRunTheTrayApp trayApplication = new TrayApplication(contextMenu,
                                                                 new ApplicationWrapper(this),
                                                                 new NotifyIconProvider(),
                                                                 new StaticIconProvider(new IconWrapper(HandMeAFile.Properties.Resources.HandMeAFile)),
                                                                 doubleClickAction: CreateSettingsWindow);
            trayApplication.Run();
        }
 public GetEventStore(IStoreSettings<IEventStoreConnection> eventStoreSettings, IServiceBus serviceBus)
 {
     _eventStoreSettings = eventStoreSettings;
     _serviceBus = serviceBus;
 }