Moved whitelist entries to expander and only refreshing state on address changed since it is fired when availability changed is fired.

zmq
Sean McArdle 2016-12-27 13:01:24 -08:00
parent 6d355009af
commit 4da5800395
3 changed files with 48 additions and 19 deletions

View File

@ -7,9 +7,11 @@
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:vm="clr-namespace:WifiSitterGui.ViewModel"
mc:Ignorable="d"
PreviewMouseDown="Window_PreviewMouseDown"
Icon="pack://application:,,,/Resources/Wireless-04.ico"
Title="WifiSitter Config"
SizeToContent="Height"
MinHeight="450"
Height="600"
Width="525">
@ -202,23 +204,6 @@
ItemTemplate="{StaticResource WhitelistedInterfaceTemplate}"
ItemsSource="{Binding IgnoredNics, Mode=OneWay}"
ToolTip="Disabled interfaces may not show in this list."/>
<Label Content="Whitelist"
FontWeight="Bold"/>
<Grid>
<ListBox x:Name="IgnoredNicsList"
ItemsSource="{Binding Whitelist, Mode=OneWay}" />
<Button Margin="4"
Height="32"
Width="32"
Padding="-1"
ToolTip="Reload whitelist"
Command="{Binding ReloadWhitelist}"
HorizontalAlignment="Right"
VerticalAlignment="Top">
<ContentControl Content="{StaticResource RefreshIcon}"/>
</Button>
</Grid>
</StackPanel>
</TabItem>
@ -228,6 +213,46 @@
</TabControl>
<Expander x:Name="WhitelistExpander"
VerticalAlignment="Bottom"
HorizontalContentAlignment="Stretch"
ExpandDirection="Up"
Background="White"
Margin="2,0"
ToolTip="Whitelist entries from system registry.">
<Expander.Header>
<Label Content="Whitelist Entries"
FontWeight="Bold"/>
</Expander.Header>
<Expander.Effect>
<DropShadowEffect ShadowDepth="4"/>
</Expander.Effect>
<Expander.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ListBox x:Name="IgnoredNicsList"
ItemsSource="{Binding Whitelist, Mode=OneWay}" />
<Button Margin="4"
Height="32"
Width="32"
Padding="-1"
ToolTip="Refresh Whitelist"
Command="{Binding ReloadWhitelist}"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Grid.RowSpan="2">
<Button.Effect>
<DropShadowEffect ShadowDepth="1"/>
</Button.Effect>
<ContentControl Content="{StaticResource RefreshIcon}"/>
</Button>
</Grid>
</Expander.Content>
</Expander>
<Button x:Name="Btn_About"
HorizontalAlignment="Right"
VerticalAlignment="Top"

View File

@ -36,5 +36,10 @@ namespace WifiSitterGui
_about.Activate();
}
}
private void Window_PreviewMouseDown(object sender, MouseButtonEventArgs e) {
var vis = e.OriginalSource as Visual;
if (!vis.IsDescendantOf(WhitelistExpander)) WhitelistExpander.IsExpanded = false;
}
}
}

View File

@ -67,8 +67,7 @@ namespace WifiSitterGui.ViewModel
_netstateCheckTimer.Start();
// Connection state changed event handler setup
NetworkChange.NetworkAvailabilityChanged += (o, e) => { RequestNetworkState(3 * 1000); };
NetworkChange.NetworkAddressChanged += (o, e) => { RequestNetworkState(3 * 1000); };
NetworkChange.NetworkAddressChanged += (o, e) => { RequestNetworkState(3 * 1000); RequestNetworkState(5 * 1000); };
Trace.WriteLine(String.Format("WifiSitter service msg channel: {0}", ServiceChannelName));
}