Skip to content

Commit

Permalink
🎨 Support select rows in batch
Browse files Browse the repository at this point in the history
  • Loading branch information
SydneyOwl committed Dec 8, 2024
1 parent 04cea71 commit eae8580
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 26 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.0
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.0
WORKDIR /source
ENV TZ=Asia/Shanghai
ARG DEBIAN_FRONTEND=noninteractive
Expand All @@ -10,7 +10,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone &
wget \
gcc && \
rm -rf /var/lib/apt/lists/* && \
wget -O ./amsat-all-frequencies.json https://cdn.jsdelivr.net/gh/palewire/amateur-satellite-database/data/amsat-all-frequencies.json && \
wget --timeout=10 -O ./amsat-all-frequencies.json "https://cdn.jsdelivr.net/gh/palewire/amateur-satellite-database/data/amsat-all-frequencies.json"; \
sed -i 's/@COMMIT_HASH@/DockerVersion/g' Properties/VERSION.cs && \
sed -i 's/@TAG_NAME@/DockerVersion/g' Properties/VERSION.cs && \
sed -i "s/@BUILD_TIME@/$(date)/g" Properties/VERSION.cs && \
Expand Down
37 changes: 29 additions & 8 deletions Views/Gt12/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace SenhaixFreqWriter.Views.Gt12;

public partial class MainWindow : Window
{
private Channel _copiedChannel;
private List<Channel> _copiedChannel = new();

private bool _devSwitchFlag;

Expand Down Expand Up @@ -330,23 +330,44 @@ private void SwitchDevice_OnClick(object? sender, RoutedEventArgs e)

private void MenuCopyChannel_OnClick(object? sender, RoutedEventArgs e)
{
var selected = channelDataGrid.SelectedIndex;
_copiedChannel = ListItems[selected];
// var selected = channelDataGrid.SelectedIndex;
// _copiedChannel = ListItems[selected];
_copiedChannel.Clear();
foreach (var selectedItem in channelDataGrid.SelectedItems)
{
_copiedChannel.Add((Channel)selectedItem);
}
}

private void MenuCutChannel_OnClick(object? sender, RoutedEventArgs e)
{
var selected = channelDataGrid.SelectedIndex;
_copiedChannel = ListItems[selected].DeepCopy();
ListItems[selected] = new Channel();
// var selected = channelDataGrid.SelectedIndex;
// _copiedChannel = ListItems[selected].DeepCopy();
// ListItems[selected] = new Channel();
// CalcSeq();

_copiedChannel.Clear();
foreach (var selectedItem in channelDataGrid.SelectedItems)
{
_copiedChannel.Add((Channel)selectedItem);
}
_copiedChannel.ForEach(x=>ListItems[x.Id-1]=new Channel());
CalcSeq();
}

private void MenuPasteChannel_OnClick(object? sender, RoutedEventArgs e)
{
if (_copiedChannel == null) return;
// if (_copiedChannel == null) return;
// var selected = channelDataGrid.SelectedIndex;
// ListItems[selected] = _copiedChannel.DeepCopy();
// CalcSeq();

if (_copiedChannel.Count == 0)return;
var selected = channelDataGrid.SelectedIndex;
ListItems[selected] = _copiedChannel.DeepCopy();
for (var i = 0; i < _copiedChannel.Count; i++)
{
ListItems[selected + i] = _copiedChannel[i].DeepCopy();
}
CalcSeq();
}

Expand Down
38 changes: 30 additions & 8 deletions Views/Shx8800Pro/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace SenhaixFreqWriter.Views.Shx8800Pro;

public partial class MainWindow : Window
{
private Channel _copiedChannel;
private List<Channel> _copiedChannel = new();

private bool _devSwitchFlag;

Expand Down Expand Up @@ -306,23 +306,45 @@ private void SwitchDevice_OnClick(object? sender, RoutedEventArgs e)

private void MenuCopyChannel_OnClick(object? sender, RoutedEventArgs e)
{
var selected = channelDataGrid.SelectedIndex;
_copiedChannel = ListItems[selected];
// var selected = channelDataGrid.SelectedIndex;
// _copiedChannel = ListItems[selected];

_copiedChannel.Clear();
foreach (var selectedItem in channelDataGrid.SelectedItems)
{
_copiedChannel.Add((Channel)selectedItem);
}
}

private void MenuCutChannel_OnClick(object? sender, RoutedEventArgs e)
{
var selected = channelDataGrid.SelectedIndex;
_copiedChannel = ListItems[selected].DeepCopy();
ListItems[selected] = new Channel();
// var selected = channelDataGrid.SelectedIndex;
// _copiedChannel = ListItems[selected].DeepCopy();
// ListItems[selected] = new Channel();
// CalcSeq();

_copiedChannel.Clear();
foreach (var selectedItem in channelDataGrid.SelectedItems)
{
_copiedChannel.Add((Channel)selectedItem);
}
_copiedChannel.ForEach(x=>ListItems[x.Id-1]=new Channel());
CalcSeq();
}

private void MenuPasteChannel_OnClick(object? sender, RoutedEventArgs e)
{
if (_copiedChannel == null) return;
// if (_copiedChannel == null) return;
// var selected = channelDataGrid.SelectedIndex;
// ListItems[selected] = _copiedChannel.DeepCopy();
// CalcSeq();

if (_copiedChannel.Count == 0)return;
var selected = channelDataGrid.SelectedIndex;
ListItems[selected] = _copiedChannel.DeepCopy();
for (var i = 0; i < _copiedChannel.Count; i++)
{
ListItems[selected + i] = _copiedChannel[i].DeepCopy();
}
CalcSeq();
}

Expand Down
39 changes: 31 additions & 8 deletions Views/Shx8x00/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public partial class MainWindow : Window

private string _savePath = "";

private ChannelData _tmpChannel;
private List<ChannelData> _tmpChannel = new();

private BluetoothDeviceSelectionWindow _bds;

Expand Down Expand Up @@ -369,24 +369,47 @@ private void ForceRefreshUi()

private void MenuCopyChannel_OnClick(object? sender, RoutedEventArgs e)
{
var selected = channelDataGrid.SelectedIndex;
_tmpChannel = ListItems[selected];
// var selected = channelDataGrid.SelectedIndex;
// _tmpChannel = ListItems[selected];

_tmpChannel.Clear();
foreach (var selectedItem in channelDataGrid.SelectedItems)
{
_tmpChannel.Add((ChannelData)selectedItem);
}
}

private void MenuCutChannel_OnClick(object? sender, RoutedEventArgs e)
{
var selected = channelDataGrid.SelectedIndex;
_tmpChannel = ListItems[selected].DeepCopy();
ListItems[selected] = new ChannelData();
// var selected = channelDataGrid.SelectedIndex;
// _tmpChannel = ListItems[selected].DeepCopy();
// ListItems[selected] = new ChannelData();
// CalcSequence();
_tmpChannel.Clear();
foreach (var selectedItem in channelDataGrid.SelectedItems)
{
var item = (ChannelData)selectedItem;
_tmpChannel.Add(item);
}
_tmpChannel.ForEach(x => ListItems[int.Parse(x.ChanNum)] = new ChannelData());
CalcSequence();
}

private void MenuPasteChannel_OnClick(object? sender, RoutedEventArgs e)
{
if (_tmpChannel == null) return;
if(_tmpChannel.Count == 0)return;
var selected = channelDataGrid.SelectedIndex;
ListItems[selected] = _tmpChannel.DeepCopy();
for (var i = 0; i < _tmpChannel.Count; i++)
{
ListItems[selected + i] = _tmpChannel[i].DeepCopy();
}
CalcSequence();


// if (_tmpChannel == null) return;
// var selected = channelDataGrid.SelectedIndex;
// ListItems[selected] = _tmpChannel.DeepCopy();
// CalcSequence();
}

private void MenuClrChannel_OnClick(object? sender, RoutedEventArgs e)
Expand Down

0 comments on commit eae8580

Please sign in to comment.