更好买显示金钱

This commit is contained in:
ZouJin 2023-08-12 17:13:30 +10:00
parent a1e894aa5a
commit bdbfe56a00
6 changed files with 45 additions and 30 deletions

View File

@ -108,6 +108,10 @@ namespace VPet_Simulator.Windows.Interface
/// 获得当前系统音乐播放音量 /// 获得当前系统音乐播放音量
/// </summary> /// </summary>
float AudioPlayingVolume(); float AudioPlayingVolume();
/// <summary>
/// 关闭指示器,默认为true
/// </summary>
bool CloseConfirm { get; }
} }
} }

View File

@ -557,5 +557,9 @@ namespace VPet_Simulator.Windows
#endif #endif
} }
/// <summary>
/// 关闭指示器,默认为true
/// </summary>
public bool CloseConfirm { get; private set; } = true;
} }
} }

View File

@ -139,6 +139,7 @@ namespace VPet_Simulator.Windows
private void Restart_Closed(object sender, EventArgs e) private void Restart_Closed(object sender, EventArgs e)
{ {
CloseConfirm = false;
Save(); Save();
try try
{ {
@ -531,6 +532,7 @@ namespace VPet_Simulator.Windows
private void Window_Closed(object sender, EventArgs e) private void Window_Closed(object sender, EventArgs e)
{ {
CloseConfirm = false;
try try
{ {
//关闭所有插件 //关闭所有插件
@ -541,7 +543,6 @@ namespace VPet_Simulator.Windows
Save(); Save();
if (winSetting != null) if (winSetting != null)
{ {
winSetting.Shutdown = true;
winSetting.Close(); winSetting.Close();
} }
petHelper?.Close(); petHelper?.Close();

View File

@ -5,9 +5,10 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pu="https://opensource.panuon.com/wpf-ui" xmlns:local="clr-namespace:VPet_Simulator.Windows" xmlns:pu="https://opensource.panuon.com/wpf-ui" xmlns:local="clr-namespace:VPet_Simulator.Windows"
mc:Ignorable="d" Title="{ll:Str 更好买}" Height="550" Width="800" FontSize="14" WindowStartupLocation="CenterScreen" mc:Ignorable="d" Title="{ll:Str 更好买}" Height="550" Width="800" FontSize="14"
Background="#E0F6FF" pu:WindowXCaption.Height="45" pu:WindowXCaption.Background="{DynamicResource DARKPrimary}" WindowStartupLocation="CenterScreen" Background="#E0F6FF" pu:WindowXCaption.Height="45"
pu:WindowXCaption.Foreground="#FFFFFF" pu:WindowXCaption.Buttons="Close" Icon="/Res/BetterBuy.png" pu:WindowXCaption.Background="{DynamicResource DARKPrimary}" pu:WindowXCaption.Foreground="#FFFFFF"
pu:WindowXCaption.Buttons="Close" Icon="/Res/BetterBuy.png"
pu:WindowXCaption.ShadowColor="{DynamicResource ShadowColor}" Closing="WindowX_Closing"> pu:WindowXCaption.ShadowColor="{DynamicResource ShadowColor}" Closing="WindowX_Closing">
<pu:WindowXCaption.CloseButtonStyle> <pu:WindowXCaption.CloseButtonStyle>
<Style TargetType="Button" BasedOn="{StaticResource {x:Static pu:WindowXCaption.CloseButtonStyleKey}}"> <Style TargetType="Button" BasedOn="{StaticResource {x:Static pu:WindowXCaption.CloseButtonStyleKey}}">
@ -37,9 +38,9 @@
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBox x:Name="TbTitleSearch" Grid.ColumnSpan="2" VerticalAlignment="Center" Padding="7,0" <TextBox x:Name="TbTitleSearch" Grid.ColumnSpan="2" VerticalAlignment="Center" Padding="7,0"
pu:TextBoxHelper.Watermark="{ll:Str 搜索商品}" FontSize="14" Background="#33FFFFFF" Height="30" pu:TextBoxHelper.Watermark="{ll:Str 搜索商品}" FontSize="14" Background="#33FFFFFF"
BorderThickness="0" pu:TextBoxHelper.CornerRadius="5" Loaded="TbTitleSearch_Loaded" Height="30" BorderThickness="0" pu:TextBoxHelper.CornerRadius="5"
Foreground="{DynamicResource DARKPrimaryText}" /> Loaded="TbTitleSearch_Loaded" Foreground="{DynamicResource DARKPrimaryText}" />
<Button Grid.Column="1" Margin="0,0,3,0" VerticalAlignment="Center" Height="28" Width="28" <Button Grid.Column="1" Margin="0,0,3,0" VerticalAlignment="Center" Height="28" Width="28"
IsDefault="{Binding IsKeyboardFocusWithin, ElementName=TbTitleSearch}" IsDefault="{Binding IsKeyboardFocusWithin, ElementName=TbTitleSearch}"
BorderThickness="0" pu:ButtonHelper.CornerRadius="0,5,5,0" Background="Transparent" BorderThickness="0" pu:ButtonHelper.CornerRadius="0,5,5,0" Background="Transparent"
@ -47,6 +48,9 @@
Foreground="{DynamicResource DARKPrimaryText}" FontSize="16" Cursor="Hand" Foreground="{DynamicResource DARKPrimaryText}" FontSize="16" Cursor="Hand"
Click="BtnSearch_Click" /> Click="BtnSearch_Click" />
</Grid> </Grid>
<TextBlock VerticalAlignment="Center" Margin="20,0,0,0" FontSize="16" FontWeight="Bold">
<Run Text="{ll:Str 金钱}" />: $ <Run x:Name="rMoney" Loaded="rMoney_Loaded" Text=""/>
</TextBlock>
</StackPanel> </StackPanel>
<pu:Switch Content="{ll:Str 购买后不自动关闭窗口}" Grid.Column="2" FontSize="14" Margin="10,0,5,0" Height="20" <pu:Switch Content="{ll:Str 购买后不自动关闭窗口}" Grid.Column="2" FontSize="14" Margin="10,0,5,0" Height="20"
VerticalAlignment="Center" HorizontalAlignment="Right" BoxHeight="14" ToggleSize="18" VerticalAlignment="Center" HorizontalAlignment="Right" BoxHeight="14" ToggleSize="18"
@ -114,7 +118,8 @@
</Border>--> </Border>-->
<Button Grid.Row="4" Margin="0,7,0,0" Padding="7,5" Cursor="Hand" <Button Grid.Row="4" Margin="0,7,0,0" Padding="7,5" Cursor="Hand"
HorizontalAlignment="Left" pu:ButtonHelper.Icon="&#xF11A;" HorizontalAlignment="Left" pu:ButtonHelper.Icon="&#xF11A;"
Style="{DynamicResource ThemedButtonStyle}" Content="{ll:Str 购买}" Click="BtnBuy_Click" /> Style="{DynamicResource ThemedButtonStyle}" Content="{ll:Str 购买}"
Click="BtnBuy_Click" />
</Grid> </Grid>
</Grid> </Grid>
</Border> </Border>
@ -159,8 +164,8 @@
<ToggleButton x:Name="TbtnDetail" Grid.ColumnSpan="2" Margin="0,5,8,0" HorizontalAlignment="Right" <ToggleButton x:Name="TbtnDetail" Grid.ColumnSpan="2" Margin="0,5,8,0" HorizontalAlignment="Right"
VerticalAlignment="Top" Width="30" Height="30" Padding="0" FontSize="22" VerticalAlignment="Top" Width="30" Height="30" Padding="0" FontSize="22"
Foreground="{DynamicResource DARKPrimaryDarker}" Background="Transparent" Foreground="{DynamicResource DARKPrimaryDarker}" Background="Transparent"
ToolTip="{ll:Str 物品详情}" ToolTip="{ll:Str 物品详情}" pu:ToggleButtonHelper.CornerRadius="5"
pu:ToggleButtonHelper.CornerRadius="5" pu:ToggleButtonHelper.CheckedContent="&#xEF3D;" pu:ToggleButtonHelper.CheckedContent="&#xEF3D;"
pu:ToggleButtonHelper.CheckedForeground="{DynamicResource DARKPrimaryText}" pu:ToggleButtonHelper.CheckedForeground="{DynamicResource DARKPrimaryText}"
pu:IconHelper.Margin="0" FontFamily="/VPet-Simulator.Windows;component/Res/#remixicon" pu:IconHelper.Margin="0" FontFamily="/VPet-Simulator.Windows;component/Res/#remixicon"
Content="&#xEF3E;" /> Content="&#xEF3E;" />
@ -205,7 +210,8 @@
<ListBoxItem Content="{ll:Str 功能性}" /> <ListBoxItem Content="{ll:Str 功能性}" />
<ListBoxItem Content="{ll:Str 药品}" /> <ListBoxItem Content="{ll:Str 药品}" />
</ListBox> </ListBox>
<TextBlock Grid.Row="2" Text="{ll:Str 排序方式}" Margin="5" FontSize="18" Foreground="{DynamicResource DARKPrimary}" /> <TextBlock Grid.Row="2" Text="{ll:Str 排序方式}" Margin="5" FontSize="18"
Foreground="{DynamicResource DARKPrimary}" />
<Border Grid.Row="3" Margin="0,10,0,0" MinHeight="100" CornerRadius="5"> <Border Grid.Row="3" Margin="0,10,0,0" MinHeight="100" CornerRadius="5">
<Grid VerticalAlignment="Top"> <Grid VerticalAlignment="Top">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@ -238,33 +244,27 @@
</Grid> </Grid>
</Border> </Border>
</Grid> </Grid>
<Grid Margin="10" <Grid Margin="10" Grid.Column="1">
Grid.Column="1">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<ItemsControl x:Name="IcCommodity" <ItemsControl x:Name="IcCommodity" SizeChanged="AutoUniformGrid_SizeChanged">
SizeChanged="AutoUniformGrid_SizeChanged">
<ItemsControl.ItemsPanel> <ItemsControl.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<local:AutoUniformGrid VerticalAlignment="Top" <local:AutoUniformGrid VerticalAlignment="Top" ItemsMinWidth="250"
ItemsMinWidth="250" Changed="AutoUniformGrid_Changed" />
Changed="AutoUniformGrid_Changed"/>
</ItemsPanelTemplate> </ItemsPanelTemplate>
</ItemsControl.ItemsPanel> </ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<ContentControl Height="140" <ContentControl Height="140" Margin="0,0,10,10" Content="{Binding}"
Margin="0,0,10,10" ContentTemplate="{StaticResource CommodityDataTemplate}" />
Content="{Binding}"
ContentTemplate="{StaticResource CommodityDataTemplate}" />
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>
<pu:Pagination x:Name="pagination" Grid.Row="1" <pu:Pagination x:Name="pagination" Grid.Row="1" Style="{DynamicResource StandardPaginationStyle}"
Style="{DynamicResource StandardPaginationStyle}" CurrentPageChanged="pagination_CurrentPageChanged" />
CurrentPageChanged="pagination_CurrentPageChanged"/>
</Grid> </Grid>
</Grid> </Grid>
</pu:WindowX> </pu:WindowX>

View File

@ -46,6 +46,7 @@ namespace VPet_Simulator.Windows
LsbSortAsc.SelectedIndex = mw.Set["betterbuy"].GetBool("lastasc") ? 0 : 1; LsbSortAsc.SelectedIndex = mw.Set["betterbuy"].GetBool("lastasc") ? 0 : 1;
AllowChange = true; AllowChange = true;
} }
Run rMoney;
public void Show(Food.FoodType type) public void Show(Food.FoodType type)
{ {
mw.Topmost = false; mw.Topmost = false;
@ -55,6 +56,8 @@ namespace VPet_Simulator.Windows
OrderItemSource(type, LsbSortRule.SelectedIndex, LsbSortAsc.SelectedIndex == 0); OrderItemSource(type, LsbSortRule.SelectedIndex, LsbSortAsc.SelectedIndex == 0);
else else
LsbCategory.SelectedIndex = (int)type; LsbCategory.SelectedIndex = (int)type;
if (rMoney != null)
rMoney.Text = mw.Core.Save.Money.ToString("f2");
Show(); Show();
} }
public void OrderItemSource(Food.FoodType type, int sortrule, bool sortasc, string searchtext = null) public void OrderItemSource(Food.FoodType type, int sortrule, bool sortasc, string searchtext = null)
@ -291,7 +294,7 @@ namespace VPet_Simulator.Windows
private void WindowX_Closing(object sender, System.ComponentModel.CancelEventArgs e) private void WindowX_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{ {
TryClose(); TryClose();
e.Cancel = true; e.Cancel = mw.CloseConfirm;
} }
private void Switch_Loaded(object sender, RoutedEventArgs e) private void Switch_Loaded(object sender, RoutedEventArgs e)
@ -332,5 +335,11 @@ namespace VPet_Simulator.Windows
{ {
Search(); Search();
} }
private void rMoney_Loaded(object sender, RoutedEventArgs e)
{
rMoney = sender as Run;
rMoney.Text = mw.Core.Save.Money.ToString("f2");
}
} }
} }

View File

@ -571,7 +571,6 @@ namespace VPet_Simulator.Windows
{ {
Process.Start("https://www.exlb.net/Diagnosis"); Process.Start("https://www.exlb.net/Diagnosis");
} }
public bool Shutdown = false;
public new void Show() public new void Show()
{ {
@ -584,10 +583,8 @@ namespace VPet_Simulator.Windows
private void WindowX_Closing(object sender, System.ComponentModel.CancelEventArgs e) private void WindowX_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{ {
if (Shutdown)
return;
mw.Topmost = mw.Set.TopMost; mw.Topmost = mw.Set.TopMost;
e.Cancel = true; e.Cancel = mw.CloseConfirm;
voicetimer.Stop(); voicetimer.Stop();
Hide(); Hide();
} }