Skip to content

Commit

Permalink
Release:V1.2.0
Browse files Browse the repository at this point in the history
Release:V1.2.0
  • Loading branch information
lisongkun authored Aug 13, 2023
2 parents ab206d6 + edbe7c9 commit ccf4c34
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 19 deletions.
1 change: 1 addition & 0 deletions Domain/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using hygge_imaotai.Entity;
using hygge_imaotai.UserInterface.UserControl;
using hygge_imaotai.UserInterface.UserControls;
using MaterialDesignThemes.Wpf;
Expand Down
1 change: 0 additions & 1 deletion Domain/UserManageViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing.Printing;
using System.Linq;
using System.Windows.Input;
using hygge_imaotai.Entity;
Expand Down
4 changes: 2 additions & 2 deletions Entity/MenuItemEntity.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using hygge_imaotai.Domain;
using MaterialDesignThemes.Wpf;

namespace hygge_imaotai.Domain
namespace hygge_imaotai.Entity
{
public class DemoItem : ViewModelBase
{
Expand Down
12 changes: 10 additions & 2 deletions Repository/ShopRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,16 @@ private static List<ShopEntity> GetAllShopList()
var response =
await
requestUrl
.GetStringAsync();
var responseJObject = JObject.Parse(response);
.AllowAnyHttpStatus()
.GetAsync();
if (response.StatusCode == 404)
{
throw new Exception("本次抢购会话已过期,请手动刷新一下商品列表和店铺列表后重试");
}

var responseText = await response.GetStringAsync();

var responseJObject = JObject.Parse(responseText);
if (responseJObject["code"].Value<int>() != 2000)
{
Console.WriteLine($"查询所在省市的投放产品和数量error,{province}-{itemId}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@
Text="{Binding ShopType}"
Style="{StaticResource MaterialDesignFloatingHintTextBox}"/>
<TextBox Grid.Row="8"
wpf:HintAssist.Hint="请输入纬度(eg:110.21)"
wpf:HintAssist.Hint="请输入纬度(eg:36.62)"
FontSize="16"
Text="{Binding Lat}"
Style="{StaticResource MaterialDesignFloatingHintTextBox}"/>
<TextBox Grid.Row="9"
wpf:HintAssist.Hint="请输入经度(eg:36.62)"
wpf:HintAssist.Hint="请输入经度(eg:114.48)"
FontSize="16"
Text="{Binding Lng}"
Style="{StaticResource MaterialDesignFloatingHintTextBox}"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using System;
using System.Linq;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows;
using hygge_imaotai.Domain;
using hygge_imaotai.Entity;
using hygge_imaotai.Repository;
using MaterialDesignThemes.Wpf;
using hygge_imaotai.UserInterface.UserControls;

namespace hygge_imaotai.UserInterface.Dialogs.DirectAddAccountDialog
{
Expand Down Expand Up @@ -71,6 +70,9 @@ private void LoginButton_OnClick(object sender, RoutedEventArgs e)
}

DB.Sqlite.Insert(_dataContext).ExecuteAffrows();

// 刷新用户列表
UserManageControl.RefreshData(UserManageControl.UserListViewModel);
}
}
}
1 change: 0 additions & 1 deletion UserInterface/UserControls/ShopManageUserControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.IO;
using System.Reflection.Metadata;
using System.Threading;
using System.Windows;
using Flurl.Http;
Expand Down
19 changes: 12 additions & 7 deletions UserInterface/UserControls/UserManageControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection.Metadata;
using System.Windows;
using System.Windows;
using hygge_imaotai.Domain;
using hygge_imaotai.Entity;
using hygge_imaotai.Repository;
Expand All @@ -11,16 +10,21 @@ namespace hygge_imaotai.UserInterface.UserControls
/// </summary>
public partial class UserManageControl
{
#region Properties

public static UserManageViewModel UserListViewModel { get; } = new();

#endregion
public UserManageControl()
{
InitializeComponent();
DataContext = new UserManageViewModel();
RefreshData();
DataContext = UserListViewModel;

RefreshData(UserListViewModel);
}

private void RefreshData()
public static void RefreshData(UserManageViewModel userListViewModel)
{
var userListViewModel = (UserManageViewModel)DataContext;
UserManageViewModel.UserList.Clear();

DB.Sqlite.Select<UserEntity>()
Expand All @@ -41,7 +45,7 @@ private void RefreshData()

private void QueryButton_OnClick(object sender, RoutedEventArgs e)
{
RefreshData();
RefreshData((UserManageViewModel)DataContext);
}

private void ResetButton_OnClick(object sender, RoutedEventArgs e)
Expand All @@ -52,5 +56,6 @@ private void ResetButton_OnClick(object sender, RoutedEventArgs e)
userListViewModel.Province = "";
userListViewModel.City = "";
}

}
}
16 changes: 15 additions & 1 deletion UserInterface/Window/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:domain="clr-namespace:hygge_imaotai.Domain"
xmlns:entity="clr-namespace:hygge_imaotai.Entity"
xmlns:tb="http://www.hardcodet.net/taskbar"
Title="i茅台预约小助手"
Width="1215"
Height="800"
Expand All @@ -21,6 +23,7 @@
<CommandBinding Command="Copy" Executed="OnCopy" />
</Window.CommandBindings>


<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand Down Expand Up @@ -126,7 +129,7 @@
<ListBox.Resources>
<Style TargetType="ScrollViewer" BasedOn="{StaticResource MaterialDesignScrollViewer}" />
<Style TargetType="ScrollBar" BasedOn="{StaticResource MaterialDesignScrollBarMinimal}" />
<DataTemplate DataType="{x:Type domain:DemoItem}">
<DataTemplate DataType="{x:Type entity:DemoItem}">
<TextBlock Text="{Binding Name}" TextTrimming="CharacterEllipsis" />
</DataTemplate>
</ListBox.Resources>
Expand All @@ -145,6 +148,7 @@
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<materialDesign:ColorZone Padding="16"
materialDesign:ElevationAssist.Elevation="Dp0"
Expand Down Expand Up @@ -310,7 +314,17 @@
Height="36"
Kind="Github" />
</Button>

<tb:TaskbarIcon Grid.Row="3"
IconSource="/Resources/favicon.ico"
PopupActivation="LeftClick"
TrayLeftMouseUp="TaskbarIcon_OnTrayLeftMouseUp"
ToolTipText="茅台预约器"/>
</Grid>


</materialDesign:DrawerHost>


</materialDesign:DialogHost>
</Window>
8 changes: 8 additions & 0 deletions UserInterface/Window/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@
using hygge_imaotai.Domain;
using MaterialDesignThemes.Wpf;



namespace hygge_imaotai.UserInterface.Window
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow
{


public MainWindow()
{
InitializeComponent();
Expand Down Expand Up @@ -133,5 +137,9 @@ private async void MenuPopupButton_OnClick(object sender, RoutedEventArgs e)
private void OnSelectedItemChanged(object sender, DependencyPropertyChangedEventArgs e)
=> MainScrollViewer.ScrollToHome();

private void TaskbarIcon_OnTrayLeftMouseUp(object sender, RoutedEventArgs e)
{
this.Visibility = this.Visibility == Visibility.Hidden ? Visibility.Visible : Visibility.Hidden;
}
}
}
10 changes: 10 additions & 0 deletions hygge-imaotai.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@
<None Remove="Resources\ProfilePic.jpg" />
</ItemGroup>

<ItemGroup>
<COMReference Include="{d37e2a3e-8545-3a39-9f4f-31827c9124ab}">
<WrapperTool>tlbimp</WrapperTool>
<VersionMinor>4</VersionMinor>
<VersionMajor>2</VersionMajor>
<Guid>d37e2a3e-8545-3a39-9f4f-31827c9124ab</Guid>
</COMReference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Costura.Fody" Version="5.7.0">
<PrivateAssets>all</PrivateAssets>
Expand All @@ -36,6 +45,7 @@
<PackageReference Include="Flurl.Http" Version="3.2.4" />
<PackageReference Include="FreeSql" Version="3.2.698" />
<PackageReference Include="FreeSql.Provider.Sqlite" Version="3.2.698" />
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="1.1.0" />
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
<PackageReference Include="NLog" Version="5.2.2" />
<PackageReference Include="Quartz" Version="3.6.3" />
Expand Down

0 comments on commit ccf4c34

Please sign in to comment.