public Page GetModulePage(string ModuleKey) { Page PageModule = (Page)this.GetModuleItem(ModuleKey).Instance; if (PageModule == null) { try { ObjectHandle handle = Activator.CreateInstanceFrom(Assembly.GetExecutingAssembly().Location, this.GetModuleItem(ModuleKey).ClassName); PageModule = (Page)handle.Unwrap(); this.GetModuleItem(ModuleKey).Instance = PageModule; } catch (Exception ex) { //If error that means the page is under construction. LogManager.Instance.LogMessage("Unable to load page: " + ModuleKey, ex); PageModule = new Page(); i9Label l = new i9Label(); l.Content = ModuleKey + " Coming Soon"; l.FontSize = 18; l.HorizontalContentAlignment = HorizontalAlignment.Center; l.VerticalAlignment = VerticalAlignment.Center; PageModule.Content = l; this.GetModuleItem(ModuleKey).Instance = PageModule; } } return PageModule; }
public Window GetModuleWindows(string ModuleName) { Window ModuleWindow = (Window)this.GetModuleItem(ModuleName).Instance; if (ModuleWindow == null) { ObjectHandle handle2 = Activator.CreateInstanceFrom(Assembly.GetExecutingAssembly().Location, this.GetModuleItem(ModuleName).ClassName); ModuleWindow = (Window)handle2.Unwrap(); ModuleWindow.Title = this.GetModuleItem(ModuleName).ModuleName; this.GetModuleItem(ModuleName).Instance = ModuleWindow; } return ModuleWindow; }
public System.Windows.Forms.Form GetModuleForm(string modItem) { System.Windows.Forms.Form FormModule = (System.Windows.Forms.Form)this.GetModuleItem(modItem).Instance; if (FormModule == null) { ObjectHandle handle2 = Activator.CreateInstanceFrom(Assembly.GetExecutingAssembly().Location, this.GetModuleItem(modItem).ClassName); FormModule = (System.Windows.Forms.Form)handle2.Unwrap(); FormModule.Text = this.GetModuleItem(modItem).ModuleName; this.GetModuleItem(modItem).Instance = FormModule; } return FormModule; }