本文整理汇总了C#中System.Xml.Schema.XmlSchemaAnnotated类的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaAnnotated类的具体用法?C# XmlSchemaAnnotated怎么用?C# XmlSchemaAnnotated使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlSchemaAnnotated类属于System.Xml.Schema命名空间,在下文中一共展示了XmlSchemaAnnotated类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DocUIList
public DocUIList(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm, bool horizontal = true)
: base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
{
_optlist = new List<ListItemComponent>();
_parent = xmlNode;
_listpanel = new StackPanel();
_listpanel.Orientation = horizontal ? Orientation.Horizontal : Orientation.Vertical;
XmlSchemaElement schemaEl = xsdNode as XmlSchemaElement;
if (schemaEl != null)
{
XmlSchemaSequence seq = XmlSchemaUtilities.tryGetSequence(schemaEl.ElementSchemaType);
if (seq != null && seq.Items.Count == 1 && seq.Items[0] is XmlSchemaElement)
{
_el = seq.Items[0] as XmlSchemaElement;
//get all elements from current node
foreach (XmlNode node in xmlNode.ChildNodes)
{
ListItemComponent lio = new ListItemComponent(node, _el, _listpanel, overlaypanel, _optlist, parentForm);
_optlist.Add(lio);
}
}
Button add = new Button();
add.Content = "Add item";
add.Click += AddItem;
_listpanel.Children.Add(add);
contentpanel.Children.Add(_listpanel);
}
}
示例2: DocUITabbed
public DocUITabbed(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm)
: base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
{
this.Sideways = true;
_tabControl = new TabControl();
this.Control = _tabControl;
_optlist = new List<AbstractDocUIComponent>();
XmlSchemaElement schemaEl = xsdNode as XmlSchemaElement;
if (schemaEl != null)
{
XmlSchemaSequence seq = XmlSchemaUtilities.tryGetSequence(schemaEl.ElementSchemaType);
if (seq != null)
{
foreach (XmlSchemaElement el in seq.Items)
{
TabItem ti = new TabItem();
ti.Header = XmlSchemaUtilities.tryGetDocumentation(el); ;
Grid newpanel = new Grid();
ColumnDefinition cdnew1 = new ColumnDefinition();
cdnew1.Width = new GridLength(1, GridUnitType.Auto);
ColumnDefinition cdnew2 = new ColumnDefinition();
newpanel.ColumnDefinitions.Add(cdnew1);
newpanel.ColumnDefinitions.Add(cdnew2);
Utilities.recursive(el, xmlNode.SelectSingleNode(el.Name), newpanel, overlaypanel, (comp) =>
{
_optlist.Add(comp);
comp.placeOption();
}, parentForm);
ti.Content = newpanel;
this._tabControl.Items.Add(ti);
}
}
}
}
示例3: DocUICombo
/// <summary>
/// Creates a new instance of the comboOption
/// </summary>
/// <param name="xmlNode">The xmlNode containing the data (selected value) of the comboOption</param>
/// <param name="xsdNode">The corresponding xsdNode</param>
/// <param name="panel">The panel on which the option should be placed</param>
/// <param name="parentForm">The form of which this option is a part.</param>
public DocUICombo(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm)
: base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
{
XmlSchemaElement schemaEl = xsdNode as XmlSchemaElement;
if (schemaEl != null)
{
cb = new ComboBox() { Margin = new Thickness(5) };
cb.SelectionChanged += (s, e) => { hasPendingChanges(); };
cb.VerticalContentAlignment = System.Windows.VerticalAlignment.Center;
// get enumeration
IEnumerable<XmlSchemaEnumerationFacet> enumFacets = XmlSchemaUtilities.tryGetEnumRestrictions(schemaEl.ElementSchemaType);
if (enumFacets != null)
{
foreach (var facet in enumFacets)
{
// fill the combobox
cb.Items.Add(facet.Value);
}
cb.SelectedIndex = 0;
}
else
{
Log.Info("This combobox has no enumeration restriction. The Combobox will be empty.");
}
Control = cb;
cb.Padding = new Thickness(10, 2, 10, 2);
setup();
}
}
示例4: DocUIMultiSelect
/// <summary>
/// Creates a new instance of MultiSelectOption
/// </summary>
/// <param name="xmlNode">The xmlNode that contains the data.</param>
/// <param name="xsdNode">The corresponding xsdNode.</param>
/// <param name="panel">The panel on which the option should be placed.</param>
/// <param name="parentForm">The form of which this option is a part.</param>
public DocUIMultiSelect(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm) :
base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
{
XmlSchemaElement schemaEl = xsdNode as XmlSchemaElement;
if (schemaEl != null)
{
XmlSchemaSequence seq = XmlSchemaUtilities.tryGetSequence(schemaEl.ElementSchemaType);
if (seq != null && seq.Items.Count > 0)
{
XmlSchemaElement el = seq.Items[0] as XmlSchemaElement;
IEnumerable<XmlSchemaEnumerationFacet> restrictions = XmlSchemaUtilities.tryGetEnumRestrictions(el.ElementSchemaType);
foreach (XmlSchemaEnumerationFacet e in restrictions)
{
AddOption(e.Value, FontWeights.Normal);
}
}
CheckBox all = AddOption("All", FontWeights.Bold);
all.Checked += (s, e) => { SelectAll(); };
all.Unchecked += (s, e) => { UnselectAll(); };
_wrapPanel.Orientation = Orientation.Horizontal;
Control = _wrapPanel;
setup();
}
}
示例5: DocUITime
/// <summary>
/// Creates a new instance of the TimeOption
/// </summary>
/// <param name="xmlNode">The xmlnode containing the data.</param>
/// <param name="xsdNode">The corresponding xsdnode.</param>
/// <param name="panel">The panel on which this option should be placed.</param>
/// <param name="parentForm">The form of which this option is a part.</param>
public DocUITime(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm) :
base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
{
Control = new TimePicker() { Format = TimeFormat.Custom, FormatString = "HH:mm:ss" };
(Control as TimePicker).ValueChanged += (s, e) => { hasPendingChanges(); };
setup();
}
示例6: DocUIBoolean
public DocUIBoolean(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm)
: base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
{
Control = new CheckBox();
(Control as CheckBox).Click += (s, e) => { hasPendingChanges(); };
setup();
}
示例7: DocUISubSection
/// <summary>
/// Creates a new instance of the SubSectionOption
/// </summary>
/// <param name="xmlNode">The xmlnode containing the data.</param>
/// <param name="xsdNode">The corresponding xsdNode.</param>
/// <param name="panel">The panel on which this option should be placed.</param>
/// <param name="parentForm">The form of which this option is a part.</param>
public DocUISubSection(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm) :
base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
{
XmlSchemaElement schemaEl = xsdNode as XmlSchemaElement;
if (schemaEl != null)
{
optionlist = new List<AbstractDocUIComponent>();
box = new GroupBox();
DockPanel panel = new DockPanel();
Grid g = new Grid() { Margin = new Thickness(5, 0, 0, 0) };
g.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) });
g.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
XmlSchemaSequence seq = XmlSchemaUtilities.tryGetSequence(schemaEl.ElementSchemaType);
if (seq != null)
{
foreach (XmlSchemaElement el in seq.Items)
Utilities.recursive(el, xmlNode.SelectSingleNode(el.Name), g, overlaypanel, (comp) =>
{
comp.placeOption();
optionlist.Add(comp);
}, parentForm);
}
if (xmlNode.Attributes["checked"] != null)
{
check = new CheckBox() { Margin = new Thickness(5, 5, 0, 5) };
check.Checked += check_changed;
check.Checked += (s, e) => { hasPendingChanges(); };
check.Unchecked += check_changed;
check.Unchecked += (s, e) => { hasPendingChanges(); };
panel.Children.Add(check);
}
// if there is no label, there should be no groupbox.
if (Label.Text != "")
{
panel.Children.Add(Label);
box.Header = panel;
box.Content = g;
Control = box;
}
else
{
panel.Children.Add(g);
//Control = g;
Control = panel;
}
setup();
}
}
示例8: DocUIGUID
public DocUIGUID(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm) :
base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
{
Label l = new Label();
this.Control = l;
//check if node contains default value
if (xmlNode.InnerText == "")
{
xmlNode.InnerText = Guid.NewGuid().ToString();
//save the key
//parentForm.saveFile(this, null);
}
l.Content = xmlNode.InnerText;
}
示例9: DocUIString
/// <summary>
/// Creates a new incstance of the StringOption.
/// </summary>
/// <param name="xmlNode">The xmlnode containing the data.</param>
/// <param name="xsdNode">The corresponding xsdNode.</param>
/// <param name="panel">The panel on which this option should be placed.</param>
/// <param name="parentForm">The form of which this option is a part.</param>
/// <param name="metaname">Whether this option can be filled with metadata. And if so, whether it will get the name or the value of the metadata.</param>
public DocUIString(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm) :
base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
{
string regex = XmlSchemaUtilities.tryGetPatternRestriction(xsdNode);
if (regex == null) { regex = ""; }
string watermark = XmlSchemaUtilities.tryGetUnhandledAttribute(xsdNode, "watermark");
string req = XmlSchemaUtilities.tryGetUnhandledAttribute(xsdNode, "required");
bool required = req == "true" ? true : false;
Control = new ExtendedTextBox("", watermark, regex, required, parentForm);
(Control as ExtendedTextBox).TextBlock.TextChanged += (s, e) => { hasPendingChanges(); };
Setup();
}
示例10: DocUIDateTime
/// <summary>
/// Creates a new instance of the TimeOption
/// </summary>
/// <param name="xmlNode">The xmlnode containing the data.</param>
/// <param name="xsdNode">The corresponding xsdnode.</param>
/// <param name="contentpanel">The panel on which this option should be placed.</param>
/// <param name="parentForm">The form of which this option is a part.</param>
public DocUIDateTime(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm) :
base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
{
//Control = new DatePicker(); //{ Form Format = TimeFormat.Custom, FormatString = "HH:mm:ss" };
//(Control as DatePicker).ValueChanged += (s, e) => { hasPendingChanges(); };
stack = new StackPanel() { Orientation = Orientation.Horizontal };
Control = stack;
DateControl = new DatePicker();
DateControl.SelectedDateChanged += (s, e) => { hasPendingChanges(); };
TimeControl = new TimePicker() { Format = TimeFormat.Custom, FormatString = "HH:mm:ss" };
TimeControl.ValueChanged += (s, e) => { hasPendingChanges(); };
setup();
}
示例11: Visit
protected virtual void Visit(XmlSchemaAnnotated annotated)
{
XmlSchemaAnyAttribute anyAttribute;
XmlSchemaAttribute attribute;
XmlSchemaAttributeGroup attributeGroup;
XmlSchemaAttributeGroupRef attributeGroupRef;
XmlSchemaContent content;
XmlSchemaContentModel contentModel;
XmlSchemaFacet facet;
XmlSchemaGroup group;
XmlSchemaIdentityConstraint constraint;
XmlSchemaNotation notation;
XmlSchemaParticle particle;
XmlSchemaSimpleTypeContent schemaSimpleTypeContent;
XmlSchemaType type;
XmlSchemaXPath xPath;
if (Casting.TryCast(annotated, out anyAttribute))
Visit(anyAttribute);
else if (Casting.TryCast(annotated, out attribute))
Visit(attribute);
else if (Casting.TryCast(annotated, out attributeGroup))
Visit(attributeGroup);
else if (Casting.TryCast(annotated, out attributeGroupRef))
Visit(attributeGroupRef);
else if (Casting.TryCast(annotated, out content))
Visit(content);
else if (Casting.TryCast(annotated, out contentModel))
Visit(contentModel);
else if (Casting.TryCast(annotated, out facet))
Visit(facet);
else if (Casting.TryCast(annotated, out group))
Visit(group);
else if (Casting.TryCast(annotated, out constraint))
Visit(constraint);
else if (Casting.TryCast(annotated, out notation))
Visit(notation);
else if (Casting.TryCast(annotated, out particle))
Visit(particle);
else if (Casting.TryCast(annotated, out schemaSimpleTypeContent))
Visit(schemaSimpleTypeContent);
else if (Casting.TryCast(annotated, out type))
Visit(type);
else if (Casting.TryCast(annotated, out xPath))
Visit(xPath);
else
throw ExceptionBuilder.UnexpectedSchemaObjectType(annotated);
}
示例12: DocUIPassword
/// <summary>
/// Creates a new instance of the passwordOption
/// </summary>
/// <param name="xmlNode">The xmlNode that contains the data.</param>
/// <param name="xsdNode">The corresponding xsdNode.</param>
/// <param name="panel">The panel on which this option should be placed.</param>
/// <param name="parentForm">The form of which this option is a part.</param>
public DocUIPassword(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm) :
base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
{
PasswordBox pw = new PasswordBox() { PasswordChar = '*' };
string req = XmlSchemaUtilities.tryGetUnhandledAttribute(xsdNode, "required");
required = req == "true" ? true : false;
pw.PasswordChanged += (s, e) =>
{
pw.Background = required && pw.Password == "" ? ExtendedTextBox.IncorrectColor : ExtendedTextBox.CorrectColor;
hasPendingChanges();
};
Control = pw;
setup();
}
示例13: DocUIBigTextBox
/// <summary>
/// Creates a new instance of the BigTextOption
/// </summary>
/// <param name="xmlNode">The node containing the data for the textbox</param>
/// <param name="xsdNode">The corresponding xsdNode</param>
/// <param name="panel">the panel on which this option should be placed</param>
/// <param name="parentForm">the form of which this option is a part</param>
public DocUIBigTextBox(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm)
: base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
{
ScrollViewer scroll = new ScrollViewer();
string req = XmlSchemaUtilities.tryGetUnhandledAttribute(xsdNode, "required");
bool required = req == "true" ? true : false;
box = new ExtendedTextBox("", "", "", required, parentForm);
box.TextBlock.AcceptsReturn = true;
box.TextBlock.TextWrapping = TextWrapping.Wrap;
box.Height = 200;
scroll.Content = box;
Control = scroll;
setup();
}
示例14: DocUIInteger
/// <summary>
/// Creates a new instance of the IntegerOption
/// </summary>
/// <param name="xmlNode">The node that contains the data for the integerOption</param>
/// <param name="xsdNode">The corresponding xsdNode.</param>
/// <param name="panel">The panel in which this option should be placed.</param>
/// <param name="parentForm">The form of which this option is a part.</param>
public DocUIInteger(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm) :
base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
{
int maxIncl = XmlSchemaUtilities.tryGetMaxIncl(xsdNode);
int minIncl = XmlSchemaUtilities.tryGetMinIncl(xsdNode);
_defaultValue = minIncl;
Control = new DoubleUpDown()
{
ShowButtonSpinner = true,
AllowSpin = true,
MouseWheelActiveTrigger = MouseWheelActiveTrigger.MouseOver,
Increment = 1,
ClipValueToMinMax = true,
Minimum = minIncl,
Maximum = maxIncl
};
(Control as DoubleUpDown).ValueChanged += (s, e) => { hasPendingChanges(); };
setup();
}
示例15: DocUIRadioSelect
/// <summary>
/// Creates a new instance of the RadioSelector
/// </summary>
/// <param name="xmlNode">The xmlNode containing the data.</param>
/// <param name="xsdNode">The corresponding xsdNode.</param>
/// <param name="panel">The panel on which this option should be placed.</param>
/// <param name="parentForm">The form of which this option is a part.</param>
public DocUIRadioSelect(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm) :
base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
{
XmlSchemaElement schemaEl = xsdNode as XmlSchemaElement;
if (schemaEl != null)
{
g.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) });
g.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) });
g.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
g.HorizontalAlignment = HorizontalAlignment.Stretch;
Control = g;
XmlSchemaSequence seq = XmlSchemaUtilities.tryGetSequence(schemaEl.ElementSchemaType);
if (seq != null)
foreach (XmlSchemaElement el in seq.Items)
Utilities.recursive(el, xmlNode.SelectSingleNode(el.Name), contentpanel, overlaypanel, addOption, parentForm);
else
Log.Info("this comboselector does not contain any options.");
setup();
}
}