public void InputEntry_Completed(object sender, EventArgs e) { if (viewModel.InputText.Length > 0 || App.InputEmptyAllowed) { if (!App.FinishInputSet) // Xamarin Forms bug workaround ??? { App.FinishInputSet = true; if (viewModel.InputText.Length == 0 && App.InputEmptyVal != null) { SetInputTextNoEvents(App.InputEmptyVal); } Device.BeginInvokeOnMainThread(() => { if (!App.SettingsViewModel.KeepKeyboardVisible) { InputEntry.Unfocus(); } App.FinishInput.Set(); }); } } else // never reached, but just in case { Device.StartTimer(new TimeSpan(0, 0, 0, 0, 250), () => { InputEntry.Focus(); return(false); }); } }
public void InputEntry_Unfocus() { Device.BeginInvokeOnMainThread(() => { InputEntry.Unfocus(); }); }
private void List_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count == 0) { return; } ListBox list = (sender as ListBox); var selectedItem = e.AddedItems.First(); if (selectedItem is Token) { Evaluate(selectedItem as Token); } else { string insertText = (e.AddedItems.First() as dynamic).Key; InputEntry.SelectedText = insertText; InputEntry.SelectionStart = InputEntry.SelectionStart + InputEntry.SelectionLength; InputEntry.SelectionLength = 0; } InputEntry.Focus(FocusState.Pointer); list.SelectedIndex = -1; }
public void Init(BaseInputData inputData, float inputDelay) { _inputData = inputData; _currentLayout = _inputData.DefaultLayout; _moveInputDelay = inputDelay; _directionEntries = new Dictionary <MoveDirection, InputEntry>(); foreach (var mapping in _inputData.Layouts[(int)_currentLayout].Mappings) { _directionEntries.Add(mapping.MoveDir, new InputEntry(mapping.KeyCode, _moveInputDelay)); } idle = new InputEntry(KeyCode.Space, _moveInputDelay); actionCancel = new InputEntry(KeyCode.Escape, _moveInputDelay); actionConfirm = new InputEntry(KeyCode.Return, _moveInputDelay); rangeTarget = new InputEntry(KeyCode.J, _moveInputDelay); NumbersPressed = new bool[_inputData.NumberKeys]; NumbersPressed.Fill <bool>(false); StartKeyCode = KeyCode.Alpha1; DoInit(); }
private int WriteCommands(SortedDictionary <string, InputEntry> y, string plugin, uint[] clientMask) { if (y == null || y.Count == 0) { return(0); } int c = 0; foreach (KeyValuePair <string, InputEntry> x in y) { if (x.Value.Plugin != plugin) { continue; } if ((x.Value.Flags & (CMDFlags.Disabled | CMDFlags.Hidden)) != CMDFlags.None) { continue; } string cmd = ""; InputEntry p = x.Value.Parent; while (p != null) { cmd = cmd.Insert(0, p.Command + " "); p = p.Parent; } SendMessage("@Y" + cmd, clientMask); c++; c += WriteCommands(x.Value.Subcommands, plugin, clientMask); } return(c); }
private int _PluginInfoWriteCommands(int j, SortedDictionary <string, InputEntry> y, string plugin, uint[] clientMask) { foreach (KeyValuePair <string, InputEntry> x in y) { if (x.Value.Plugin != plugin) { continue; } string cmd = x.Key; InputEntry parent = x.Value.Parent; while (parent != null) { cmd = cmd.Insert(0, parent.Command + " "); parent = parent.Parent; } if (j == 0) { SendMessage("@w| @WCommands @w: @c" + string.Format("{0,-55}", cmd) + "@w|", clientMask); } else { SendMessage("@w| : @c" + string.Format("{0,-55}", cmd) + "@w|", clientMask); } j++; if (x.Value.Subcommands != null) { j = _PluginInfoWriteCommands(j, x.Value.Subcommands, plugin, clientMask); } } return(j); }
protected void BrowsePluginLauncherPage_SizeChanged(object sender, EventArgs e) { Device.BeginInvokeOnMainThread(() => { InputEntry.Unfocus(); }); RedrawPluginLauncherPageControls(); ScrollToBottomOfPluginScrollView(); }
public void SpellButton_Clicked(object sender, EventArgs e) { currentWord = InputEntry.Text; if (!String.IsNullOrEmpty(currentWord)) { SetWord(); } else { InputEntry.Focus(); } }
private void OutputTapped(object sender, EventArgs e) { InputEntry.IsVisible = true; SpellButton.IsVisible = true; OutputLabel.IsVisible = false; LettersView.IsVisible = false; InputEntry.Focus(); LettersView.Position = 0; }
public TextInputCancellableView(string titleText, string placeHolderText, string saveButtonText, string cancelButtonText, string validationText) { InitializeComponent(); // update the Element's textual values TitleLabel.Text = titleText; //InputEntry.Placeholder = placeHolderText; SaveButton.Text = saveButtonText; CancelButton.Text = cancelButtonText; ValidationLabel.Text = validationText; // handling events to expose to public SaveButton.Clicked += SaveButton_Clicked; CancelButton.Clicked += CancelButton_Clicked; InputEntry.TextChanged += InputEntry_TextChanged; InputEntry.Focus(); }
public static InputSchema DeserializeFile(string filePath) { var result = new InputSchema { BuyEntries = new System.Collections.Generic.List <InputEntry>(), SellEntries = new System.Collections.Generic.List <InputEntry>() }; using StreamReader sr = new StreamReader(filePath); int id = 1; while (!sr.EndOfStream) { var line = sr.ReadLine(); var array = line.Split(','); var entry = new InputEntry { Id = id, IsBuy = true, IsMarket = array[1].Trim().ToLower() == "m", Volume = long.Parse(array[2].Trim().ToLower()) }; entry.Value = entry.IsMarket ? -1 : long.Parse(array[3].Trim().ToLower()); if (entry.IsBuy) { result.BuyEntries.Add(entry); } else { result.SellEntries.Add(entry); } id++; } return(result); }
void SwitchInput() { if (currentInput == InputEntry.Mouse) { gameObject.GetComponent <Text>().text = "Keyboard"; Manager ply = GameObject.FindObjectOfType <Manager>(); if (ply) { ply.setInputEntry(1); } currentInput = InputEntry.Keyboard; } else { gameObject.GetComponent <Text>().text = "Mouse"; Manager ply = GameObject.FindObjectOfType <Manager>(); if (ply) { ply.setInputEntry(0); } currentInput = InputEntry.Mouse; } }
public IInputCommand <TK> this[InputEntry <T> entry]
// Use this for initialization void Start() { currentInput = InputEntry.Mouse; }
public override void DoInit() { dropAbsorption = new InputEntry(KeyCode.U, _moveInputDelay); }
private InputEntry ParseInput() { InputEntry inp = new InputEntry(); while (_reader.ReadAttribute()) if (_reader.Name.Equals("id", true)) inp._id = (string)_reader.Value; else if (_reader.Name.Equals("name", true)) inp._name = (string)_reader.Value; else if (_reader.Name.Equals("semantic", true)) inp._semantic = (SemanticType)Enum.Parse(typeof(SemanticType), (string)_reader.Value, true); else if (_reader.Name.Equals("set", true)) inp._set = int.Parse((string)_reader.Value); else if (_reader.Name.Equals("offset", true)) inp._offset = int.Parse((string)_reader.Value); else if (_reader.Name.Equals("source", true)) inp._source = _reader.Value[0] == '#' ? (string)(_reader.Value + 1) : (string)_reader.Value; return inp; }