private void CalcAndOutputResults() { if (!init_) { return; } string s = ""; double d = ClientCommonAPI.CalcTime(); SkyObjectPosCalc.SkyPosition obj = GetObject(); s += obj.Name + ":" + Environment.NewLine; double dec, ra; obj.CalcTopoRaDec(d, latitude_, longitude_, out dec, out ra); s += "R.A.\t= " + ClientCommonAPI.PrintTime(ra) + " (" + ra.ToString("F5") + "\x00B0)" + Environment.NewLine; s += "Dec.\t= " + ClientCommonAPI.PrintAngle(dec, true) + " (" + ClientCommonAPI.PrintDec(dec, "F5") + "\x00B0)" + Environment.NewLine; double azm, alt; obj.CalcAzimuthal(d, latitude_, longitude_, out azm, out alt); s += "Azm.\t= " + ClientCommonAPI.PrintAngle(azm) + " (" + azm.ToString("F5") + "\x00B0)" + Environment.NewLine; s += "Alt.\t= " + ClientCommonAPI.PrintAngle(alt) + " (" + alt.ToString("F5") + "\x00B0)" + Environment.NewLine; s += Environment.NewLine; buttonAddObject.Enabled = (alt > 0); buttonCorrectPolarAxis.Enabled = ClientCommonAPI.IsEquAxisCorrectionNeeded(latitude_, alignment_); if (alignment_.IsAligned) { s += "Alignment valid"; } else { s += "Alignment not valid"; } s += Environment.NewLine; s += alignment_.ToString(true); if (ClientCommonAPI.IsEquAxisCorrectionNeeded(latitude_, alignment_)) { s += Environment.NewLine + ClientCommonAPI.AddEquAxisCorrectionText(latitude_, alignment_); } textBoxResults.Text = s; }
private void SetConnectionAndAlignmentText() { if (!connectionAndAlignTextChanged_) { return; } connectionAndAlignTextChanged_ = false; string s = ""; if (connectionAltAzm_ == null) { s += "Alt-Azm not Connected"; } else { s += "Alt-Azm Connected to " + connectionAltAzm_.connection_.PortName + " at " + connectionAltAzm_.connection_.BaudRate; } s += Environment.NewLine; if (connectionEqu_ == null) { s += "Equ not Connected"; } else { s += "Equ Connected to " + connectionEqu_.connection_.PortName + " at " + connectionEqu_.connection_.BaudRate; } s += Environment.NewLine; if (connectionGPS_ == null) { s += "GPS not Connected"; } else { s += "GPS Connected to " + connectionGPS_.connection_.PortName + " at " + connectionGPS_.connection_.BaudRate; } s += Environment.NewLine; if (alignment_ == null) { s += "Not Aligned"; } else { if (alignment_.IsAligned) { s += "Alignment valid"; } else { s += "Alignment not valid"; } s += Environment.NewLine; s += alignment_.ToString(); if (ClientCommonAPI.IsEquAxisCorrectionNeeded(latitude_, alignment_)) { s += Environment.NewLine; s += ClientCommonAPI.AddEquAxisCorrectionText(latitude_, alignment_); } } textBoxAlignment.Text = s; }