public static void Start <T>(PiracContext context = null) { context = context ?? new PiracContext(); SetContext(context); ConventionManager = new ConventionManager(Assembly.GetCallingAssembly(), context.AttachmentConvention, context.ViewConvention, context.ViewModelConvention); Container.Configure(ConventionManager.FindAllViews(), ConventionManager.FindAllViewModels(), ConventionManager.FindAllAttachments(), ConventionManager); var viewModel = Container.GetInstance <T>(); WindowManager.ShowWindow(viewModel); }
public static void SetContext(PiracContext context) { if (context == null) { throw new ArgumentNullException(nameof(context), $"{nameof(context)} is null."); } if (Interlocked.Exchange(ref contextSet, 1) == 0) { Logger = context.Logger; Container = context.Container; WindowManager = context.WindowManager; MainScheduler = context.MainScheduler; BackgroundScheduler = context.BackgroundScheduler; } }