Started work on help overlay.
parent
b2e7b8ac7c
commit
1de5395624
|
@ -10,10 +10,11 @@
|
|||
PreviewMouseDown="Window_PreviewMouseDown"
|
||||
Icon="pack://application:,,,/Resources/Wireless-04.ico"
|
||||
Title="WifiSitter Config"
|
||||
KeyUp="MainWindow_KeyUp"
|
||||
SizeToContent="Height"
|
||||
MinHeight="450"
|
||||
Height="600"
|
||||
Width="525" KeyUp="MainWindow_KeyUp">
|
||||
Width="525" >
|
||||
|
||||
<Window.DataContext>
|
||||
<vm:MainWindowViewModel/>
|
||||
|
@ -188,7 +189,7 @@
|
|||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Column="0"
|
||||
<Label x:Name="StatusLabels" Grid.Column="0"
|
||||
Grid.Row="0">
|
||||
Service Status:
|
||||
</Label>
|
||||
|
@ -222,7 +223,8 @@
|
|||
</Label>
|
||||
</Grid>
|
||||
|
||||
<Label Content="Wired Interfaces"
|
||||
<Label x:Name="WiredInterfaceList"
|
||||
Content="Wired Interfaces"
|
||||
FontWeight="Bold"/>
|
||||
|
||||
<ListBox x:Name="ListWiredNics"
|
||||
|
@ -230,14 +232,16 @@
|
|||
ItemTemplate="{StaticResource InterfaceTemplate}"
|
||||
ItemsSource="{Binding WiredNics, Mode=OneWay}" />
|
||||
|
||||
<Label Content="Wireless Interfaces"
|
||||
<Label x:Name="WirelessInterfaceList"
|
||||
Content="Wireless Interfaces"
|
||||
FontWeight="Bold"/>
|
||||
<ListBox x:Name="ListWirelessNics"
|
||||
Grid.Row="2"
|
||||
ItemTemplate="{StaticResource InterfaceTemplate}"
|
||||
ItemsSource="{Binding WirelessNics, Mode=OneWay}" />
|
||||
|
||||
<Label Content="Whitelisted Interfaces"
|
||||
<Label x:Name="WhitelistedInterfaceList"
|
||||
Content="Whitelisted Interfaces"
|
||||
FontWeight="Bold" ToolTip="Disabled interfaces may not show in this list."/>
|
||||
<ListBox x:Name="DataGridIgnoredNics"
|
||||
Grid.Row="3"
|
||||
|
@ -258,14 +262,17 @@
|
|||
HorizontalContentAlignment="Stretch"
|
||||
ExpandDirection="Up"
|
||||
Background="White"
|
||||
Margin="2,0"
|
||||
Margin="0"
|
||||
ToolTip="Whitelist entries from system registry.">
|
||||
<Expander.Header>
|
||||
<Label Content="Whitelist Entries"
|
||||
FontWeight="Bold"/>
|
||||
</Expander.Header>
|
||||
<Expander.Effect>
|
||||
<DropShadowEffect ShadowDepth="4"/>
|
||||
<DropShadowEffect ShadowDepth="1"
|
||||
Direction="90"
|
||||
RenderingBias="Performance">
|
||||
</DropShadowEffect>
|
||||
</Expander.Effect>
|
||||
<Expander.Content>
|
||||
<Grid>
|
||||
|
|
|
@ -46,17 +46,73 @@ namespace WifiSitterGui
|
|||
private void MainWindow_KeyUp(object sender, KeyEventArgs e) {
|
||||
switch (e.Key) {
|
||||
case Key.F1:
|
||||
if (_about == null) {
|
||||
_about = new WifiSitterGui.View.About();
|
||||
_about.Closed += (s, args) => { _about = null; };
|
||||
_about.Show();
|
||||
}
|
||||
else {
|
||||
_about.WindowState = WindowState.Normal;
|
||||
_about.Activate();
|
||||
}
|
||||
ShowHelp();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ShowHelp() {
|
||||
|
||||
var bubbleWindow = new View.HelpBubbleWindow();
|
||||
if (Left < bubbleWindow.Width) Left = bubbleWindow.Width + 10;
|
||||
|
||||
var statusPoint = StatusLabels.TransformToAncestor(this)
|
||||
.Transform(new Point(0, 0));
|
||||
var wiredPoint = WiredInterfaceList.TransformToAncestor(this)
|
||||
.Transform(new Point(0, 0));
|
||||
var wirelessPoint = WirelessInterfaceList.TransformToAncestor(this)
|
||||
.Transform(new Point(0, 0));
|
||||
var whitelistListPoint = WhitelistedInterfaceList.TransformToAncestor(this)
|
||||
.Transform(new Point(0, 0));
|
||||
var whitelistExpanderPoint = WhitelistExpander.TransformToAncestor(this)
|
||||
.Transform(new Point(0, 0));
|
||||
|
||||
var stdMargin = new Thickness(0, 4, 0, 4);
|
||||
|
||||
// Status Help
|
||||
var statusHelp = new View.HelpBubble();
|
||||
statusHelp.TriangleVirt(VerticalAlignment.Bottom);
|
||||
statusHelp.HorizontalAlignment = HorizontalAlignment.Right;
|
||||
statusHelp.Margin = stdMargin;
|
||||
statusHelp.Height = wiredPoint.Y - 4;
|
||||
bubbleWindow.AddContentControl(statusHelp);
|
||||
Canvas.SetTop(statusHelp, statusPoint.Y - 16);
|
||||
|
||||
// Wired Interface Help
|
||||
var wiredHelp = new View.HelpBubble();
|
||||
wiredHelp.HorizontalAlignment = HorizontalAlignment.Right;
|
||||
wiredHelp.Margin = stdMargin;
|
||||
wiredHelp.Height = wirelessPoint.Y - wiredPoint.Y - 4;
|
||||
bubbleWindow.AddContentControl(wiredHelp);
|
||||
Canvas.SetTop(wiredHelp, wiredPoint.Y + 10);
|
||||
|
||||
// Wireless Interface Help
|
||||
var wirelessHelp = new View.HelpBubble();
|
||||
wirelessHelp.HorizontalAlignment = HorizontalAlignment.Right;
|
||||
wirelessHelp.Margin = stdMargin;
|
||||
wirelessHelp.Height = whitelistListPoint.Y - wirelessPoint.Y - 4;
|
||||
bubbleWindow.AddContentControl(wirelessHelp);
|
||||
Canvas.SetTop(wirelessHelp, wirelessPoint.Y + 10);
|
||||
|
||||
// Whitelist Interface Help
|
||||
var whitelistListsHelp = new View.HelpBubble();
|
||||
whitelistListsHelp.HorizontalAlignment = HorizontalAlignment.Right;
|
||||
whitelistListsHelp.Margin = stdMargin;
|
||||
whitelistListsHelp.Height = whitelistExpanderPoint.Y - whitelistListPoint.Y - 10;
|
||||
bubbleWindow.AddContentControl(whitelistListsHelp);
|
||||
Canvas.SetTop(whitelistListsHelp, whitelistListPoint.Y + 10);
|
||||
|
||||
// Whitelist Expander Help
|
||||
var whitelistHelp = new View.HelpBubble();
|
||||
whitelistHelp.HorizontalAlignment = HorizontalAlignment.Right;
|
||||
whitelistHelp.Margin = stdMargin;
|
||||
|
||||
|
||||
bubbleWindow.Height = Height + 48;
|
||||
bubbleWindow.Top = Top + 15;
|
||||
bubbleWindow.Left = Left - bubbleWindow.Width + 10;
|
||||
bubbleWindow.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<UserControl x:Class="WifiSitterGui.View.HelpBubble"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:WifiSitterGui.View"
|
||||
mc:Ignorable="d"
|
||||
MinHeight="60"
|
||||
Height="60"
|
||||
Width="275">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="20"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border Grid.Column="0"
|
||||
BorderThickness="4"
|
||||
Padding="8"
|
||||
BorderBrush="#007ACC"
|
||||
Background="White">
|
||||
</Border>
|
||||
|
||||
<Polygon x:Name="Arrow"
|
||||
Grid.Column="1"
|
||||
Margin="0,4"
|
||||
Points="0,0 20,15, 0,30"
|
||||
Stroke="#007ACC"
|
||||
Fill="#007ACC" />
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace WifiSitterGui.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for HelpBubble.xaml
|
||||
/// </summary>
|
||||
public partial class HelpBubble : UserControl
|
||||
{
|
||||
public HelpBubble() {
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void TriangleVirt(VerticalAlignment Pos) {
|
||||
Arrow.VerticalAlignment = Pos;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<Window x:Class="WifiSitterGui.View.HelpBubbleWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:WifiSitterGui.View"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent"
|
||||
mc:Ignorable="d"
|
||||
Title="HelpBubbleWindow"
|
||||
Width="280">
|
||||
<Canvas x:Name="MainCanvas"
|
||||
Height="Auto"
|
||||
Width="Auto">
|
||||
|
||||
</Canvas>
|
||||
</Window>
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace WifiSitterGui.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for HelpBubbleWindow.xaml
|
||||
/// </summary>
|
||||
public partial class HelpBubbleWindow : Window
|
||||
{
|
||||
public HelpBubbleWindow() {
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
public void AddContentControl(UserControl control) {
|
||||
MainCanvas.Children.Add(control);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
using System.ComponentModel;
|
||||
|
||||
namespace WifiSitterGui
|
||||
namespace WifiSitterGui.ViewModel
|
||||
{
|
||||
public class MvvmObservable : INotifyPropertyChanged, INotifyPropertyChanging
|
||||
{
|
|
@ -112,6 +112,12 @@
|
|||
<Compile Include="View\About.xaml.cs">
|
||||
<DependentUpon>About.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\HelpBubble.xaml.cs">
|
||||
<DependentUpon>HelpBubble.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\HelpBubbleWindow.xaml.cs">
|
||||
<DependentUpon>HelpBubbleWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
@ -132,10 +138,18 @@
|
|||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="View\HelpBubble.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="View\HelpBubbleWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ViewModel\MainWindowViewModel.cs" />
|
||||
<Compile Include="MvvmObservable.cs" />
|
||||
<Compile Include="ViewModel\MvvmObservable.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
|
Loading…
Reference in New Issue