Skip to content

Commit

Permalink
🎨 AvaloniaProgressRing support
Browse files Browse the repository at this point in the history
  • Loading branch information
SydneyOwl committed May 21, 2024
1 parent 29da992 commit 554c0fc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<StyleInclude Source="avares://SenhaixFreqWriter/Icons.axaml" />
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml" />
<StyleInclude Source="avares://SenhaixFreqWriter/DragDrop.axaml" />
<StyleInclude Source="avares://AvaloniaProgressRing/Styles/ProgressRing.xaml"/>

<Style Selector="DataGridColumnHeader">
<Setter Property="FontWeight" Value="Bold" />
Expand Down
1 change: 1 addition & 0 deletions SenhaixFreqWriter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.10.4"/>
<PackageReference Include="AvaloniaColorPicker" Version="1.4.0"/>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2"/>
<PackageReference Include="Deadpikle.AvaloniaProgressRing" Version="0.10.6" />
<PackageReference Include="HidSharp" Version="2.1.0"/>
<PackageReference Include="InTheHand.BluetoothLE" Version="4.0.36"/>
<PackageReference Include="MessageBox.Avalonia" Version="3.1.5.1"/>
Expand Down
15 changes: 13 additions & 2 deletions Views/Plugin/SatelliteHelperWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
x:Class="SenhaixFreqWriter.Views.Plugin.SatelliteHelperWindow"
xmlns:vm="using:SenhaixFreqWriter.Views.Plugin"
x:DataType="vm:SatelliteHelperWindow"
xmlns:progRing="clr-namespace:AvaloniaProgressRing;assembly=AvaloniaProgressRing"
Title="打星助手"
CanResize="False"
WindowStartupLocation="CenterScreen">
Expand Down Expand Up @@ -38,15 +39,25 @@
<TextBox Canvas.Top="495" Canvas.Left="145" Name="voffset" Text="5" />
<Label Content="kHz" Canvas.Top="500" Canvas.Left="220" />

<Button HorizontalAlignment="Left" Canvas.Top="440" Canvas.Left="350" Name="FetchSat"
<Button HorizontalAlignment="Left" Canvas.Top="10" Canvas.Left="350" Name="FetchSat"
Click="FetchSatDataButton_OnClick">
<StackPanel Orientation="Horizontal">
<PathIcon Data="{StaticResource arrow_sync_regular}" Margin="0,0,10,0" />
<TextBlock Text="更新星历" VerticalAlignment="Center" Name="FetchSatText" />
</StackPanel>
</Button>

<progRing:ProgressRing Width="25"
Height="25"
IsActive="False"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Foreground="Green"
Canvas.Left="300"
Canvas.Top="13"
Name="ProgressRing"/>

<Button HorizontalAlignment="Left" Canvas.Top="500" Canvas.Left="350" Click="InsertChannelButton_OnClick"
<Button HorizontalAlignment="Left" Canvas.Top="480" Canvas.Left="350" Click="InsertChannelButton_OnClick"
Name="insertChannel" IsEnabled="False">
<StackPanel Orientation="Horizontal">
<PathIcon Data="{StaticResource insert}" Margin="0,0,10,0" />
Expand Down
2 changes: 2 additions & 0 deletions Views/Plugin/SatelliteHelperWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ private void FetchData(bool useMem = false)
{
Dispatcher.UIThread.Post(() =>
{
ProgressRing.IsActive = true;
FetchSatText.Text = "更新中...";
FetchSat.IsEnabled = false;
});
Expand Down Expand Up @@ -247,6 +248,7 @@ private void FetchData(bool useMem = false)
{
Dispatcher.UIThread.Post(() =>
{
ProgressRing.IsActive = false;
selectedSatelliteInfo.Text = "";
FetchSat.IsEnabled = true;
FetchSatText.Text = "更新星历";
Expand Down

0 comments on commit 554c0fc

Please sign in to comment.