Help now closes with additional F1 press.
parent
1de5395624
commit
ca4512a6ce
|
@ -20,6 +20,7 @@ namespace WifiSitterGui
|
|||
public partial class MainWindow : Window
|
||||
{
|
||||
private Window _about;
|
||||
private View.HelpBubbleWindow bubbleWindow;
|
||||
|
||||
public MainWindow() {
|
||||
InitializeComponent();
|
||||
|
@ -53,66 +54,74 @@ namespace WifiSitterGui
|
|||
|
||||
|
||||
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)
|
||||
if (bubbleWindow == null) {
|
||||
bubbleWindow = new View.HelpBubbleWindow();
|
||||
bubbleWindow.Closed += (o, e) => { bubbleWindow = null; };
|
||||
|
||||
if (Left < bubbleWindow.Width) Left = bubbleWindow.Width + 10;
|
||||
|
||||
var statusPoint = StatusLabels.TransformToAncestor(this)
|
||||
.Transform(new Point(0, 0));
|
||||
var wirelessPoint = WirelessInterfaceList.TransformToAncestor(this)
|
||||
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 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);
|
||||
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);
|
||||
// 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);
|
||||
// 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);
|
||||
// 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 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;
|
||||
// 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();
|
||||
}
|
||||
else {
|
||||
bubbleWindow.Close();
|
||||
bubbleWindow = null;
|
||||
}
|
||||
|
||||
|
||||
bubbleWindow.Height = Height + 48;
|
||||
bubbleWindow.Top = Top + 15;
|
||||
bubbleWindow.Left = Left - bubbleWindow.Width + 10;
|
||||
bubbleWindow.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:WifiSitterGui.View"
|
||||
WindowStyle="None"
|
||||
KeyUp="Window_KeyUp"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent"
|
||||
mc:Ignorable="d"
|
||||
|
|
|
@ -27,5 +27,10 @@ namespace WifiSitterGui.View
|
|||
public void AddContentControl(UserControl control) {
|
||||
MainCanvas.Children.Add(control);
|
||||
}
|
||||
|
||||
private void Window_KeyUp(object sender, KeyEventArgs e) {
|
||||
if (e.Key == Key.Escape ||
|
||||
e.Key == Key.F1) this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue