Skip to content

Commit

Permalink
Added Oceanic Support + facelift
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-seagrave committed Jun 8, 2022
2 parents c110661 + bc459d7 commit 7f6d053
Show file tree
Hide file tree
Showing 27 changed files with 1,021 additions and 978 deletions.
6 changes: 6 additions & 0 deletions EasyCPDLC/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
<setting name="CPDLCWindowSize" serializeAs="String">
<value>0, 0</value>
</setting>
<setting name="CID" serializeAs="String">
<value>0</value>
</setting>
<setting name="HoppieCode" serializeAs="String">
<value />
</setting>
</EasyCPDLC.Properties.Settings>
</userSettings>
</configuration>
67 changes: 61 additions & 6 deletions EasyCPDLC/CPDLCMessage.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,84 @@
namespace EasyCPDLC
using System;
using System.Drawing;
using System.Windows.Forms;

namespace EasyCPDLC
{
class CPDLCMessage : System.Windows.Forms.Label
public class CPDLCMessage : Label
{

public string type;
public bool acknowledged = false;
public string recipient;
public string message;
public bool outbound;
private string storedText;

public CPDLCResponse header;

public CPDLCMessage()
{

}
public CPDLCMessage(string _type, string _recipient, string _message, bool _outbound = false, CPDLCResponse _header = null)
{
type = _type;
recipient = _recipient;
message = _message;
outbound = _outbound;
header = _header;
SetStyle(ControlStyles.Selectable, true);
}

public void OverrideText(string newText)
{
storedText = Text;
Console.WriteLine(storedText);
Invoke(new Action(() => Text = newText));
}

public void RestoreText()
{
Invoke(new Action(() => Text = storedText));
}

protected override void OnEnter(EventArgs e)
{
ForeColor = Color.Orange;
}

protected override void OnLeave(EventArgs e)
{
ForeColor = SystemColors.ControlDark;
}
}

public class CPDLCResponse
{
public string dataType { get; set; }
public int messageID { get; set; }
public int responseID { get; set; }
public string responses { get; set; }
public string DataType { get; set; }
public int MessageID { get; set; }
public int ResponseID { get; set; }
public string Responses { get; set; }

}

public class AccessibleLabel : Label
{
private readonly Color foreColor;
public AccessibleLabel(Color _foreColor)
{
SetStyle(ControlStyles.Selectable, true);
foreColor = _foreColor;
}

protected override void OnEnter(EventArgs e)
{
ForeColor = Color.Orange;
}

protected override void OnLeave(EventArgs e)
{
ForeColor = foreColor;
}
}
}
4 changes: 2 additions & 2 deletions EasyCPDLC/Contract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ private async void SendReply(Object source, ElapsedEventArgs e)
{
try
{
if (parent.useFSUIPC)
if (MainForm.UseFSUIPC)
{
string message = String.Format("REPORT {0} {1} {2} {3} {4}",
parent.callsign,
DateTime.UtcNow.ToString("ddHHmm"),
Math.Round(parent.fsuipc.position.Latitude.DecimalDegrees, 5),
Math.Round(parent.fsuipc.position.Longitude.DecimalDegrees, 5),
Math.Round(parent.fsuipc.altitude.Feet / 100));
await parent.SendCPDLCMessage(sender, "ADS-C", message, true, false);
await parent.SendCPDLCMessage(sender, "ADS-C", message, false);
}
}
catch { }
Expand Down
4 changes: 2 additions & 2 deletions EasyCPDLC/CustomUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class CustomUI
{
public static UITextBox CreateTextBox(string _text, int _maxLength, Color _controlFrontColor, Color _controlBackColor, Font _font)
{
UITextBox _temp = new UITextBox(_controlFrontColor)
UITextBox _temp = new(_controlFrontColor)
{
BackColor = _controlBackColor,
ForeColor = _controlFrontColor,
Expand All @@ -34,7 +34,7 @@ public static UITextBox CreateTextBox(string _text, int _maxLength, Color _contr

public static Label CreateTemplate(string _text, Color _controlFrontColor, Color _controlBackColor, Font _font)
{
Label _temp = new Label
Label _temp = new()
{
BackColor = _controlBackColor,
ForeColor = _controlFrontColor,
Expand Down
76 changes: 44 additions & 32 deletions EasyCPDLC/DataEntry.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7f6d053

Please sign in to comment.