Skip to content

JamesnetGroup/jamesnet.foundation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jamesnet.Foundation

Jamesnet.Foundation is a core library that provides common functionality across various platforms. It is referenced by several platform-specific projects, which utilize its essential features.

NuGet Version NuGet Downloads

Note: NuGet publish date information is not available, so it is not included.

Supported Platforms

Installation

Install the package using the NuGet Package Manager:

Install-Package Jamesnet.Foundation

For WPF projects, you should also install the following package:

Install-Package Jamesnet.Platform.Wpf

Usage

Jamesnet.Foundation supports application initialization through the AppBootstrapper class. The following example demonstrates how to extend AppBootstrapper in a WPF project for initialization.

Note: There is no need to explain the virtual keyword or the old SetMainWindow approach.

Example: Using AppBootstrapper in a WPF Project

using Jamesnet.Foundation;
using Jamesnet.Platform.Wpf; // WPF platform package reference

namespace MyApp
{
    public class MyAppBootstrapper : AppBootstrapper
    {
        protected override void RegisterViewModels()
        {
            // Map the view to the view model.
            ViewModelMapper.Register<MainContent, MainViewModel>();
        }

        protected override void RegisterDependencies(IContainer container)
        {
            // Register MainContent as the IView implementation with the key "MainContent".
            Container.RegisterSingleton<IView, MainContent>("MainContent");
        }

        protected override void SettingsLayer(ILayerManager layer, IContainer container)
        {
            // Perform mapping using the "Main" key.
            Mapping("Main", container.Resolve<IView>("MainContent"));
        }
    }

    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            var bootstrapper = new MyAppBootstrapper();
            bootstrapper.Run(); // Execute application initialization
        }
    }
}

In this example:

  • Dependency Registration: Container.RegisterSingleton<IView, MainContent>("MainContent"); registers MainContent as an implementation of the IView interface with the key "MainContent".
  • View-ViewModel Mapping: ViewModelMapper.Register<MainContent, MainViewModel>(); maps the MainContent view to the MainViewModel.
  • Layer Settings: Mapping("Main", container.Resolve<IView>("MainContent")); sets up the mapping for the "Main" layer using the registered view.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  
  •  

Packages

No packages published

Languages