protected override void OnOk() { base.OnOk(); _info = txtInfo.Text.Trim(); if (_info.Length > 64) { MsgBox.Warning("Sorry,Your name is too long"); return; } bool isTemplate = this.Text == "New Template"; bool isLayerChangeName = this.Text == Resource.GetString(Resource.Strings.MessageChangeLayerName); if (_info == "") { if (isTemplate) { MsgBox.Warning(Resources.Resource.GetString(Resources.Resource.Strings.TemplateEmpty)); return; } else if (isLayerChangeName) { MsgBox.Warning(Resources.Resource.GetString(Resources.Resource.Strings.MessageLayerNameNotNull)); return; } else if (this.Text != "Enter Password") // MsgBox.Warning("Sorry,the password can't be empty."); //else { MsgBox.Warning("Sorry,the name can't be empty."); return; } } if (isTemplate) { bool isRepeat = false; TemplateGroups groups = DataGate.Project.Templates; foreach (TemplateGroup template in groups) { if (template.Name == _info) { isRepeat = true; } } if (isRepeat) { MsgBox.Warning(Resources.Resource.GetString(Resources.Resource.Strings.TemplateRepeat)); return; } } DialogResult = DialogResult.OK; Result = DialogResult; Close(); }
private void ParseAllTemplates(XDocument doc) { Logger.WriteVerbose("Parsing template group elements ..."); foreach (XElement item in from item in doc.Descendants("templategroup") select(item)) { TgxTemplateGroup tgxTemplateGroup = TgxTemplateGroup.FromXml(item, this); if (tgxTemplateGroup != null) { TemplateGroups.Add(tgxTemplateGroup); } } }
private void NewTemplate() { string name = InputDialog.GetInputValue("New Template"); //InputDialog dlg = new InputDialog("New Template"); //DialogResult result = dlg.ShowModalDialog(); //if (result == DialogResult.OK) //{ // name=dlg.Info; // } //else //return null; if (string.IsNullOrEmpty(name)) { return; } if (name.Trim() == "") { MsgBox.Warning(Resources.Resource.GetString(Resources.Resource.Strings.TemplateEmpty)); return; } bool isRepeat = false; TemplateGroups groups = DataGate.Project.Templates; foreach (TemplateGroup template in groups) { if (template.Name == name) { isRepeat = true; } } if (isRepeat) { MsgBox.Warning(Resources.Resource.GetString(Resources.Resource.Strings.TemplateRepeat)); return; } TemplateGroup group = new TemplateGroup(); group.Name = name; DataGate.Project.Templates.Add(group); //Tree.TemplateGroup = group; BindCombox(); ddlTemplate.SelectedItem = group; _currentGroup = group; }
private void BindCombox() { ddlTemplate.Properties.Items.Clear(); TemplateGroups groups = DataGate.Project.Templates; if (groups != null && groups.Count > 0) { this.ddlTemplate.Properties.Items.AddRange(groups.ToArray()); ddlTemplate.Text = TemplateGroup.Default.Name; btnDelete.Enabled = false; btnActive.Enabled = false; //ddlTemplate.SelectedIndex = 0; } //instance.Tree.TemplateGroup = TemplateGroup.Current; }
public void Clear() { _rootSign.Dispose(); _templates.Dispose(); _libraryGroups.Dispose(); _sessionInfos.Dispose(); _sources.Dispose(); _rootSign = new SignGroupTree(); _templates = new TemplateGroups(); _libraryGroups = new LibraryGroups(); _sessionInfos = new SessionInfos(); _sources = new ListSet <DataItem>(); _recents = new Recents(); }
private void NewTemplate() { string name = InputDialog.GetInputValue("New Template"); if (string.IsNullOrEmpty(name)) { return; } if (name.Trim() == "") { MsgBox.Warning(Resources.Resource.GetString(Resources.Resource.Strings.TemplateEmpty)); return; } bool isRepeat = false; TemplateGroups groups = DataGate.Project.Templates; foreach (TemplateGroup template in groups) { if (template.Name == name) { isRepeat = true; } } if (isRepeat) { MsgBox.Warning(Resources.Resource.GetString(Resources.Resource.Strings.TemplateRepeat)); return; } TemplateGroup group = new TemplateGroup(); group.Name = name; DataGate.Project.Templates.Add(group); BindCombox(); ddlTemplate.SelectedItem = group; _currentGroup = group; }
private void BindCombox() { ddlTemplate.Properties.Items.Clear(); TemplateGroups groups = DataGate.Project.Templates; if (groups != null && groups.Count > 0) { this.ddlTemplate.Properties.Items.AddRange(groups.ToArray()); if (_IsEdit) { if (Current.TemplateName != null) { for (int i = 0; i < groups.Count; i++) { if (groups[i].Name == Current.TemplateName) { ddlTemplate.SelectedItem = groups[i]; CurrentTemplateGroup = groups[i]; ddlSignType.SelectedItem = groups[i].Sign.SignType; break; } } } else { ddlTemplate.SelectedItem = CurrentTemplateGroup = Current.Template != null?groups.GetByName(Current.Template.Name) : TemplateGroup.Default; } } else { ddlTemplate.SelectedItem = TemplateGroup.Default; CurrentTemplateGroup = TemplateGroup.Default; Current.Template = TemplateGroup.Default.Copy(); Current.TemplateName = Current.Template.Name; } } }