public static FirLibApplicationLoader AddConfigurationFileService(
     this FirLibApplicationLoader loader,
     string appName)
 {
     loader.Services.Register(
         typeof(IConfigurationFileAccessors),
         new ConfigurationFileAccessors(appName));
     return(loader);
 }
 public static FirLibApplicationLoader AddSingleApplicationInstanceService_UsingMutex(
     this FirLibApplicationLoader loader,
     string mutexName)
 {
     loader.Services.Register(
         typeof(ISingleApplicationInstanceService),
         new MutexBasedSingleApplicationInstanceService(mutexName));
     return(loader);
 }
Exemplo n.º 3
0
 public static FirLibApplicationLoader AddSingleApplicationInstanceService_Using_WM_COPYDATA(
     this FirLibApplicationLoader loader,
     string controlName)
 {
     loader.Services.Register(
         typeof(ISingleApplicationInstanceService),
         new WmCopyDataSingleApplicationInstanceService(controlName));
     return(loader);
 }
Exemplo n.º 4
0
        public static FirLibApplicationLoader AttachToWpfEnvironment(this FirLibApplicationLoader loader)
        {
            var uiMessenger = new FirLibMessenger();

            loader.AddLoadAction(() =>
            {
                Application.Current.DispatcherUnhandledException += CurrentOnDispatcherUnhandledException;

                uiMessenger.CustomSynchronizationContextEqualityChecker = CheckForEqualSynchronizationContexts;
                uiMessenger.ConnectToGlobalMessaging(
                    FirLibMessengerThreadingBehavior.EnsureMainSyncContextOnSyncCalls,
                    FirLibConstants.MESSENGER_NAME_GUI,
                    SynchronizationContext.Current);
            });
            loader.AddUnloadAction(() =>
            {
                Application.Current.DispatcherUnhandledException -= CurrentOnDispatcherUnhandledException;
                uiMessenger.DisconnectFromGlobalMessaging();
            });

            return(loader);
        }