public SwButtonListener(View button_in, ControlId id_in, bool vibrate_enable_in) { Log.Info(TAG, "SwButtonListener - key"); button = button_in; id = id_in; dispatcher = MessageDispatcher.GetInstance(); vibrate_enabled = vibrate_enable_in; }
void IView.WriteControl(ControlId ctrl, string value) { var obj = GetCtrl(ctrl); if (obj != null) { obj.Text = value; } }
void IView.SetControlVisibility(ControlId ctrl, bool value) { var obj = GetCtrl(ctrl); if (obj != null) { obj.Visible = value; } }
void IView.EnableControl(ControlId ctrl, bool enable) { var c = GetControl(ctrl); if (c is NSTextField) { ((NSTextField)c).Enabled = enable; } }
void IView.ResetSelection(ControlId ctrl) { var tv = (GetControl(ctrl) as NSTextView); if (tv != null) { tv.SelectedRange = new NSRange(); } }
private string getUniqueId() { int from = ControlId.IndexOf("_ctl") + "_ctl".Length; int to = ControlId.LastIndexOf("_"); string index = ControlId.Substring(from, to - from); string uniqueId = "ctl" + index; return(uniqueId); }
void IView.EnableControl(ControlId ctrl, bool enable) { var obj = GetCtrl(ctrl); if (obj != null) { obj.Enabled = enable; } }
void IView.SetLabelProps(ControlId labelId, string text, Color?color) { var ctrl = GetCtrl(labelId); ctrl.Text = text; if (color != null) { ctrl.ForeColor = color.Value.ToSystemDrawingObject(); } }
void IView.SetControlOptions(ControlId id, string [] options) { var cb = (NSComboBox)GetControl(id); cb.RemoveAll(); foreach (var opt in options) { cb.Add(new NSString(opt)); } }
void IView.SetLabelProps(ControlId labelId, string text, ModelColor?color) { var ctrl = GetCtrl(labelId); ctrl.Text = text; if (color != null) { ctrl.ForeColor = color.Value.ToColor(); } }
public VJoyButtonControl(ControlInfo controlInfo, ControlId controlId, Expression <FieldSelector <uint> > selector, int bit) : base(controlInfo, controlId) { Guard.NotNull(selector, nameof(selector)); _getValueDelegate = MakeGetValueDelegate(selector); _setValueDelegate = MakeSetValueDelegate(selector); _setBitMask = (uint)1 << bit; _unsetBitMask = ~_setBitMask; }
void IView.SetLabelProps(ControlId labelId, string text, ModelColor color) { var ctrl = GetControl(labelId); if (ctrl == null) { return; } ctrl.StringValue = text; ctrl.TextColor = color.ToColor().ToNSColor(); }
void IView.SetControlOptions(ControlId id, string[] options) { var cb = GetControl(id) as ComboBox; if (cb == null) { return; } cb.Items.Clear(); cb.Items.AddRange(options); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Returns HashCode</returns> public override int GetHashCode() { return(String.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|", this.ControlProperties.Aggregate(0, (acc, next) => acc += next.GetHashCode()), Type.GetHashCode(), CustomWebPartName?.GetHashCode() ?? 0, JsonControlData?.GetHashCode() ?? 0, ControlId.GetHashCode(), Order.GetHashCode(), Column.GetHashCode() ).GetHashCode()); }
void IView.ModifyControl(ControlId id, string text, bool?enabled) { var ctrl = GetControl(id); if (text != null) { ctrl.Text = StringUtils.NormalizeLinebreakes(text); } if (enabled != null) { ctrl.Enabled = enabled.Value; } }
void IView.SetControlVisibility(ControlId ctrl, bool value) { var v = GetControl(ctrl) as NSView; if (ctrl == ControlId.EmptyReLabel) { v = emptyReContainer; } if (v != null) { v.Hidden = !value; } }
void IView.SetLabelProps(ControlId labelId, string text, Color?color) { var ctrl = GetControl(labelId); if (ctrl == null) { return; } ctrl.StringValue = text; if (color != null) { ctrl.TextColor = color.Value.ToNSColor(); } }
Control GetCtrl(ControlId ctrl) { switch (ctrl) { case ControlId.HeaderLabel: return(headerLabel); case ControlId.CompanyNameEdit: return(companyNameTextBox); case ControlId.FormatNameEdit: return(formatNameTextBox); case ControlId.DescriptionEdit: return(descriptionTextBox); default: return(null); } }
Control GetCtrl(ControlId id) { switch (id) { case ControlId.HeaderReStatusLabel: return(headerReStatusLabel); case ControlId.XsltStatusLabel: return(xsltStatusLabel); case ControlId.TestStatusLabel: return(testStatusLabel); case ControlId.SampleLogStatusLabel: return(sampleLogStatusLabel); default: return(null); } }
string IView.this[ControlId id] { get { return(GetCtrl(id)?.Text ?? ""); } set { var ctrl = GetCtrl(id); if (ctrl != null) { ctrl.Text = value; } } }
NSTextField GetControl(ControlId id) { View.EnsureCreated(); switch (id) { case ControlId.HeaderReStatusLabel: return(headerReStatusLabel); case ControlId.XsltStatusLabel: return(xsltStatusLabel); case ControlId.TestStatusLabel: return(testStatusLabel); case ControlId.SampleLogStatusLabel: return(sampleLogStatusLabel); default: return(null); } }
private void SetInputBackground(View vin, ControlId id) { Log.Debug(TAG, "SetInputBackground"); if (id == selected_control) { vin.SetBackgroundColor(Android.Graphics.Color.SkyBlue); } else if (SwSettings.GetControlMotion(id).type == MotionType.Invalid) { vin.SetBackgroundColor(Android.Graphics.Color.Red); } else { vin.SetBackgroundColor(Android.Graphics.Color.Transparent); } }
NSTextField GetControl(ControlId id) { switch (id) { case ControlId.HeaderReStatusLabel: return(headerReStatusLabel); case ControlId.BodyReStatusLabel: return(bodyReStatusLabel); case ControlId.FieldsMappingLabel: return(fieldsMappingLabel); case ControlId.TestStatusLabel: return(testStatusLabel); case ControlId.SampleLogStatusLabel: return(sampleLogStatusLabel); default: return(null); } }
void IView.WriteControl(ControlId ctrl, string value) { var c = GetControl(ctrl); if (c is NSTextField) { ((NSTextField)c).StringValue = value; } else if (c is NSTextView) { ((NSTextView)c).Value = value; } else if (c is NSWindow) { ((NSWindow)c).Title = value; } }
Control GetControl(ControlId ctrl) { switch (ctrl) { case ControlId.RemoveFieldButton: return(removeFieldButton); case ControlId.NameComboBox: return(nameComboBox); case ControlId.CodeTypeComboBox: return(codeTypeComboBox); case ControlId.CodeTextBox: return(codeTextBox); case ControlId.AvailableInputFieldsContainer: return(availableInputFieldsPanel); default: return(null); } }
string IView.ReadControl(ControlId id) { var obj = GetControl(id); if (obj is NSTextView) { return(((NSTextView)obj).Value); } else if (obj is NSButton) { return(((NSButton)obj).StringValue); } else if (obj is NSComboBox) { return(((NSComboBox)obj).StringValue); } return(null); }
object IView.ReadControlValue(ControlId id) { switch (id) { case ControlId.IndependentLogsModeButton: return(independentLogsModeButton.State == NSCellStateValue.On); case ControlId.RotatedLogModeButton: return(rotatedLogModeButton.State == NSCellStateValue.On); case ControlId.FileSelector: return(fileTextField.StringValue); case ControlId.FolderSelector: return(folderTextField.StringValue); } return(null); }
object IView.ReadControlValue(ControlId id) { switch (id) { case ControlId.IndependentLogsModeButton: return(independentLogModeRadioButton.Checked); case ControlId.RotatedLogModeButton: return(rotatedLogModeRadioButton.Checked); case ControlId.FileSelector: return(filePathTextBox.Text); case ControlId.FolderSelector: return(folderPartTextBox.Text); } return(null); }
void IView.WriteControlValue(ControlId id, object value) { switch (id) { case ControlId.IndependentLogsModeButton: independentLogsModeButton.State = ((bool)value) ? NSCellStateValue.On : NSCellStateValue.Off; break; case ControlId.RotatedLogModeButton: rotatedLogModeButton.State = ((bool)value) ? NSCellStateValue.On : NSCellStateValue.Off; break; case ControlId.FileSelector: fileTextField.StringValue = (string)value; break; case ControlId.FolderSelector: folderTextField.StringValue = (string)value; break; } }
void IView.WriteControlValue(ControlId id, object value) { switch (id) { case ControlId.IndependentLogsModeButton: independentLogModeRadioButton.Checked = (bool)value; break; case ControlId.RotatedLogModeButton: rotatedLogModeRadioButton.Checked = (bool)value; break; case ControlId.FileSelector: filePathTextBox.Text = (string)value; break; case ControlId.FolderSelector: folderPartTextBox.Text = (string)value; break; } }