本文整理汇总了C#中ElementState类的典型用法代码示例。如果您正苦于以下问题:C# ElementState类的具体用法?C# ElementState怎么用?C# ElementState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ElementState类属于命名空间,在下文中一共展示了ElementState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MarkElement_SettingFirstValue_StateReturnThatValue
public void MarkElement_SettingFirstValue_StateReturnThatValue(ElementState startingState)
{
// Setup
var element = new GameBoardElement(0, 0);
// Call
element.MarkElement(startingState);
// Assert
Assert.AreEqual(startingState, element.State);
}
示例2: PaintCheckBox
public void PaintCheckBox (Graphics g, Rectangle bounds, Color backColor, Color foreColor, ElementState state, FlatStyle style, CheckState checkState)
{
switch (style) {
case FlatStyle.Standard:
case FlatStyle.System:
switch (state) {
case ElementState.Normal:
DrawNormalCheckBox (g, bounds, backColor, foreColor, checkState);
break;
case ElementState.Hot:
DrawHotCheckBox (g, bounds, backColor, foreColor, checkState);
break;
case ElementState.Pressed:
DrawPressedCheckBox (g, bounds, backColor, foreColor, checkState);
break;
case ElementState.Disabled:
DrawDisabledCheckBox (g, bounds, backColor, foreColor, checkState);
break;
}
break;
case FlatStyle.Flat:
switch (state) {
case ElementState.Normal:
DrawFlatNormalCheckBox (g, bounds, backColor, foreColor, checkState);
break;
case ElementState.Hot:
DrawFlatHotCheckBox (g, bounds, backColor, foreColor, checkState);
break;
case ElementState.Pressed:
DrawFlatPressedCheckBox (g, bounds, backColor, foreColor, checkState);
break;
case ElementState.Disabled:
DrawFlatDisabledCheckBox (g, bounds, backColor, foreColor, checkState);
break;
}
break;
case FlatStyle.Popup:
switch (state) {
case ElementState.Normal:
DrawPopupNormalCheckBox (g, bounds, backColor, foreColor, checkState);
break;
case ElementState.Hot:
DrawPopupHotCheckBox (g, bounds, backColor, foreColor, checkState);
break;
case ElementState.Pressed:
DrawPopupPressedCheckBox (g, bounds, backColor, foreColor, checkState);
break;
case ElementState.Disabled:
DrawPopupDisabledCheckBox (g, bounds, backColor, foreColor, checkState);
break;
}
break;
}
}
示例3: SetUnFocus
public void SetUnFocus()
{
if (this.state != ElementState.UnFocus)
{
HotspotLeft.Visibility = Visibility.Collapsed;
HotspotTop.Visibility = Visibility.Collapsed;
HotspotRight.Visibility = Visibility.Collapsed;
HotspotBottom.Visibility = Visibility.Collapsed;
this.state = ElementState.UnFocus;
}
}
示例4: PaintRadioButton
public void PaintRadioButton (Graphics g, Rectangle bounds, Color backColor, Color foreColor, ElementState state, FlatStyle style, bool isChecked)
{
switch (style) {
case FlatStyle.Standard:
case FlatStyle.System:
switch (state) {
case ElementState.Normal:
DrawNormalRadioButton (g, bounds, backColor, foreColor, isChecked);
break;
case ElementState.Hot:
DrawHotRadioButton (g, bounds, backColor, foreColor, isChecked);
break;
case ElementState.Pressed:
DrawPressedRadioButton (g, bounds, backColor, foreColor, isChecked);
break;
case ElementState.Disabled:
DrawDisabledRadioButton (g, bounds, backColor, foreColor, isChecked);
break;
}
break;
case FlatStyle.Flat:
switch (state) {
case ElementState.Normal:
DrawFlatNormalRadioButton (g, bounds, backColor, foreColor, isChecked);
break;
case ElementState.Hot:
DrawFlatHotRadioButton (g, bounds, backColor, foreColor, isChecked);
break;
case ElementState.Pressed:
DrawFlatPressedRadioButton (g, bounds, backColor, foreColor, isChecked);
break;
case ElementState.Disabled:
DrawFlatDisabledRadioButton (g, bounds, backColor, foreColor, isChecked);
break;
}
break;
case FlatStyle.Popup:
switch (state) {
case ElementState.Normal:
DrawPopupNormalRadioButton (g, bounds, backColor, foreColor, isChecked);
break;
case ElementState.Hot:
DrawPopupHotRadioButton (g, bounds, backColor, foreColor, isChecked);
break;
case ElementState.Pressed:
DrawPopupPressedRadioButton (g, bounds, backColor, foreColor, isChecked);
break;
case ElementState.Disabled:
DrawPopupDisabledRadioButton (g, bounds, backColor, foreColor, isChecked);
break;
}
break;
}
}
示例5: SetFocus
public void SetFocus()
{
if (this.state != ElementState.Focus)
{
SetHotspotStyle(Colors.Blue, 1.0);
HotspotLeft.Visibility = Visibility.Visible;
HotspotTop.Visibility = Visibility.Visible;
HotspotRight.Visibility = Visibility.Visible;
HotspotBottom.Visibility = Visibility.Visible;
this.state = ElementState.Focus;
}
}
示例6: MarkElement_FromYesToAnyNotStates_StateReturnsNewNotState
public void MarkElement_FromYesToAnyNotStates_StateReturnsNewNotState(ElementState newNotState)
{
// Setup
var element = new GameBoardElement(0, 0);
element.MarkElement(ElementState.Yes);
// Call
element.MarkElement(newNotState);
// Assert
Assert.AreEqual(newNotState, element.State);
}
示例7: MarkElement_FromAnyStateToEmpty_StateReturnsEmpty
public void MarkElement_FromAnyStateToEmpty_StateReturnsEmpty(ElementState startingState)
{
// Setup
var element = new GameBoardElement(0, 0);
element.MarkElement(startingState);
// Call
element.MarkElement(ElementState.Empty);
// Assert
Assert.AreEqual(ElementState.Empty, element.State);
}
示例8: SetSelected
public void SetSelected()
{
if (this.state != ElementState.Selected)
{
SetHotspotStyle(Colors.Red, 0.5);
HotspotLeft.Visibility = Visibility.Visible;
HotspotTop.Visibility = Visibility.Visible;
HotspotRight.Visibility = Visibility.Visible;
HotspotBottom.Visibility = Visibility.Visible;
this.state = ElementState.Selected;
}
}
示例9: DrawArrow
/// <summary>
///
/// </summary>
/// <param name="gr"></param>
/// <param name="rect"></param>
/// <param name="d"></param>
/// <param name="state"></param>
protected override void DrawArrow(Graphics gr, Rectangle rect, Direction d, ElementState state)
{
if (ThemeFactory.VisualStylesEnabled && ThemeFactory.VisualStylesSupported)
{
ThemeFactory.DrawScrollBar(gr, rect, GetArrowScrollBarStates(d, state), ScrollBarParts.ArrowBtn);
}
else
{
ScrollButton sb = DirectionToScrollButton(d);
ButtonState bs = ElementStateToButtonState(state);
ControlPaint.DrawScrollButton(gr, rect, sb, bs);
}
}
示例10: DeserializeCore
protected override void DeserializeCore(XmlElement element, SaveContext context)
{
XmlElementHelper helper = new XmlElementHelper(element);
this.GUID = helper.ReadGuid("guid", Guid.NewGuid());
// Resolve node nick name.
string nickName = helper.ReadString("nickname", string.Empty);
if (!string.IsNullOrEmpty(nickName))
this.nickName = nickName;
else
{
System.Type type = this.GetType();
var attribs = type.GetCustomAttributes(typeof(NodeNameAttribute), true);
NodeNameAttribute attrib = attribs[0] as NodeNameAttribute;
if (null != attrib)
this.nickName = attrib.Name;
}
this.X = helper.ReadDouble("x", 0.0);
this.Y = helper.ReadDouble("y", 0.0);
this.isVisible = helper.ReadBoolean("isVisible", true);
this.isUpstreamVisible = helper.ReadBoolean("isUpstreamVisible", true);
this.argumentLacing = helper.ReadEnum("lacing", LacingStrategy.Disabled);
if (context == SaveContext.Undo)
{
// Fix: MAGN-159 (nodes are not editable after undo/redo).
interactionEnabled = helper.ReadBoolean("interactionEnabled", true);
this.state = helper.ReadEnum("nodeState", ElementState.ACTIVE);
// We only notify property changes in an undo/redo operation. Normal
// operations like file loading or copy-paste have the models created
// in different ways and their views will always be up-to-date with
// respect to their models.
RaisePropertyChanged("InteractionEnabled");
RaisePropertyChanged("State");
RaisePropertyChanged("NickName");
RaisePropertyChanged("ArgumentLacing");
RaisePropertyChanged("IsVisible");
RaisePropertyChanged("IsUpstreamVisible");
// Notify listeners that the position of the node has changed,
// then all connected connectors will also redraw themselves.
this.ReportPosition();
}
}
示例11: SetSelected
public void SetSelected()
{
if (this._State != ElementState.Selected)
{
SetHotspotStyle(Colors.Red, 1.0);
ellipseBegin.Visibility = Visibility.Visible;
rectangleCenter.Visibility = Visibility.Visible;
ellipseEnd.Visibility = Visibility.Visible;
this._State = ElementState.Selected;
}
}
示例12: SetFocus
public void SetFocus()
{
if (this._State != ElementState.Focus)
{
SetHotspotStyle(Colors.Yellow, 1.0);
ellipseBegin.Visibility = Visibility.Visible;
rectangleCenter.Visibility = Visibility.Visible;
ellipseEnd.Visibility = Visibility.Visible;
//直线状态不显示中间点
//if (IsStraightLine() == true) rectangleCenter.Visibility = Visibility.Collapsed;
this._State = ElementState.Focus;
}
}
示例13: ReadRoot
private bool ReadRoot()
{
this._elementStack.Push(this._rootElement);
if (this._rootElement is OpenXmlMiscNode)
{
this._elementState = ElementState.MiscNode;
}
else
{
this._elementState = ElementState.Start;
}
return true;
}
示例14: Close
/// <summary>
/// Closes the reader.
/// </summary>
public override void Close()
{
ThrowIfObjectDisposed();
this._elementState = ElementState.EOF;
this._elementStack.Clear();
this._rootElement = null;
}
示例15: MoveToNextSibling
/// <summary>
/// Move to next sibling element
/// </summary>
/// <returns>true if the next sibling element was read successfully; false if there are no more sibling elements to read. </returns>
/// <remarks>Current will move to the end tag of the parent if no more sibling element.</remarks>
private bool MoveToNextSibling()
{
if (this._elementState == ElementState.EOF)
{
return false;
}
ThrowIfNull();
if (this._elementStack.Count == 0)
{
this._elementState = ElementState.EOF;
return false;
}
OpenXmlElement element = this._elementStack.Pop();
// Fix bug #253890, case: the element used to constructor this DOM reader is not root element ( aka. it has parents and siblings. )
// the stack is empty means we should move to EOF.
if (this._elementStack.Count == 0)
{
this._elementState = ElementState.EOF;
return false;
}
element = element.NextSibling();
if (element != null)
{
this._elementStack.Push(element);
if (element is OpenXmlMiscNode)
{
this._elementState = ElementState.MiscNode;
}
else
{
this._elementState = ElementState.Start;
}
return true;
}
else
{
if (this._elementStack.Count > 0)
{
this._elementState = ElementState.End;
}
else
{
// no more element, EOF
this._elementState = ElementState.EOF;
}
return false;
}
}