public ScrollBar(System.Windows.Controls.Orientation orientation, int size) { _initialized = true; _barOrientation = orientation; if (size <= 2) size = 4; _sliderCharacter = 219; if (orientation == System.Windows.Controls.Orientation.Horizontal) { _sliderBarCharacter = 176; _topOrLeftCharacter = 17; _bottomOrRightCharacter = 16; Resize(size, 1); } else { _sliderBarCharacter = 176; _topOrLeftCharacter = 30; _bottomOrRightCharacter = 31; Resize(1, size); } }
private ScrollBar(System.Windows.Controls.Orientation orientation, int width, int height) : base(width, height) { _initialized = true; _barOrientation = orientation; _sliderCharacter = 219; if (orientation == System.Windows.Controls.Orientation.Horizontal) { _sliderBarCharacter = 176; _topOrLeftCharacter = 17; _bottomOrRightCharacter = 16; } else { _sliderBarCharacter = 176; _topOrLeftCharacter = 30; _bottomOrRightCharacter = 31; } if (width > height) { _sliderBarSize = width - 2; } else { _sliderBarSize = height - 2; } _sliderPositionValues = new int[_sliderBarSize]; DetermineSliderPositions(); }
public ScrollBar(System.Windows.Controls.Orientation orientation, int size) { _initialized = true; _barOrientation = orientation; if (size <= 2) { size = 4; } _sliderCharacter = 219; if (orientation == System.Windows.Controls.Orientation.Horizontal) { _sliderBarCharacter = 176; _topOrLeftCharacter = 17; _bottomOrRightCharacter = 16; Resize(size, 1); } else { _sliderBarCharacter = 176; _topOrLeftCharacter = 30; _bottomOrRightCharacter = 31; Resize(1, size); } }
private ScrollBar(System.Windows.Controls.Orientation orientation, int width, int height) : base(width, height) { _initialized = true; _barOrientation = orientation; _sliderCharacter = 219; if (orientation == System.Windows.Controls.Orientation.Horizontal) { _sliderBarCharacter = 176; _topOrLeftCharacter = 17; _bottomOrRightCharacter = 16; } else { _sliderBarCharacter = 176; _topOrLeftCharacter = 30; _bottomOrRightCharacter = 31; } if (width > height) _sliderBarSize = width - 2; else _sliderBarSize = height - 2; _sliderPositionValues = new int[_sliderBarSize]; DetermineSliderPositions(); }
internal static bool IsValidOrientation(object o) { System.Windows.Controls.Orientation orientation = (System.Windows.Controls.Orientation)o; if (orientation != System.Windows.Controls.Orientation.Horizontal) { return(orientation == System.Windows.Controls.Orientation.Vertical); } return(true); }
public static ScrollBar Create(System.Windows.Controls.Orientation orientation, int size) { if (size <= 2) { throw new Exception("The scroll bar must be 4 or more in size."); } if (orientation == System.Windows.Controls.Orientation.Vertical) { return(new ScrollBar(orientation, 1, size)); } else { return(new ScrollBar(orientation, size, 1)); } }
/// <summary> /// Creates a new instance of a ship, which is not placed on the playground /// </summary> /// <param name="owner">The Jabber-ID of the owner</param> /// <param name="type">The type</param> public Ship(JID owner, ShipType type, Boolean alternate) { this.Owner = owner; this.IsPlaced = false; this.ShipType = type; this.HitPoints = new Dictionary<int, bool>(); this.OverlayColor = Color.White; this.IsDestroyed = false; switch (type) { case ShipType.DESTROYER: case ShipType.SUBMARINE: this.Orientation = System.Windows.Controls.Orientation.Vertical; break; case ShipType.BATTLESHIP: case ShipType.AIRCRAFT_CARRIER: this.Orientation = System.Windows.Controls.Orientation.Horizontal; break; } LoadTexture(); // Ship is not placed. We place it manually switch (type) { case ShipType.DESTROYER: this.Position = new Vector2(20, DeviceCache.BelowGrid + 20); break; case ShipType.SUBMARINE: if (alternate) this.Position = new Vector2(20 + (1 * (this.shipTexture.Width * scaleRate)) + 20, DeviceCache.BelowGrid + 20); else this.Position = new Vector2(20 + (5 * (this.shipTexture.Width * scaleRate)) + 20, DeviceCache.BelowGrid + 20); break; case ShipType.BATTLESHIP: this.Position = new Vector2(20 + (2 * (this.shipTexture.Height * scaleRate)) + 20, DeviceCache.BelowGrid + 20); break; case ShipType.AIRCRAFT_CARRIER: this.Position = new Vector2(20 + (2 * (this.shipTexture.Height * scaleRate)) + 20, DeviceCache.BelowGrid + (this.shipTexture.Height * scaleRate) + 30); break; } for (int i = 0; i < this.Size; i++) { this.HitPoints.Add(i, false); } }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { double ret = 0; double width = (double)values[0]; int count = (int)values[1]; System.Windows.Controls.Orientation orient = (System.Windows.Controls.Orientation)values[2]; if (orient == System.Windows.Controls.Orientation.Horizontal) { ret = Math.Floor(width / count); } else if (orient == System.Windows.Controls.Orientation.Vertical) { ret = width; } return(ret); }
private int Spacing(System.Windows.Controls.Orientation orientation) { StackLayout layout = _layout as StackLayout; int spacing = 0; if (null != layout) { if (orientation == System.Windows.Controls.Orientation.Vertical) { spacing = (int)System.Math.Truncate(layout.Spacing.Height); } else if (orientation == System.Windows.Controls.Orientation.Horizontal) { spacing = (int)System.Math.Truncate(layout.Spacing.Width); } } return(spacing); }
/// <summary> /// Creates a new instance of a ship /// </summary> /// <param name="owner">The Jabber-ID of the owner</param> /// <param name="type">The type</param> /// <param name="or">The orientation</param> /// <param name="targetField">The target field, where the ship is placed</param> public Ship(JID owner, ShipType type, System.Windows.Controls.Orientation or, Field targetField) { this.Owner = owner; this.ShipType = type; this.IsPlaced = false; this.HitPoints = new Dictionary<int, bool>(); this.Orientation = or; this.Position = targetField.Position; this.IsDestroyed = false; this.OverlayColor = Color.White; targetField.ReferencedShip = this; StartField = targetField; LoadTexture(); for (int i = 0; i < this.Size; i++) { this.HitPoints.Add(i, false); } }
public static Model.Scene2D.Orientation ToD2DOrientation(this System.Windows.Controls.Orientation o) { return(o == System.Windows.Controls.Orientation.Horizontal ? Model.Scene2D.Orientation.Horizontal : Model.Scene2D.Orientation.Vertical); }
/// <summary> /// Default cosntructor. /// </summary> /// <param name="orientation">Target UI orientation.</param> public OrientationAttribute(System.Windows.Controls.Orientation orientation) { Value = orientation; }
public MainContainerShapeBase() { this.ChildrenPositioning = System.Windows.Controls.Orientation.Vertical; DragDropManager.AddDragEnterHandler(this, this.OnDragEnterManager); this.collapsedItems = new List<IConnection>(); }
public static Orientation ToD2DOrientation(this System.Windows.Controls.Orientation o) { return(o == System.Windows.Controls.Orientation.Horizontal ? Orientation.Horizontal : Orientation.Vertical); }
/// <summary> /// Called when <see cref="Orientation"/> changed. /// </summary> /// <param name="oldValue">Old value of <see cref="Orientation"/>.</param> /// <param name="newValue">New value of <see cref="Orientation"/>.</param> protected virtual void OnOrientationChanged(Orientation oldValue, Orientation newValue) { orientationChanged = true; }
/// <summary> /// Toggles the orientation of the ship /// </summary> public void ToggleOrientation() { if (this.Orientation == System.Windows.Controls.Orientation.Horizontal) { this.Orientation = System.Windows.Controls.Orientation.Vertical; } else { this.Orientation = System.Windows.Controls.Orientation.Horizontal; } LoadTexture(); GlueToFields(); AppCache.CurrentMatch.OwnPlayground.Refresh(); }