@@ -15,8 +15,11 @@ public partial class IpOptionViewModel : BaseViewModel
1515 IpOptionModel _ipOptions ;
1616
1717 [ ObservableProperty ]
18- ObservableCollection < PortForShow > ports ;
19-
18+ ObservableCollection < PortForShow > httpPorts ;
19+
20+ [ ObservableProperty ]
21+ ObservableCollection < PortForShow > httpsPorts ;
22+
2023 [ ObservableProperty ]
2124 int maxPingOfIP ;
2225
@@ -35,7 +38,8 @@ public partial class IpOptionViewModel : BaseViewModel
3538
3639 public IpOptionViewModel ( )
3740 {
38- ports = new ObservableCollection < PortForShow > ( ) ;
41+ httpPorts = new ObservableCollection < PortForShow > ( ) ;
42+ httpsPorts = new ObservableCollection < PortForShow > ( ) ;
3943 }
4044
4145 [ ObservableProperty ]
@@ -47,11 +51,16 @@ protected override void OnPropertyChanged(PropertyChangedEventArgs e)
4751 base . OnPropertyChanged ( e ) ;
4852 if ( e . PropertyName == "IpOptions" && ! saved )
4953 {
50- var allPorts = Constants . HttpPorts . Concat ( Constants . HttpsPorts ) ;
54+ var allHttpPorts = Constants . HttpPorts ;
55+ var allHttpsPorts = Constants . HttpsPorts ;
5156 var selectedPort = IpOptions . Ports ;
52- foreach ( var port in allPorts )
57+ foreach ( var port in allHttpPorts )
5358 {
54- Ports . Add ( new PortForShow ( port , selectedPort . Any ( p => p == port ) ) ) ;
59+ HttpPorts . Add ( new PortForShow ( port , selectedPort . Any ( p => p == port ) ) ) ;
60+ }
61+ foreach ( var port in allHttpsPorts )
62+ {
63+ HttpsPorts . Add ( new PortForShow ( port , selectedPort . Any ( p => p == port ) ) ) ;
5564 }
5665 MaxPingOfIP = IpOptions . MaxPingOfIP ;
5766 MinimumCountOfValidIp = IpOptions . MinimumCountOfValidIp ;
@@ -66,7 +75,8 @@ async void Save()
6675 {
6776 saved = true ;
6877 IpOptions . Ports . Clear ( ) ;
69- IpOptions . Ports . AddRange ( Ports . Where ( p => p . IsChecked ) . Select ( p => p . Port ) ) ;
78+ IpOptions . Ports . AddRange ( HttpPorts . Where ( p => p . IsChecked ) . Select ( p => p . Port ) ) ;
79+ IpOptions . Ports . AddRange ( HttpsPorts . Where ( p => p . IsChecked ) . Select ( p => p . Port ) ) ;
7080 if ( IpOptions . Ports . Count == 0 )
7181 {
7282 IpOptions . Ports . AddRange ( GetRandomPort ( ) ) ;
@@ -129,7 +139,8 @@ async void Save()
129139
130140 if ( saved )
131141 {
132- totalTestForEachIp = CountOfRepeatTestForEachIp * ( Ports . Where ( p=> p . IsChecked ) ) . Count ( ) ;
142+ var countSelectedOfPorts = HttpPorts . Where ( p => p . IsChecked ) . Count ( ) + HttpsPorts . Where ( p => p . IsChecked ) . Count ( ) ;
143+ totalTestForEachIp = CountOfRepeatTestForEachIp * countSelectedOfPorts ;
133144 var countOfIpInEachRange = CountOfIpForTest / CountOfIpRanges ;
134145
135146 await App . Current . MainPage . DisplayAlert ( "Info" , $ "{ CountOfIpForTest } ips in { CountOfIpRanges } ranges will be tested { totalTestForEachIp } times", "ok" ) ;
@@ -150,8 +161,5 @@ public string[] GetRandomPort(int count = 3)
150161 return randomPorts ;
151162 }
152163
153- public void UpdateVar ( )
154- {
155- totalTestForEachIp = CountOfRepeatTestForEachIp * ( Ports . Where ( p => p . IsChecked ) ) . Count ( ) ;
156- }
164+
157165}
0 commit comments