private string BuildPositionalValue <TValueType>(ValuePosition position, TValueType value) { IValuePosition <TValueType> valuePosition; switch (position) { case ValuePosition.StartsWith: valuePosition = new StartsWithValue <TValueType>(); break; case ValuePosition.Contains: valuePosition = new ContainsValue <TValueType>(); break; case ValuePosition.EndsWith: valuePosition = new EndsWithValue <TValueType>(); break; default: valuePosition = new DefaultValue <TValueType>(); break; } return(valuePosition.BuildValue(value)); }
public void ValuePosition3() { var test = new ValuePosition('A'); test.Value = -2.345; test.FP = -1; Assert.AreEqual(test.ToString(), "A"); }
public TrackBarEx() { InitializeComponent(); valLabel = new Label(); valLabel.Dock = DockStyle.Fill; valLabel.TextAlign = ContentAlignment.MiddleCenter; Value = 0; MinValue = 0; MaxValue = 100; ValueLabel = ValuePosition.None; }
private void UpdateSize(ValuePosition NewVal) { if (ValueLabel != NewVal) { Control ctrl; if (ValueLabel != ValuePosition.None) { ctrl = GetControl(ValueLabel); ctrl.Controls.RemoveAt(0); ctrl.Size = new Size(0, 0); if (ValueLabel == ValuePosition.Top || ValueLabel == ValuePosition.Bottom) { this.Height -= ls; this.MinimumSize = new Size(116, this.Height); } else if (ValueLabel == ValuePosition.Left || ValueLabel == ValuePosition.Right) { this.Width -= ls; } else { this.Width -= ls; this.Height -= ls; this.MinimumSize = new Size(116, this.Height); } } if (NewVal != ValuePosition.None) { ctrl = GetControl(NewVal); ctrl.Size = new Size(ls, ls); ctrl.Controls.Add(valLabel); if (NewVal == ValuePosition.Top || NewVal == ValuePosition.Bottom) { this.Height += ls; this.MinimumSize = new Size(116, this.Height); } else if (NewVal == ValuePosition.Left || NewVal == ValuePosition.Right) { this.Width += ls; } else { this.Width += ls; this.Height += ls; this.MinimumSize = new Size(116, this.Height); } } valLabel.Text = Value.ToString(); } int w = 12; if (NewVal != ValuePosition.None && NewVal != ValuePosition.Bottom && NewVal != ValuePosition.Top) { w += ls; } ScrollPanel.Width = this.Width - w; }
public void ValuePosition1() { var test = new ValuePosition('A'); test.Value = 2.345; test.FP = 0; Assert.AreEqual(test.ToString(), "A2"); test.FP = 1; Assert.AreEqual(test.ToString(), "A2.3"); test.FP = 2; Assert.AreEqual(test.ToString(), "A2.35"); test.FP = 4; Assert.AreEqual(test.ToString(), "A2.3450"); }
private Control GetControl(ValuePosition Pos) { switch (Pos) { case ValuePosition.Bottom: return(MainLayout.GetControlFromPosition(1, 2)); case ValuePosition.Left: return(MainLayout.GetControlFromPosition(0, 1)); case ValuePosition.LeftBottom: return(MainLayout.GetControlFromPosition(0, 2)); case ValuePosition.LeftTop: return(MainLayout.GetControlFromPosition(0, 0)); case ValuePosition.Right: return(MainLayout.GetControlFromPosition(2, 1)); case ValuePosition.RightBottom: return(MainLayout.GetControlFromPosition(2, 2)); case ValuePosition.RightTop: return(MainLayout.GetControlFromPosition(2, 0)); case ValuePosition.Top: return(MainLayout.GetControlFromPosition(1, 0)); default: return(null); } }
private Control GetControl(ValuePosition Pos) { switch (Pos) { case ValuePosition.Bottom: return MainLayout.GetControlFromPosition(1, 2); case ValuePosition.Left: return MainLayout.GetControlFromPosition(0, 1); case ValuePosition.LeftBottom: return MainLayout.GetControlFromPosition(0, 2); case ValuePosition.LeftTop: return MainLayout.GetControlFromPosition(0, 0); case ValuePosition.Right: return MainLayout.GetControlFromPosition(2, 1); case ValuePosition.RightBottom: return MainLayout.GetControlFromPosition(2, 2); case ValuePosition.RightTop: return MainLayout.GetControlFromPosition(2, 0); case ValuePosition.Top: return MainLayout.GetControlFromPosition(1, 0); default: return null; } }
private void UpdateSize(ValuePosition NewVal) { if (ValueLabel != NewVal) { Control ctrl; if (ValueLabel != ValuePosition.None) { ctrl = GetControl(ValueLabel); ctrl.Controls.RemoveAt(0); ctrl.Size = new Size(0, 0); if (ValueLabel == ValuePosition.Top || ValueLabel == ValuePosition.Bottom) { this.Height -= ls; this.MinimumSize = new Size(116, this.Height); } else if (ValueLabel == ValuePosition.Left || ValueLabel == ValuePosition.Right) this.Width -= ls; else { this.Width -= ls; this.Height -= ls; this.MinimumSize = new Size(116, this.Height); } } if (NewVal != ValuePosition.None) { ctrl = GetControl(NewVal); ctrl.Size = new Size(ls, ls); ctrl.Controls.Add(valLabel); if (NewVal == ValuePosition.Top || NewVal == ValuePosition.Bottom) { this.Height += ls; this.MinimumSize = new Size(116, this.Height); } else if (NewVal == ValuePosition.Left || NewVal == ValuePosition.Right) this.Width += ls; else { this.Width += ls; this.Height += ls; this.MinimumSize = new Size(116, this.Height); } } valLabel.Text = Value.ToString(); } int w = 12; if (NewVal != ValuePosition.None && NewVal != ValuePosition.Bottom && NewVal != ValuePosition.Top) w += ls; ScrollPanel.Width = this.Width - w; }
public IQueryBuilder <T> AddCustomQuery <TV>(Expression <Func <T, TV> > expression, object value, ValuePosition valuePosition) { _dictionary.Add(Express.PropertyWithLambda(expression).Name, BuildPositionalValue(valuePosition, value)); return(this); }
public IQueryBuilder <T> AddCustomField <TV>(string field, TV value, ValuePosition valuePosition) { _dictionary.Add(CustomField.NormalizeName(field), BuildPositionalValue(valuePosition, value)); return(this); }
public IQueryBuilder <T> Add <TV>(Expression <Func <T, TV> > expression, TV value, ValuePosition valuePosition) { string name = Express.PropertyWithLambda(expression).Name; name = this.GetColumnName(name); _dictionary.Add(name, BuildPositionalValue(valuePosition, value)); return(this); }
/// <summary> /// ToString() /// </summary> /// <returns></returns> public override string ToString() => "[" + ActiveColumn.ToString() + ",V=" + ValuePosition.ToString() + ",A=" + AsciiPosition.ToString() + "]";
/// <summary> /// GetHashCode() /// </summary> /// <returns></returns> public override int GetHashCode() => (int)ActiveColumn ^ ValuePosition.GetHashCode() ^ AsciiPosition.GetHashCode();
/// <summary> /// Equals() /// </summary> /// <param name="other">Other instance</param> /// <returns></returns> public bool Equals(HexColumnPosition other) => ActiveColumn == other.ActiveColumn && ValuePosition.Equals(other.ValuePosition) && AsciiPosition.Equals(other.AsciiPosition);