Skip to content

Commit

Permalink
find one combination button
Browse files Browse the repository at this point in the history
  • Loading branch information
Prevter committed Apr 21, 2022
1 parent 613c2ce commit 2285751
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
12 changes: 10 additions & 2 deletions FloatTool/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,16 @@
Foreground="{DynamicResource MainForeground}"
FontSize="14" IsChecked="{Binding SortDescending}"/>

<Button x:Name="StartButton" Content="{DynamicResource m_Start}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="260,48,0,0" Width="150" Height="60" FontSize="32" Style="{DynamicResource MainButtonStyle}" Click="StartSearchButton_Click"/>
<Button IsEnabled="{Binding CanEditSettings}" Content="{DynamicResource m_FindOne}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="260,109,0,0" Width="150" Height="24" FontSize="14" Style="{DynamicResource MainButtonStyle}"/>
<Button x:Name="StartButton" Content="{DynamicResource m_Start}"
HorizontalAlignment="Left" VerticalAlignment="Top"
Margin="260,48,0,0" Width="150" Height="60" FontSize="32"
Style="{DynamicResource MainButtonStyle}"
Click="StartSearchButton_Click"/>
<Button IsEnabled="{Binding CanEditSettings}" Content="{DynamicResource m_FindOne}"
HorizontalAlignment="Left" VerticalAlignment="Top" Margin="260,109,0,0"
Width="150" Height="24" FontSize="14"
Style="{DynamicResource MainButtonStyle}"
Click="StartSearchButton_Click" x:Name="FindOneButton"/>
</Grid>

<ProgressBar Grid.Row="2" Value="{Binding ProgressPercentage}" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Height="28" Background="{DynamicResource ProgressBackground}" BorderThickness="0" Foreground="{DynamicResource ProgressFill}"/>
Expand Down
8 changes: 8 additions & 0 deletions FloatTool/Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ private void FloatCraftWorkerThread(CraftSearchSetup options)

private void StartSearchButton_Click(object sender, RoutedEventArgs e)
{
bool stopAfterHit = (sender as Button).Name == "FindOneButton";

if (ViewModel.CanEditSettings)
{
ViewModel.FoundCombinations.Clear();
Expand Down Expand Up @@ -413,6 +415,12 @@ private void StartSearchButton_Click(object sender, RoutedEventArgs e)
if (!isAnyRunning)
break;

if (stopAfterHit && ViewModel.FoundCombinations.Count >= 1)
{
TokenSource.Cancel();
break;
}

Thread.Sleep(100);
}

Expand Down

0 comments on commit 2285751

Please sign in to comment.