private void SetPatternSpeedAction(ArInt value) { int newValue = value.Adjust((int)Settings.PatternSpeed.TotalMilliseconds, 100, 1000); Settings.PatternSpeed = TimeSpan.FromMilliseconds(newValue); OsdShowMessage("Pattern Speed: " + Settings.PatternSpeed.TotalMilliseconds.ToString("F0") + " ms / command", TimeSpan.FromSeconds(2), "PatternSpeed"); }
private object ConvertParameter(string value, Type targetType, out bool success) { success = true; try { if (typeof(IConvertible).IsAssignableFrom(targetType)) { return(Convert.ChangeType(value, targetType)); } if (targetType == typeof(string)) { return(value); } if (targetType == typeof(ArTimeSpan)) { ArTimeSpan result = new ArTimeSpan(); if (!result.TryParse(value)) { success = false; return(null); } return(result); } if (targetType == typeof(ArInt)) { ArInt result = new ArInt(); if (!result.TryParse(value)) { success = false; return(null); } return(result); } } catch { // } success = false; return(false); }
private void SetRangeExtenderAction(ArInt value) { int newValue; if (value.IsRelative) { newValue = Settings.RangeExtender + value.Value; } else { newValue = value.Value; } newValue = Math.Min(99, Math.Max(0, newValue)); Settings.RangeExtender = newValue; }