Skip to content

Commit c02df4c

Browse files
authored
Merge pull request #1 from wuxianao/master
Some easy change
2 parents de4bb18 + b09d466 commit c02df4c

File tree

4 files changed

+84
-40
lines changed

4 files changed

+84
-40
lines changed

CustomTools/Kouyu100AutoFinishWindow.xaml

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,46 @@
77
mc:Ignorable="d"
88
WindowStartupLocation="CenterOwner"
99
Title="Kouyu100" Height="450" Width="800">
10-
<Grid>
11-
<TextBlock HorizontalAlignment="Left" Margin="10,18,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Text="authToken(从网页Cookies中取得): "/>
12-
<TextBox x:Name="AuthTokenTextBox" HorizontalAlignment="Left" Margin="208,14,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="358" Cursor="Arrow"/>
13-
<Button x:Name="GetHomeworkListButton" Content="获取作业列表" Margin="664,10,5,0" VerticalAlignment="Top" Click="GetHomeworkListButton_Click" Background="#FF2196F3"/>
14-
<ListBox x:Name="HomeworkListBox" Margin="10,47,10,10" HorizontalContentAlignment="Stretch">
15-
<ListBox.ItemTemplate>
16-
<DataTemplate>
17-
<Grid>
18-
<Grid.ColumnDefinitions>
19-
<ColumnDefinition Width="*"></ColumnDefinition>
20-
<ColumnDefinition Width="Auto"></ColumnDefinition>
21-
</Grid.ColumnDefinitions>
22-
<TextBlock Grid.Column="0" Text="{Binding Name}"></TextBlock>
23-
<TextBlock Grid.Column="1" Text="{Binding Status}" Foreground="{DynamicResource MaterialDesignLightForeground}">
24-
<TextBlock.Style>
25-
<Style TargetType="TextBlock">
26-
<Setter Property="Background" Value="#FFA7FFA7"></Setter>
27-
<Style.Triggers>
28-
<Trigger Property="Text" Value="未完成">
29-
<Setter Property="Background" Value="#FFFF2649"></Setter>
30-
</Trigger>
31-
</Style.Triggers>
32-
</Style>
33-
</TextBlock.Style>
34-
</TextBlock>
35-
</Grid>
36-
</DataTemplate>
37-
</ListBox.ItemTemplate>
38-
<ListBox.ItemContainerStyle>
39-
<Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource {x:Type ListBoxItem}}">
40-
<EventSetter Event="MouseDoubleClick" Handler="HomeworkListBoxItem_MouseDoubleClick"/>
41-
</Style>
42-
</ListBox.ItemContainerStyle>
43-
</ListBox>
44-
<Button x:Name="InnerWebbrowserLoginButton" Content="内置登录" HorizontalAlignment="Left" Margin="571,10,0,0" VerticalAlignment="Top" Click="InnerWebbrowserLoginButton_Click" Cursor="Hand"/>
45-
</Grid>
10+
<Grid>
11+
<TextBlock HorizontalAlignment="Left" Margin="10,63,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Text="authToken(从网页Cookies中取得): " Height="20" Width="190" RenderTransformOrigin="0.5,-0.212"/>
12+
<TextBox x:Name="AuthTokenTextBox" InputMethod.IsInputMethodEnabled="True" HorizontalAlignment="Left" Margin="203,59,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="330" Cursor="Arrow"/>
13+
<Button x:Name="GetHomeworkListButton" IsEnabled="False" Opacity="0.5" Content="获取作业列表" Margin="650,50,10,0" VerticalAlignment="Top" Click="GetHomeworkListButton_Click" Background="#FF2196F3" Cursor="Hand"/>
14+
<ListBox x:Name="HomeworkListBox" Margin="10,88,10,10" HorizontalContentAlignment="Stretch" >
15+
<ListBox.ItemTemplate>
16+
<DataTemplate>
17+
<Grid>
18+
<Grid.ColumnDefinitions>
19+
<ColumnDefinition Width="*"></ColumnDefinition>
20+
<ColumnDefinition Width="Auto"></ColumnDefinition>
21+
</Grid.ColumnDefinitions>
22+
<TextBlock Grid.Column="0" Text="{Binding Name}"></TextBlock>
23+
<TextBlock Grid.Column="1" Text="{Binding Status}" Foreground="{DynamicResource MaterialDesignLightForeground}">
24+
<TextBlock.Style>
25+
<Style TargetType="TextBlock">
26+
<Setter Property="Background" Value="#FFA7FFA7"></Setter>
27+
<Style.Triggers>
28+
<Trigger Property="Text" Value="未完成">
29+
<Setter Property="Background" Value="#FFFF2649"></Setter>
30+
</Trigger>
31+
</Style.Triggers>
32+
</Style>
33+
</TextBlock.Style>
34+
</TextBlock>
35+
</Grid>
36+
</DataTemplate>
37+
</ListBox.ItemTemplate>
38+
<ListBox.ItemContainerStyle>
39+
<Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource {x:Type ListBoxItem}}">
40+
<EventSetter Event="MouseDoubleClick" Handler="HomeworkListBoxItem_MouseDoubleClick"/>
41+
</Style>
42+
</ListBox.ItemContainerStyle>
43+
<Button Content="Button"/>
44+
</ListBox>
45+
<Button x:Name="InnerWebbrowserLoginButton" Content="内置登录" HorizontalAlignment="Left" Margin="551,51,0,0" VerticalAlignment="Top" Click="InnerWebbrowserLoginButton_Click" Cursor="Hand" Height="31" Width="94" RenderTransformOrigin="0.585,-0.75"/>
46+
<Grid HorizontalAlignment="Center" Height="35" Margin="0,10,0,0" VerticalAlignment="Top" Width="780" Cursor="Hand">
47+
<Label Content="口语100一键开摆" HorizontalAlignment="Left" Height="25" Margin="0,10,0,0" VerticalAlignment="Top" Width="210" Background="White" Foreground="#DD100000"/>
48+
49+
<Button x:Name="Clear_state" Content="清除" Margin="670,2,10,1" Background="#FF2196F3" Cursor="Hand" Click="Clear_state_Click"/>
50+
</Grid>
51+
</Grid>
4652
</Window>

CustomTools/Kouyu100AutoFinishWindow.xaml.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ public string Kouyu100HttpPost(string Url, string postDataStr)
8989
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型。
9090
#pragma warning disable CS8602 // 解引用可能出现空引用。
9191
#pragma warning disable CS8604 // 引用类型参数可能为 null。
92+
static bool isOver = true;
9293
private void GetHomeworkListButton_Click(object sender, RoutedEventArgs e)
9394
{
95+
isOver = false;
9496
Task.Run(delegate
9597
{
9698
GetHomeworkListButton.Dispatcher.BeginInvoke(new Action(delegate
@@ -153,7 +155,9 @@ private void GetHomeworkListButton_Click(object sender, RoutedEventArgs e)
153155
{
154156
GetHomeworkListButton.IsEnabled = true;
155157
}));
158+
156159
});
160+
isOver = true;
157161
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型。
158162
#pragma warning restore CS8602 // 解引用可能出现空引用。
159163
#pragma warning restore CS8604 // 引用类型参数可能为 null。
@@ -176,6 +180,34 @@ private void InnerWebbrowserLoginButton_Click(object sender, RoutedEventArgs e)
176180
MessageBox.Show("请在接下来弹出的窗口内登录, 登陆成功后关闭即可");
177181
kouyu100AutoFinishInnerWindowLoginWebbrowserWindow.ShowDialog();
178182
AuthTokenTextBox.Text = kouyu100AutoFinishInnerWindowLoginWebbrowserWindow.GetAuthToken();
183+
if (AuthTokenTextBox.Text != "")
184+
{
185+
AuthTokenTextBox.IsEnabled = false;
186+
GetHomeworkListButton.IsEnabled = true;
187+
GetHomeworkListButton.Opacity = 1;
188+
}
189+
}
190+
191+
private void Clear_state_Click(object sender, RoutedEventArgs e)
192+
{
193+
if (isOver)
194+
{
195+
AuthTokenTextBox.IsEnabled = true;
196+
GetHomeworkListButton.IsEnabled = false;
197+
GetHomeworkListButton.Opacity = 0.5;
198+
for (int index = 0; index < 10; index++)
199+
{
200+
for (int i = 0; i < HomeworkListBox.Items.Count; i++)
201+
{
202+
HomeworkListBox.Items.RemoveAt(i);
203+
}
204+
}
205+
206+
}
207+
else
208+
{
209+
MessageBox.Show("正在读取中,无法关闭");
210+
}
179211
}
180212
}
181213
}

CustomTools/MainWindow.xaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@
1515
TextElement.FontSize="14"
1616
WindowStartupLocation="CenterScreen"
1717
Title="MainWindow" Height="450" Width="800">
18-
<Grid>
19-
<Button x:Name="SchoolDataButton" Content="信息课数据" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Click="SchoolDataButtonClick"/>
20-
<Button x:Name="Kouyu100Button" Content="口语100一键开摆" HorizontalAlignment="Left" Margin="130,10,0,0" VerticalAlignment="Top" Cursor="Hand" Click="Kouyu100Button_Click"/>
18+
<Grid>
19+
<Button x:Name="SchoolDataButton" Content="信息课数据" HorizontalAlignment="Left" Margin="10,75,0,0" VerticalAlignment="Top" Click="SchoolDataButtonClick"/>
20+
<Button x:Name="Kouyu100Button" Content="口语100一键开摆" HorizontalAlignment="Left" Margin="134,75,0,0" VerticalAlignment="Top" Cursor="Hand" Click="Kouyu100Button_Click"/>
21+
<Grid HorizontalAlignment="Left" Height="45" Margin="10,10,0,0" VerticalAlignment="Top" Width="770">
22+
<Label Content="Custom Tools" HorizontalAlignment="Left" Height="30" Margin="10,0,0,0" VerticalAlignment="Center" Width="130" FontSize="16"/>
23+
</Grid>
2124

22-
</Grid>
25+
</Grid>
2326
</Window>

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# CustomTools
2+
A tool can solve question about kouyu100 homework.
3+
Students in jzhx can use tools to save time.

0 commit comments

Comments
 (0)