internal static AppConfig ShowForm(StartupBunch StartupBunch) { AppSelectForm appSelectForm = new AppSelectForm(StartupBunch); appSelectForm.ShowDialog(); return appSelectForm.DialogResult == DialogResult.OK ? appSelectForm._selectedAppConfig : null; }
internal AppSelectForm(StartupBunch StartupBunch) { InitializeComponent(); this.imageListBoxControl1.Items.AddRange(StartupBunch.AppConfigs); this.imageListBoxControl1.SetSelected(0, true); }
internal static StartupBunch Initialize() { StartupBunch sttpBunch = ConfigurationSettings.GetConfig("dataAvailConfig") as StartupBunch; if (sttpBunch == null) { sttpBunch = new StartupBunch(); } return sttpBunch; }
private static AppConfig SelectApp(StartupBunch StartupBunch) { if (StartupBunch.AppConfigs.Length > 1) { return AppSelectForm.ShowForm(StartupBunch); } else { return StartupBunch.AppConfigs[0]; } }
private IEnumerable<AppConfig> GetAppConfigs(StartupBunch StartupBunch, XElement AppsElements) { foreach (XElement appEl in AppsElements.Elements("app")) { XElement modelEl = appEl.Element("modelFolder"); XElement plugEl = appEl.Element("plugins"); AppConfig config = new AppConfig(StartupBunch) { Caption = XmlLinq.GetAttributeSafe(appEl, "caption"), BaseFolder = XmlLinq.GetAttributeSafe(appEl, "path"), ImgSplashFile = XmlLinq.GetAttributeSafe(appEl, "imgSplash"), TmpFolder = XmlLinq.GetAttributeSafe(appEl.Element("tmpFolder"), "path"), XmlFolder = XmlLinq.GetAttributeSafe(appEl.Element("xmlFolder"), "path"), PluginsFolder = XmlLinq.GetAttributeSafe(plugEl, "path"), IsActive = XmlLinq.ReadAttributeBool(appEl, "active", true, null) }; if (plugEl != null) { config.ClaulatorFile = XmlLinq.GetAttributeSafe(plugEl.Element("calculator"), "path"); } if (modelEl != null) { config.ModelFolder = XmlLinq.GetAttributeSafe(modelEl, "path"); config.ModelFile = XmlLinq.GetAttributeSafe(modelEl.Element("model"), "path"); config.ViewFile = XmlLinq.GetAttributeSafe(modelEl.Element("view"), "path"); config.SecurityFile = XmlLinq.GetAttributeSafe(modelEl.Element("security"), "path"); } if (string.IsNullOrEmpty(config.ModelFolder)) config.ModelFolder = DefModelBasePath; if (string.IsNullOrEmpty(config.ModelFile)) config.ModelFile = DefModelFileName; if (string.IsNullOrEmpty(config.ViewFile)) config.ViewFile = DefViewFileName; if (string.IsNullOrEmpty(config.SecurityFile)) config.SecurityFile = DefSecurityFileName; if (string.IsNullOrEmpty(config.XmlFolder)) config.XmlFolder = DefSerializationPath; if (string.IsNullOrEmpty(config.PluginsFolder)) config.PluginsFolder = DefPluginsFolderPath; yield return config; } }
public object Create(object parent, object configContext, System.Xml.XmlNode section) { XElement configEl = section.GetXElement(); StartupBunch sttpBunch = new StartupBunch() { BaseFolder = XmlLinq.GetAttributeSafe(configEl, "path") }; XElement xApps = configEl.Element("apps"); string sharedPluginsPath = XmlLinq.GetAttributeSafe(xApps, "sharedPluginsPath"); if (!string.IsNullOrEmpty(sharedPluginsPath)) sttpBunch.SharedPluginsFolder = DataAvail.Utils.Path.GetFullPath(sttpBunch.BaseFolder, sharedPluginsPath); sttpBunch.AppConfigs = GetAppConfigs(sttpBunch, xApps).Where(p => p.IsActive).ToArray(); return sttpBunch; }
internal AppConfig(StartupBunch StartupBunch) { _startupBunch = StartupBunch; }