void TextField_FocusChanged(object sender, bool newValue) { if (!newValue) { inputMachine.EndCurrentInput(); if (inputMachine.Text.Contains('-')) { inputMachine.Text = "-" + inputMachine.Text.Replace("-", ""); } if (inputMachine.Text.Length != 0) { try { Value = Convert.ToInt32(inputMachine.Text); } catch (OverflowException) { Value = 0; } } else { Value = 0; } } inputMachine.Text = Value.ToString(); }
void FileSelector_FocusChanged(object sender, bool newValue) { if (!newValue) { inputMachine.EndCurrentInput(); } }
void TextField_FocusChanged(object sender, bool newValue) { if (!newValue) { inputMachine.EndCurrentInput(); } }
void Console_FocusChanged(object sender, bool newValue) { if (!newValue) { inputMachine.EndCurrentInput(); } }
void TextField_FocusChanged(object sender, bool newValue) { if (!newValue) { inputMachine.EndCurrentInput(); if (inputMachine.Text.Contains('.')) { int firstIndex = inputMachine.Text.IndexOf('.'); inputMachine.Text = inputMachine.Text.Replace(".", "").Insert(firstIndex, "."); } if (inputMachine.Text.Contains('-')) { inputMachine.Text = "-" + inputMachine.Text.Replace("-", ""); } if (inputMachine.Text.Length != 0) { try { Value = Convert.ToDouble(inputMachine.Text); } catch (OverflowException) { Value = 0; } catch (FormatException) { try { Value = Convert.ToDouble(inputMachine.Text.Replace('.', ',')); } catch (OverflowException) { Value = 0; } } } else { Value = 0; } } inputMachine.Text = Value.ToString().Replace(',', '.'); }