mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 20:06:33 +00:00
Display conditions - Implemented expression tree creation
Display conditions - Use the most appropriate number input UI general - Use current localisation for decimal seperators and enfore in inputs
This commit is contained in:
1 parent
b869078f08
commit
3da2fbcf0a
21 files changed
+282
-131
No files matched your search
@@ -49,6 +49,7 @@
|
||||
LostFocus="InputLostFocus"
|
||||
KeyDown="InputKeyDown"
|
||||
Visibility="Collapsed"
|
||||
RequestBringIntoView="Input_OnRequestBringIntoView" />
|
||||
RequestBringIntoView="Input_OnRequestBringIntoView"
|
||||
PreviewTextInput="Input_PreviewTextInput"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
@@ -81,7 +83,7 @@ namespace Artemis.UI.Shared.Controls
|
||||
private void InputMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
|
||||
|
||||
_startValue = Value;
|
||||
((IInputElement) sender).CaptureMouse();
|
||||
_mouseDragStartPoint = e.GetPosition((IInputElement) sender);
|
||||
@@ -109,7 +111,7 @@ namespace Artemis.UI.Shared.Controls
|
||||
return;
|
||||
|
||||
e.Handled = true;
|
||||
|
||||
|
||||
if (!_calledDragStarted)
|
||||
{
|
||||
OnDragStarted();
|
||||
@@ -162,6 +164,13 @@ namespace Artemis.UI.Shared.Controls
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void Input_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
var seperator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
|
||||
var regex = new Regex("^[" + seperator + "][0-9]+$|^[0-9]*[" + seperator + "]{0,1}[0-9]*$");
|
||||
e.Handled = !regex.IsMatch(e.Text);
|
||||
}
|
||||
|
||||
private static decimal UltimateRoundingFunction(decimal amountToRound, decimal nearstOf, decimal fairness)
|
||||
{
|
||||
return Math.Floor(amountToRound / nearstOf + fairness) * nearstOf;
|
||||
|
||||
Reference in new issue
Block a user