Пример #1
0
        /// <summary>
        /// Initializes a new <see cref="NavigationService"/> instance.
        /// </summary>
        /// <param name="iocContainer">The IOC container which is used to instantiate the views and their corresponding view models.</param>
        /// <param name="window">The window for which the navigation service is to be created.</param>
        /// <param name="applicationView">The application view for which the navigation service is to be created.</param>
        /// <param name="navigationFrame">The frame with in which the actual navigation between views takes place.</param>
        internal NavigationService(IReadOnlyIocContainer iocContainer, Window window, ApplicationView applicationView, Frame navigationFrame)
        {
            // Validates the arguments
            if (iocContainer == null)
            {
                throw new ArgumentNullException(nameof(iocContainer));
            }
            if (window == null)
            {
                throw new ArgumentNullException(nameof(window));
            }
            if (applicationView == null)
            {
                throw new ArgumentNullException(nameof(applicationView));
            }
            if (navigationFrame == null)
            {
                throw new ArgumentNullException(nameof(navigationFrame));
            }

            // Stores the IoC container, the window, the application view, and the frame for later use
            this.iocContainer    = iocContainer;
            this.window          = window;
            this.ApplicationView = applicationView;
            this.navigationFrame = navigationFrame;
        }
        /// <summary>
        /// Initializes a new <see cref="WindowNavigationService"/> instance.
        /// </summary>
        /// <param name="iocContainer">The IOC container which is used to instantiate the windows and their corresponding view models.</param>
        public WindowNavigationService(IReadOnlyIocContainer iocContainer)
        {
            // Validates the arguments
            if (iocContainer == null)
            {
                throw new ArgumentNullException(nameof(iocContainer));
            }

            // Stores the IOC container for later use
            this.iocContainer = iocContainer;
        }
Пример #3
0
    private static void Init()
    {
        var container = new IocContainer();

        container.Implement <ICache>().Using <AssemblyCache>().AsSingleInstance();
        container.Implement <ISpklSettingsService>().Using <SpklSettingsService>().AsSingleInstance();
        container.Implement <IProxySettingsService>().Using <ProxySettingsService>().AsSingleInstance();
        container.Implement <IDirectoryService>().Using <DirectoryService>().AsSingleInstance();
        container.Implement <ITypeConverterFactory>().Using <TypeConverterFactory>();
        container.Implement <ICDSMetadataServiceFactory>().Using <CDSMetadataServiceFactory>().AsSingleInstance();

        Container = container;
    }