Skip to content

Commit 79ea2cd

Browse files
committed
add ip option model, add mybtn style ,add ShowOptionsForSearchIp command
1 parent ed4a725 commit 79ea2cd

File tree

4 files changed

+73
-41
lines changed

4 files changed

+73
-41
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace fast_cf_ip_scanner.Model
8+
{
9+
public class IpOptionModel
10+
{
11+
public IpOptionModel()
12+
{
13+
}
14+
15+
public List<string> Ports { get; set; } = Constants.HttpPorts.Concat(Constants.HttpsPorts).ToList();
16+
17+
public string MaxPingOfIP { get; set; } = "1000";
18+
19+
}
20+
}

fast cf ip scanner/Resources/Styles/Styles.xaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,19 @@
44
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
55
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
66

7-
<Style TargetType="ActivityIndicator">
7+
8+
<Style x:Key="MyButtonStyle" TargetType="Button">
9+
<Setter Property="Background" Value="CornflowerBlue" />
10+
<Setter Property="TextColor" Value="White" />
11+
<Setter Property="Padding" Value="10" />
12+
<Setter Property="FontSize" Value="16" />
13+
</Style>
14+
<Style x:Key="MyBtn" TargetType="Button">
15+
<Setter Property="BackgroundColor" Value="DimGray"/>
16+
<Setter Property="TextColor" Value="GhostWhite"/>
17+
</Style>
18+
19+
<Style TargetType="ActivityIndicator">
820
<Setter Property="Color" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
921
</Style>
1022

fast cf ip scanner/ViewModels/ScanPageViewModel.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ public partial class ScanPageViewModel : BaseViewModel
1010
[ObservableProperty]
1111
ObservableCollection<IPModel> validIPs;
1212

13-
[ObservableProperty]
14-
string maxPingOfIP;
15-
1613

1714
[ObservableProperty]
1815
bool isBusy;
16+
17+
18+
IpOptionModel _ipOption;
1919

2020
readonly IPService _iPServices;
2121
readonly WorkerService _workerServices;
@@ -26,7 +26,7 @@ public ScanPageViewModel(IPService iPServices,WorkerService workerService)
2626
_iPServices = iPServices;
2727
_workerServices = workerService;
2828

29-
maxPingOfIP = "1000";
29+
_ipOption = new IpOptionModel();
3030
}
3131

3232

@@ -45,7 +45,7 @@ async void GetValidIPs()
4545

4646
ValidIPs.Clear();
4747

48-
var maxping = ConvertMaxPingOfIPToInt(MaxPingOfIP);
48+
var maxping = ConvertMaxPingOfIPToInt(_ipOption.MaxPingOfIP);
4949
var ips = await _iPServices.GetIps();
5050
if (ips.Length < 1)
5151
{
@@ -89,6 +89,12 @@ int ConvertMaxPingOfIPToInt(string maxPing)
8989
}
9090

9191
}
92+
[RelayCommand]
93+
async Task ShowOptionsForSearchIp()
94+
{
95+
await App.Current.MainPage.DisplayActionSheet($"What to Do With","c","a","a");
96+
}
97+
9298

9399
[RelayCommand]
94100
async Task ShowSelectedIPOption(IPModel ipModel)

fast cf ip scanner/Views/ScanPage.xaml

Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,45 +11,39 @@
1111
<ContentPage.Resources>
1212
<services:InverseBooleanConverter x:Key="InverseBooleanConverter" />
1313
</ContentPage.Resources>
14-
14+
1515
<ScrollView>
16-
<VerticalStackLayout Padding="10" Spacing="20">
16+
17+
<VerticalStackLayout>
18+
19+
<Grid
20+
ColumnSpacing="10"
21+
IsEnabled="{Binding IsBusy, Converter={StaticResource InverseBooleanConverter}}">
22+
23+
<Grid.ColumnDefinitions>
24+
<ColumnDefinition Width="*" />
25+
<ColumnDefinition Width="*" />
26+
</Grid.ColumnDefinitions>
27+
28+
<Button
29+
Text="Start"
30+
Style="{StaticResource MyBtn}"
31+
Grid.Column="0"
32+
Command="{Binding GetValidIPsCommand}"
33+
/>
1734

18-
<Grid RowDefinitions="1*,1*,100*" ColumnDefinitions=".33*,.33*,.33*" Margin="10">
19-
<Button Text="Start"
20-
IsEnabled="{Binding IsBusy, Converter={StaticResource InverseBooleanConverter}}"
21-
Grid.Column="0"
22-
Grid.Row="0"
23-
Grid.RowSpan="2"
24-
Command="{Binding GetValidIPsCommand}"
25-
HorizontalOptions="FillAndExpand"
26-
VerticalOptions="FillAndExpand" />
27-
<!--<Button Text="Stop"
28-
IsEnabled="{Binding IsBusy}"
29-
IsVisible="{Binding IsBusy}"
30-
Grid.Column="0"
31-
Grid.Row="0"
32-
Grid.RowSpan="2"
33-
Command="{Binding GetValidIPsCommand}"
34-
HorizontalOptions="FillAndExpand"
35-
VerticalOptions="FillAndExpand" />-->
36-
<Label Text="Max ping: "
37-
HorizontalOptions="End"
38-
Grid.Row="0"
39-
Grid.Column="1"
40-
TextColor="White" />
41-
<Label Grid.Column="2"
42-
Grid.Row="0"
43-
Text="{Binding Source={x:Reference numericStepper}, Path=Value}"
44-
TextColor="White" />
45-
<Stepper Increment="100"
46-
Value="{Binding MaxPingOfIP}"
47-
Maximum="10000"
48-
Grid.Column="3"
49-
Grid.Row="1"
50-
x:Name="numericStepper" />
35+
<Button
36+
Text="Options"
37+
Style="{StaticResource MyBtn}"
38+
Grid.Column="1"
39+
Command="{Binding ShowOptionsForSearchIpCommand}"
40+
/>
41+
5142
</Grid>
5243

44+
45+
46+
5347
<CollectionView ItemsSource="{Binding ValidIPs}"
5448
x:Name="validIPCollectionView"
5549
HorizontalOptions="Center"

0 commit comments

Comments
 (0)