From aedd0c98e6a0c49858ce50f03205bce3e7c4db19 Mon Sep 17 00:00:00 2001
From: sydneyowl <84191144+SydneyOwl@users.noreply.github.com>
Date: Wed, 15 May 2024 11:12:00 +0800
Subject: [PATCH] :fire: Introduce SatelliteHelper
---
Views/Common/HintWindow.axaml | 2 +-
Views/Gt12/MainWindow.axaml | 10 +-
Views/Gt12/MainWindow.axaml.cs | 44 +++
Views/Plugin/BootImageImportWindow.axaml | 2 +-
Views/Plugin/BootImageImportWindow.axaml.cs | 8 +-
Views/Plugin/SatelliteHelperWindow.axaml | 55 ++++
Views/Plugin/SatelliteHelperWindow.axaml.cs | 345 ++++++++++++++++++++
Views/Shx8x00/MainWindow.axaml | 10 +-
Views/Shx8x00/MainWindow.axaml.cs | 46 +++
9 files changed, 507 insertions(+), 15 deletions(-)
create mode 100644 Views/Plugin/SatelliteHelperWindow.axaml
create mode 100644 Views/Plugin/SatelliteHelperWindow.axaml.cs
diff --git a/Views/Common/HintWindow.axaml b/Views/Common/HintWindow.axaml
index 8cc2588..2da5667 100644
--- a/Views/Common/HintWindow.axaml
+++ b/Views/Common/HintWindow.axaml
@@ -13,7 +13,7 @@
WindowStartupLocation="CenterScreen">
diff --git a/Views/Gt12/MainWindow.axaml b/Views/Gt12/MainWindow.axaml
index 9bc0e4c..fe5933f 100644
--- a/Views/Gt12/MainWindow.axaml
+++ b/Views/Gt12/MainWindow.axaml
@@ -94,11 +94,11 @@
-
-
-
-
-
+
diff --git a/Views/Shx8x00/MainWindow.axaml.cs b/Views/Shx8x00/MainWindow.axaml.cs
index d1332ed..4e1e025 100644
--- a/Views/Shx8x00/MainWindow.axaml.cs
+++ b/Views/Shx8x00/MainWindow.axaml.cs
@@ -520,4 +520,50 @@ private void BootImageMenuItem_OnClick(object? sender, RoutedEventArgs e)
{
new BootImageImportWindow(SHX_DEVICE.SHX8X00).ShowDialog(this);
}
+
+ private void SatMenuItem_OnClick(object? sender, RoutedEventArgs e)
+ {
+ new SatelliteHelperWindow(InsertNewChannel).ShowDialog(this);
+ }
+
+ private void InsertNewChannel(string rx, string dec, string tx, string enc, string name)
+ {
+ var lastEmptyIndex = -1;
+ for (var i = ListItems.Count - 1; i >= 0; i--)
+ {
+ if (ListItems[i].AllEmpty())
+ {
+ lastEmptyIndex = i;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ if (lastEmptyIndex == -1)
+ {
+ throw new IndexOutOfRangeException("信道空间已满,无法插入!");
+ }
+
+ var data = new ChannelData
+ {
+ RxFreq = rx,
+ TxAllow = "Yes",
+ Encrypt = "OFF",
+ Pttid = "OFF",
+ BandWidth = "W",
+ BusyLock = "OFF",
+ QtDec = dec,
+ QtEnc = enc,
+ ScanAdd = "ON",
+ TxPwr = "H",
+ SigCode = "1",
+ ChanNum = lastEmptyIndex.ToString(),
+ TxFreq = tx,
+ IsVisable = true,
+ ChanName = name
+ };
+ ListItems[lastEmptyIndex] = data;
+ }
}
\ No newline at end of file