void ShowParameterLimits() { if (ShowAlarmLimits) { ShowParameterAlarmLimits(); } ShowLimits = !ShowLimits; if (ShowLimits) { txtUpperLimit.Visibility = Visibility.Visible; txtLowerLimit.Visibility = Visibility.Visible; } else { bool result1 = double.TryParse(txtUpperLimit.Text, out double ul); bool result2 = double.TryParse(txtLowerLimit.Text, out double ll); if (result1 && result2) { UpperLimit = ul; LowerLimit = ll; } else { txtUpperLimit.Text = UpperLimit.ToString(); txtLowerLimit.Text = LowerLimit.ToString(); } txtUpperLimit.Visibility = Visibility.Collapsed; txtLowerLimit.Visibility = Visibility.Collapsed; } }
public string[] ToArgs() { List <string> args = new List <string>(); if (LowerLimit != 0 || UpperLimit != 0) { args.Add("LIMIT"); args.Add(LowerLimit.ToString()); args.Add(UpperLimit.ToString()); } if (Lexographically) { args.Add("ALPHA"); } if (!string.IsNullOrEmpty(By)) { args.Add("BY"); args.Add(By); } if (!string.IsNullOrEmpty(Get)) { args.Add("GET"); args.Add(Get); } return(args.ToArray()); }
/// <summary> /// Chart 설정 또는 변량에 대해 XML 속성으로 생성합니다. /// </summary> /// <param name="writer">xml writer</param> public override void GenerateXmlAttributes(XmlWriter writer) { base.GenerateXmlAttributes(writer); if (SetAdaptiveMin.HasValue) { writer.WriteAttributeString("SetAdaptiveMin", SetAdaptiveMin.GetHashCode().ToString()); } if (UpperLimit.HasValue) { writer.WriteAttributeString("UpperLimit", UpperLimit.ToString()); } if (LowerLimit.HasValue) { writer.WriteAttributeString("LowerLimit", LowerLimit.ToString()); } if (UpperLimitDisplay.IsNotWhiteSpace()) { writer.WriteAttributeString("UpperLimitDisplay", UpperLimitDisplay); } if (LowerLimitDisplay.IsNotWhiteSpace()) { writer.WriteAttributeString("LowerLimitDisplay", LowerLimitDisplay); } }
public string Action(string action, string parameter) { action = action.ToLower(); parameter = parameter.ToLower(); if (action == "status") { return(Digest); } else if (action == "debug") { _debugging = Convert.ToBoolean(parameter); return(JsonConvert.SerializeObject(_debugging)); } else if (action == "move") { switch (parameter) { case "up": Move(Direction.Up); break; case "down": Move(Direction.Down); break; case "all-up": Move(Direction.AllUp); break; case "all-down": Move(Direction.AllDown); break; default: uint target = 0; if (UInt32.TryParse(parameter, out target)) { Move(target); } else { return(string.Format("Bad parameter \"{0}\" to Action(\"move\")", parameter)); } break; } return("ok"); } else if (action == "halt" || action == "stop") { Halt(reason: parameter); return("ok"); } else if (action == "limit") { switch (parameter) { case "lower": return(LowerLimit.ToString()); case "upper": return(UpperLimit.ToString()); } return("ok"); } else { throw new ASCOM.ActionNotImplementedException("Action " + action + " is not implemented by this driver"); } }