/// <summary>Loads the BPL model.</summary> internal void LoadBpl() { var profile = LoadModel(); var safeProfile = new BplProfile(ServiceName); safeProfile.Add(AppDomain.CurrentDomain.Load("Mpcr.Core")); safeProfile.Add(AppDomain.CurrentDomain.Load("Mpcr.Model")); safeProfile.Add(AppDomain.CurrentDomain.Load("Mpcr.Services.Oscar")); if (profile != null) { safeProfile.Add(profile.Types); } safeProfile.Seal(); BplLanguage.RuntimeMode = BplRuntimeMode.Batch; BplLanguage.Load(safeProfile, BplLoadingOptions.ThreadSafe); BplLanguage.LoadTaxonomies(Path.Combine(StartupFolder, "Taxonomies")); BplLanguage.TimeZone = TimeZoneInfo.Local.GetUtcOffset(DateTime.Now); // strangely, this is the simplest way to auto-adjust for time/DST changes (SystemEvents.TimeChange comes via WM_TIMECHANGED message, so it demands and window proc) _timeTimer = new Timer(t => { BplLanguage.TimeZone = TimeZoneInfo.Local.GetUtcOffset(DateTime.Now); }, null, TimeSpan.Zero, TimeSpan.FromMinutes(1)); if (ServerBehavior.IsServer) { ServiceManager.InitializeHandlers(); } if (ServerBehavior.IsClient) { ServiceManager.InitializeInvokers(); } }
private void _loadModel(string profileName, IEnumerable<string> moduleNames) { LoadingPopup.IsOpen = true; LeadingVersion = new Version(); LeadingTimestamp = DateTime.MinValue; var profile = new BplProfile(profileName); profile.Add(typeof(BplObject).Assembly); foreach (var name in moduleNames) { var assembly = AppDomain.CurrentDomain.Load(Path.GetFileNameWithoutExtension(name)); profile.Add(assembly); var date = File.GetLastWriteTime(Path.Combine(AssembliesFolder, name)); if (date > LeadingTimestamp) LeadingTimestamp = date; var version = assembly.GetName().Version; if (version > LeadingVersion) LeadingVersion = version; } profile.Seal(); ViewName = null; BplLanguage.Load(profile); BplLanguage.LoadTaxonomies(TaxonomiesFolder); LoadedClasses = new ReadOnlySet<BplClass>(BplLanguage.Classes); _selectedClasses = new HashSet<BplClass>(); SelectedClasses = new ReadOnlySet<BplClass>(_selectedClasses); _hiddenClasses = new HashSet<BplClass>(); HiddenClasses = new ReadOnlySet<BplClass>(_hiddenClasses); _applyClassFilter(); _onModelLoaded(); GuiTimer.StartAfterRender(t => { try { if (File.Exists(SettingsFile)) { var snapshot = DiagramSnapshot.Load(SettingsFile); snapshot.Restore(DiagramViewer); } } catch { } }); GuiTimer.StartAfterRender(t => _loadDocumentation()); }