Skip to content

Commit ce7ebaa

Browse files
committed
Fixed some issues with DownDetector page (#678)
1 parent 1a209b9 commit ce7ebaa

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

InternetTest/InternetTest/ViewModels/DownDetectorPageViewModel.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public class DownDetectorPageViewModel : ViewModelBase
6666
if (Websites.Any(x => x.Url == Site)) return; // already exists
6767

6868
Websites.Add(new WebsiteItemViewModel(Site, this));
69+
Site = string.Empty;
6970
});
7071

7172
public ICommand TestWebsitesCommand => new RelayCommand(o =>
@@ -130,12 +131,12 @@ public DownDetectorPageViewModel(Settings settings)
130131
{
131132
_settings = settings;
132133
TimeInterval = _settings.DefaultTimeInterval ?? 10;
134+
Websites = [.. _settings.DownDetectorWebsites?.Select(x => new WebsiteItemViewModel(x, this)) ?? []];
133135
Websites.CollectionChanged += (s, e) =>
134136
{
135-
OnPropertyChanged(nameof(HasWebsites));
136137
_settings.DownDetectorWebsites = [.. Websites.Select(x => x.Url)];
137138
_settings.Save();
139+
OnPropertyChanged(nameof(HasWebsites));
138140
};
139-
Websites = [.. _settings.DownDetectorWebsites?.Select(x => new WebsiteItemViewModel(x, this)) ?? []];
140141
}
141142
}

InternetTest/InternetTest/Views/DownDetectorPage.xaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@
7979
Margin="0 5"
8080
Padding="5"
8181
VerticalContentAlignment="Center"
82-
Text="{Binding Site, UpdateSourceTrigger=PropertyChanged}" />
82+
Text="{Binding Site, UpdateSourceTrigger=PropertyChanged}">
83+
<TextBox.InputBindings>
84+
<KeyBinding Key="Enter" Command="{Binding AddWebsiteCommand}" />
85+
</TextBox.InputBindings>
86+
</TextBox>
8387
<StackPanel
8488
Grid.Row="3"
8589
VerticalAlignment="Bottom"

0 commit comments

Comments
 (0)