public string GetXslFileName(ConcreteTemplateNodeDefinition nodeDefinition) { string dbName = string.Empty; TemplateNodeInfo templateToDisplay = GetTemplateToDisplay(nodeDefinition, out dbName); if (string.IsNullOrEmpty(templateToDisplay.XslTemplateFileName)) { return(null); } if (!string.IsNullOrWhiteSpace(templateToDisplay.XslTemplateFileName)) { return(this._model.FilesProvider.GetXslLocalizedTemplateFileName( templateToDisplay.XslTemplateFileName, nodeDefinition.Connection.TemplateDir )); } TemplateNodeLocaleInfo localized = templateToDisplay.GetLocale( true, this._model.Settings.ReportLanguage ); return(this._model.FilesProvider.GetXslTemplateFileName( localized.TemplateFile, nodeDefinition.Connection.TemplateDir )); }
public override string ToString() { string strQueryName = null; TemplateNodeLocaleInfo NodeInfo = null; if (this._queryInfo != null) { if (this._queryInfo.Locales != null && this._queryInfo.Locales.Any()) { NodeInfo = this._queryInfo.Locales.FirstOrDefault( it => it.Language == Program.Model.Settings.InterfaceLanguage ); } if (NodeInfo != null && NodeInfo.Text != null) { strQueryName = NodeInfo.Text.Trim(); } else { strQueryName = string.Format("{0} [{1}]", this._queryInfo.QueryName, this._queryInfo.Id ); } } return(strQueryName); }
private string GetTreeTitle( TemplateNodeLocaleInfo liTreeTitle, string templateName, string connectionName ) { string strTreeTitle = String.Empty; string treeTitleMacroFrtStr = String.Empty; string macroStr = String.Empty; if (liTreeTitle != null) { macroStr = liTreeTitle.Text; if (macroStr != null) { macroStr = macroStr.Replace("\r", String.Empty); macroStr = macroStr.Replace("\n", String.Empty); macroStr = macroStr.Replace("\t", String.Empty); } treeTitleMacroFrtStr = macroStr; } else { // default macro treeTitleMacroFrtStr = "$ModuleName$"; } if (treeTitleMacroFrtStr != null) { treeTitleMacroFrtStr = treeTitleMacroFrtStr.Replace("$ModuleName$", "{0}"); treeTitleMacroFrtStr = treeTitleMacroFrtStr.Replace("$ConnectionName$", "{1}"); strTreeTitle = string.Format(treeTitleMacroFrtStr, templateName ?? "<-->", connectionName ?? "<-->" ); } return(strTreeTitle); }
private void btnDefaultName_Click(object sender, EventArgs e) { TemplateNodeInfo templateNodeInfo = this._nodeDefinition.TemplateNode; this._userSettingsManager.SaveUserSettings( new UserSettingsRow { TemplateNodeId = templateNodeInfo.TemplateNodeId.GetValueOrDefault(), NodeUIName = string.Empty, } ); TemplateNodeLocaleInfo locale = templateNodeInfo.Locales.FirstOrDefault( l => l.Language == this._model.Settings.InterfaceLanguage ); if (locale != null) { this.txtNodeName.Text = locale.Text; } }
private string GetNodeName() { if (this._template != null) { ActivitySetting activitySetting = this._template.Connection.Activity; if (activitySetting.NewNameNode != null) { return(activitySetting.NewNameNode); } TemplateNodeLocaleInfo lang = this.Language; if (lang != null) { return(lang.Text); } } return(this._nodeDefinition.TemplateNode.Title); }
private void UpdateNodeTitle( TreeNode treeNode, int?nodeCount ) { ConcreteTemplateNodeDefinition nodeDefinition = treeNode.Tag as ConcreteTemplateNodeDefinition; string text = string.Empty; if (nodeDefinition != null) { if (nodeDefinition.TemplateNode != null) { nodeDefinition.TemplateNode.CounterValue = nodeCount; } Action updateNodeTextAction = () => { if (nodeDefinition.IsRoot) { TemplateNodeLocaleInfo liTreeTitle = nodeDefinition.TemplateNode.GetTemplateTreeTitleLocalized(); string templateName = nodeDefinition.TemplateNode.Title; string connectionName = nodeDefinition.Connection.Name; text = GetTreeTitle(liTreeTitle, templateName, connectionName); } else { text = nodeDefinition.FormatNodeText(nodeCount); } if (!text.Equals(treeNode.Text)) { treeNode.Text = text; } }; this._treeControl.SafeInvoke(updateNodeTextAction); } }
private void btnOk_Click(object sender, EventArgs e) { BindingWrapper <string> iconItem = cmbNodeIcon.SelectedItem as BindingWrapper <string>; if (iconItem == null) { return; } string iconFileName = Path.GetFileNameWithoutExtension(iconItem.Item); TemplateNodeInfo nodeInfo = this._nodeDefinition.TemplateNode; string nodeName = nodeInfo.Title; if (string.IsNullOrEmpty(nodeName)) { nodeName = GetNodeName(); } string additionalText = this._node.Text.Length > nodeName.Length ? this._node.Text.Substring(nodeName.Length) : ""; this._node.Text = txtNodeName.Text + additionalText; this._node.ImageKey = iconFileName; this._node.SelectedImageKey = iconFileName; if (this._nodeDefinition.NodeAvailable) { this._node.ForeColor = panelColor.BackColor; } this._nodeDefinition.NodeActivated = !chkDeactivateNode.Checked; if (this._nodeDefinition.TemplateNode.Childs.Count > 0) { bool disableChild = chkDeactivateNode.Checked; UpdateChildNodes(this._node, disableChild); } string nodeUiName = this.txtNodeName.Text; TemplateNodeLocaleInfo locale = nodeInfo.Locales.FirstOrDefault( l => l.Language == this._model.Settings.InterfaceLanguage ); if (locale != null) { if (locale.Text == nodeUiName) { nodeUiName = string.Empty; } } nodeInfo.FontColor = this.panelColor.BackColor.Name; nodeInfo.UIcon = iconFileName; nodeInfo.Title = nodeUiName; nodeInfo.IsDisabled = this.chkDeactivateNode.Checked; this._userSettingsManager.SaveUserSettings( new UserSettingsRow { TemplateNodeId = nodeInfo.TemplateNodeId.GetValueOrDefault(), NodeEnabled = !this.chkDeactivateNode.Checked, NodeFontColor = this.panelColor.BackColor.Name, NodeUIIcon = iconFileName, NodeUIName = nodeUiName } ); this._model.GetVaultProcessor(this._nodeDefinition.Connection) .CurrentStorage.Save(nodeInfo); }
private void setTitle(string connectionName, string templateName) { string macroStr = String.Empty; string macroFmtStr = String.Empty; if (string.IsNullOrEmpty(connectionName) && string.IsNullOrEmpty(templateName)) { // default format string macroFmtStr = "$ApplicationProductName$ - $ApplicationProductVersion$"; macroStr = Program.Model.Settings.SystemSettings.MainFormWindowTitle.Locales.FirstOrDefault( l => l.Language == Program.Model.Settings.InterfaceLanguage).Text; if (!string.IsNullOrEmpty(macroStr)) { macroFmtStr = macroStr; } } else { // default format string macroFmtStr = "$ConnectionName$ - $ModuleName$ - $ApplicationProductName$ - $ApplicationProductVersion$"; if (string.IsNullOrEmpty(templateName)) { if (this._ActiveTab != null && this._ActiveTab.SelectedTemplate != null) { TemplateNodeLocaleInfo linf = this._ActiveTab.SelectedTemplate.Locales.FirstOrDefault( l => l.Language == Program.Model.Settings.InterfaceLanguage); if (linf != null) { templateName = linf.Text; } } } if (this._ActiveTab != null && this._ActiveTab.SelectedTemplate != null && this._ActiveTab.SelectedTemplate.MainFormWindowTitle != null ) { macroStr = this._ActiveTab.SelectedTemplate.MainFormWindowTitle.Locales.FirstOrDefault( l => l.Language == Program.Model.Settings.InterfaceLanguage).Text; if (!string.IsNullOrEmpty(macroStr)) { macroFmtStr = macroStr; } } } macroFmtStr = macroFmtStr.Replace("$ApplicationProductName$", "{0}"); macroFmtStr = macroFmtStr.Replace("$ApplicationProductVersion$", "{1}"); macroFmtStr = macroFmtStr.Replace("$ConnectionName$", "{2}"); macroFmtStr = macroFmtStr.Replace("$ModuleName$", "{3}"); this.Text = string.Format(macroFmtStr, Application.ProductName, Application.ProductVersion, connectionName, templateName ); }
private void InitializeBindings() { // retrieve connection type ConnectionType connectionType = null; InstanceInfo firstInstance = this._connectionGroup.Connections.FirstOrDefault(); if (firstInstance != null) { BindingWrapper <ConnectionType> typeWrapper = this._model.GetConnectionType(firstInstance.Type); if (typeWrapper != null) { connectionType = typeWrapper.Item; cmbDataBaseType.DataSource = Lists.Of(typeWrapper); } } Template template = null; if (this._connectionGroup.IsExternal) { this.optOpenTemplateFromFile.Checked = true; string path = Path.Combine( this._connectionGroup.TemplateDir, this._connectionGroup.TemplateFileName ); this.cmbPathToFile.DataSource = Lists.Of(path); XmlSerializer serializer = new XmlSerializer(typeof(Template)); XmlDocument docTemplate = new XmlDocument(); docTemplate.Load(path); using (XmlNodeReader nodeReader = new XmlNodeReader(docTemplate)) { using (XmlReader xmlReader = XmlReader.Create(nodeReader, XmlUtils.GetXmlReaderSettings())) { template = (Template)serializer.Deserialize(xmlReader); } } } else { this.optSelectExistTemplate.Checked = true; template = this._templates.Value.FirstOrDefault(t => t.Id == this._connectionGroup.TemplateId); if (template != null) { TemplateNodeLocaleInfo locale = template.Locales.FirstOrDefault( l => l.Language == Settings.InterfaceLanguage ); string templateName = (locale ?? template.Locales.First()).Text; this.cmbTemplate.DataSource = Lists.Of(templateName.RemoveWhitespaces()); } } if (template != null && connectionType != null) { string templateType = template.Type; ModuleType moduleType = connectionType.ModuleTypes.FirstOrDefault( m => m.Id == templateType ); if (moduleType != null) { BindingWrapper <ModuleType> moduleWrapper = new BindingWrapper <ModuleType>( moduleType, module => { i18n localeItem = module.Locales.FirstOrDefault( l => l.Language == Settings.InterfaceLanguage); string displayName = localeItem != null ? localeItem.Text : module.Id; return(displayName.RemoveWhitespaces()); } ); cmbModuleTypes.DataSource = Lists.Of(moduleWrapper); } FillConnections(connectionType); SelectCurrentGroup(); txtGroupName.Text = this._connectionGroup.Name; } }