v1.2
This commit is contained in:
34
FSI.BT.Tools/RadialMenu/Buisness/App.cs
Normal file
34
FSI.BT.Tools/RadialMenu/Buisness/App.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
// <copyright file="App.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// </copyright>
|
||||
namespace FSI.BT.Tools.RadialMenu
|
||||
{
|
||||
using System;
|
||||
using Microsoft.Win32;
|
||||
using FSI.BT.Tools.Global.Utilities;
|
||||
using FSI.BT.Tools.RadialMenu.Business;
|
||||
|
||||
/// <summary>
|
||||
/// App contains the notifyicon, the taskbarform and the menus.
|
||||
/// </summary>
|
||||
internal class App : IDisposable
|
||||
{
|
||||
private readonly Main menus = new();
|
||||
|
||||
public App()
|
||||
{
|
||||
AppRestart.BeforeRestarting += Dispose;
|
||||
SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void SystemEvents_DisplaySettingsChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
59
FSI.BT.Tools/RadialMenu/Buisness/KeyboardInput.cs
Normal file
59
FSI.BT.Tools/RadialMenu/Buisness/KeyboardInput.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
// <copyright file="KeyboardInput.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace FSI.BT.Tools.RadialMenu.Handler
|
||||
{
|
||||
using FSI.BT.Tools.RadialMenu.Helper;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
internal class KeyboardInput : IDisposable
|
||||
{
|
||||
|
||||
private readonly KeyboardHook hook = new();
|
||||
|
||||
|
||||
|
||||
public KeyboardInput()
|
||||
{
|
||||
}
|
||||
|
||||
public event Action HotKeyPressed;
|
||||
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
hook.KeyPressed -= Hook_KeyPressed;
|
||||
hook.Dispose();
|
||||
}
|
||||
|
||||
public void RegisterHotKey()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Global.Vars.RadialMenuSettings.HotKey))
|
||||
{
|
||||
try
|
||||
{
|
||||
hook.RegisterHotKey();
|
||||
hook.KeyPressed += Hook_KeyPressed;
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
//Log.Warn($"key:'{Properties.Settings.Default.HotKey}'", ex);
|
||||
Global.Vars.RadialMenuSettings.HotKey = string.Empty;
|
||||
//Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Hook_KeyPressed(object sender, KeyPressedEventArgs e)
|
||||
{
|
||||
HotKeyPressed?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
59
FSI.BT.Tools/RadialMenu/Buisness/Main.cs
Normal file
59
FSI.BT.Tools/RadialMenu/Buisness/Main.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
namespace FSI.BT.Tools.RadialMenu.Business
|
||||
{
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using FSI.BT.Tools.RadialMenu.Handler;
|
||||
using FSI.Lib.Wpf.ExtensionMethods;
|
||||
|
||||
internal class Main : IDisposable
|
||||
{
|
||||
|
||||
private readonly KeyboardInput keyboardInput;
|
||||
private UserInterface.FrmRadialMenu frmRadialMenu;
|
||||
public Main()
|
||||
{
|
||||
keyboardInput = new();
|
||||
keyboardInput.RegisterHotKey();
|
||||
keyboardInput.HotKeyPressed += KeyboardInput_HotKeyPressed;
|
||||
|
||||
frmRadialMenu = new UserInterface.FrmRadialMenu();
|
||||
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
keyboardInput.HotKeyPressed -= KeyboardInput_HotKeyPressed;
|
||||
keyboardInput.Dispose();
|
||||
}
|
||||
|
||||
private void KeyboardInput_HotKeyPressed()
|
||||
{
|
||||
|
||||
|
||||
Thread thread = new(() =>
|
||||
{
|
||||
UserInterface.FrmRadialMenu frmRadialMenu = new();
|
||||
|
||||
if (Global.Vars.UserRights || Global.Vars.AdminRights)
|
||||
{
|
||||
if (frmRadialMenu.Visibility == Visibility.Collapsed)
|
||||
{
|
||||
frmRadialMenu.ShowCenteredToMouse();
|
||||
frmRadialMenu.ActivateCenteredToMouse();
|
||||
|
||||
}
|
||||
|
||||
frmRadialMenu.Closed += (sender2, e2) => frmRadialMenu.Dispatcher.InvokeShutdown();
|
||||
|
||||
System.Windows.Threading.Dispatcher.Run();
|
||||
}
|
||||
});
|
||||
|
||||
thread.SetApartmentState(ApartmentState.STA);
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
443
FSI.BT.Tools/RadialMenu/Buisness/MainViewModel.cs
Normal file
443
FSI.BT.Tools/RadialMenu/Buisness/MainViewModel.cs
Normal file
@@ -0,0 +1,443 @@
|
||||
using FSI.BT.Tools.Global.Helpers;
|
||||
using FSI.BT.Tools.RadialMenu.Provider;
|
||||
using FSI.Lib.MVVM;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace FSI.BT.Tools.RadialMenu
|
||||
{
|
||||
public class MainViewModel : ViewModelBase
|
||||
{
|
||||
public MainViewModel(Window win, List<string> cmds)
|
||||
{
|
||||
_window = win;
|
||||
_window.Deactivated += _window_Deactivated;
|
||||
_isOpenHome = true;
|
||||
|
||||
Cmds = new();
|
||||
|
||||
if (cmds != null)
|
||||
{
|
||||
foreach (string cmd in cmds)
|
||||
Cmds.Add(cmd);
|
||||
}
|
||||
|
||||
Provider = new(ref _cmds);
|
||||
}
|
||||
|
||||
|
||||
private ObservableCollection<string> _cmds;
|
||||
|
||||
public ObservableCollection<string> Cmds
|
||||
{
|
||||
get { return _cmds; }
|
||||
set
|
||||
{
|
||||
_cmds = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private CmdProvider _cmdProvider;
|
||||
|
||||
public CmdProvider Provider
|
||||
{
|
||||
get { return _cmdProvider; }
|
||||
set { _cmdProvider = value; }
|
||||
}
|
||||
|
||||
|
||||
private string _cmd;
|
||||
|
||||
public string Cmd
|
||||
{
|
||||
get { return _cmd; }
|
||||
set
|
||||
{
|
||||
_cmd = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Window _window;
|
||||
|
||||
public Window Window
|
||||
{
|
||||
get { return _window; }
|
||||
set { _window = value; }
|
||||
}
|
||||
|
||||
#region Home
|
||||
private bool _isOpenHome = true;
|
||||
public bool IsOpenHome
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isOpenHome;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isOpenHome = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand CloseRadialMenuHome
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand(() => _window.Visibility = Visibility.Hidden);
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand OpenRadialMenuHome
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand(() =>
|
||||
{
|
||||
IsOpenHome = true;
|
||||
IsOpenEpl =
|
||||
IsOpenTools =
|
||||
IsOpenSie =
|
||||
IsOpenApps =
|
||||
IsOpenPlantLinksPl1 =
|
||||
IsOpenPlantLinksPl2 =
|
||||
IsOpenPlantLinksPl3 =
|
||||
IsOpenAppsVncRdp =
|
||||
IsOpenLinks = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Epl
|
||||
|
||||
private bool _isOpenEpl = false;
|
||||
public bool IsOpenEpl
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isOpenEpl;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isOpenEpl = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand OpenRadialMenuEpl
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand(() =>
|
||||
{
|
||||
IsOpenEpl = true;
|
||||
IsOpenHome = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Tools
|
||||
|
||||
private bool _isOpenTools = false;
|
||||
public bool IsOpenTools
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isOpenTools;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isOpenTools = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand OpenRadialMenuTools
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand(() =>
|
||||
{
|
||||
IsOpenTools = true;
|
||||
IsOpenHome = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Siemens
|
||||
|
||||
private bool _isOpenSie = false;
|
||||
public bool IsOpenSie
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isOpenSie;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isOpenSie = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand OpenRadialMenuSie
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand(() =>
|
||||
{
|
||||
IsOpenSie = true;
|
||||
IsOpenHome = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Links
|
||||
|
||||
private bool _isOpenLinks = false;
|
||||
public bool IsOpenLinks
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isOpenLinks;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isOpenLinks = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand OpenRadialMenuLinks
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand(() =>
|
||||
{
|
||||
IsOpenLinks = true;
|
||||
IsOpenPlantLinks =
|
||||
IsOpenHome = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Anlagen Links
|
||||
|
||||
private bool _isOpenPlantLinks = false;
|
||||
public bool IsOpenPlantLinks
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isOpenPlantLinks;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isOpenPlantLinks = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand OpenRadialMenuPlantLinks
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand(() =>
|
||||
{
|
||||
IsOpenPlantLinks = true;
|
||||
IsOpenPlantLinksPl1 =
|
||||
IsOpenPlantLinksPl2 =
|
||||
IsOpenPlantLinksPl3 =
|
||||
IsOpenLinks = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Anlagen Links Pl1
|
||||
|
||||
private bool _isOpenPlantLinksPl1 = false;
|
||||
public bool IsOpenPlantLinksPl1
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isOpenPlantLinksPl1;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isOpenPlantLinksPl1 = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand OpenRadialMenuPlantLinksPl1
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand(() =>
|
||||
{
|
||||
IsOpenPlantLinksPl1 = true;
|
||||
IsOpenPlantLinks = false;
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Anlagen Links Pl2
|
||||
|
||||
private bool _isOpenPlantLinksPl2 = false;
|
||||
public bool IsOpenPlantLinksPl2
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isOpenPlantLinksPl2;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isOpenPlantLinksPl2 = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand OpenRadialMenuPlantLinksPl2
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand(() =>
|
||||
{
|
||||
IsOpenPlantLinksPl2 = true;
|
||||
IsOpenPlantLinks = false;
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Anlagen Links Pl3
|
||||
|
||||
private bool _isOpenPlantLinksPl3 = false;
|
||||
public bool IsOpenPlantLinksPl3
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isOpenPlantLinksPl3;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isOpenPlantLinksPl3 = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand OpenRadialMenuPlantLinksPl3
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand(() =>
|
||||
{
|
||||
IsOpenPlantLinksPl3 = true;
|
||||
IsOpenPlantLinks = false;
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Apps
|
||||
|
||||
private bool _isOpenApps = false;
|
||||
public bool IsOpenApps
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isOpenApps;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isOpenApps = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand OpenRadialMenuApps
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand(() =>
|
||||
{
|
||||
IsOpenApps = true;
|
||||
IsOpenAppsVncRdp =
|
||||
IsOpenHome = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Apps RDP VNC
|
||||
|
||||
private bool _isOpenAppsVncRdp = false;
|
||||
public bool IsOpenAppsVncRdp
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isOpenAppsVncRdp;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isOpenAppsVncRdp = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand OpenRadialMenuAppsVncRdp
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand(() =>
|
||||
{
|
||||
IsOpenAppsVncRdp = true;
|
||||
IsOpenApps = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void _window_Deactivated(object sender, EventArgs e)
|
||||
{
|
||||
_window.Visibility = Visibility.Hidden;
|
||||
|
||||
IsOpenHome = true;
|
||||
IsOpenEpl =
|
||||
IsOpenTools =
|
||||
IsOpenSie =
|
||||
IsOpenLinks =
|
||||
IsOpenApps =
|
||||
IsOpenPlantLinksPl1 =
|
||||
IsOpenPlantLinksPl2 =
|
||||
IsOpenPlantLinksPl3 =
|
||||
IsOpenAppsVncRdp =
|
||||
IsOpenPlantLinks = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
27
FSI.BT.Tools/RadialMenu/Helpers/KeyPressedEventArgs.cs
Normal file
27
FSI.BT.Tools/RadialMenu/Helpers/KeyPressedEventArgs.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
// <copyright file="KeyPressedEventArgs.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace FSI.BT.Tools.RadialMenu.Helper
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
/// <summary>
|
||||
/// Event Args for the event that is fired after the hot key has been pressed.
|
||||
/// </summary>
|
||||
internal class KeyPressedEventArgs : EventArgs
|
||||
{
|
||||
private readonly Keys key;
|
||||
|
||||
internal KeyPressedEventArgs(KeyboardHookModifierKeys modifier, Keys key)
|
||||
{
|
||||
Modifier = modifier;
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
internal KeyboardHookModifierKeys Modifier { get; }
|
||||
|
||||
internal Keys Key => key;
|
||||
}
|
||||
}
|
||||
166
FSI.BT.Tools/RadialMenu/Helpers/KeyboardHook.cs
Normal file
166
FSI.BT.Tools/RadialMenu/Helpers/KeyboardHook.cs
Normal file
@@ -0,0 +1,166 @@
|
||||
// <copyright file="KeyboardHook.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace FSI.BT.Tools.RadialMenu.Helper
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using FSI.BT.Tools.Global.DllImports;
|
||||
using FSI.BT.Tools.Global.UserInterface.HotkeyTextboxControl;
|
||||
|
||||
/// <summary>
|
||||
/// The enumeration of possible modifiers.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum KeyboardHookModifierKeys : uint
|
||||
{
|
||||
None = 0,
|
||||
Alt = 1,
|
||||
Control = 2,
|
||||
Shift = 4,
|
||||
Win = 8,
|
||||
}
|
||||
|
||||
public sealed class KeyboardHook : IDisposable
|
||||
{
|
||||
private readonly Window window = new();
|
||||
private int currentId;
|
||||
|
||||
public KeyboardHook()
|
||||
{
|
||||
// register the event of the inner native window.
|
||||
window.KeyPressed += Window_KeyPressed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A hot key has been pressed.
|
||||
/// </summary>
|
||||
internal event EventHandler<KeyPressedEventArgs> KeyPressed;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// unregister all the registered hot keys.
|
||||
for (int i = currentId; i > 0; i--)
|
||||
{
|
||||
NativeMethods.User32UnregisterHotKey(window.Handle, i);
|
||||
}
|
||||
|
||||
// dispose the inner native window.
|
||||
window.KeyPressed -= Window_KeyPressed;
|
||||
window.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers a hot key in the system.
|
||||
/// </summary>
|
||||
/// <param name="key">The key itself that is associated with the hot key.</param>
|
||||
internal void RegisterHotKey(Keys key)
|
||||
{
|
||||
uint keyModifiersNone = 0;
|
||||
RegisterHotKey(keyModifiersNone, key);
|
||||
}
|
||||
|
||||
internal void RegisterHotKey()
|
||||
{
|
||||
KeyboardHookModifierKeys modifiers = KeyboardHookModifierKeys.None;
|
||||
string modifiersString = Global.Vars.RadialMenuSettings.HotKey;
|
||||
if (!string.IsNullOrEmpty(modifiersString))
|
||||
{
|
||||
if (modifiersString.ToUpperInvariant().Contains("ALT", StringComparison.InvariantCulture))
|
||||
{
|
||||
modifiers |= KeyboardHookModifierKeys.Alt;
|
||||
}
|
||||
|
||||
if (modifiersString.ToUpperInvariant().Contains("CTRL", StringComparison.InvariantCulture) ||
|
||||
modifiersString.ToUpperInvariant().Contains("STRG", StringComparison.InvariantCulture))
|
||||
{
|
||||
modifiers |= KeyboardHookModifierKeys.Control;
|
||||
}
|
||||
|
||||
if (modifiersString.ToUpperInvariant().Contains("SHIFT", StringComparison.InvariantCulture))
|
||||
{
|
||||
modifiers |= KeyboardHookModifierKeys.Shift;
|
||||
}
|
||||
|
||||
if (modifiersString.ToUpperInvariant().Contains("WIN", StringComparison.InvariantCulture))
|
||||
{
|
||||
modifiers |= KeyboardHookModifierKeys.Win;
|
||||
}
|
||||
}
|
||||
|
||||
RegisterHotKey(
|
||||
modifiers,
|
||||
HotkeyControl.HotkeyFromString(
|
||||
Global.Vars.RadialMenuSettings.HotKey));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers a hot key in the system.
|
||||
/// </summary>
|
||||
/// <param name="modifier">The modifiers that are associated with the hot key.</param>
|
||||
/// <param name="key">The key itself that is associated with the hot key.</param>
|
||||
internal void RegisterHotKey(KeyboardHookModifierKeys modifier, Keys key)
|
||||
{
|
||||
RegisterHotKey((uint)modifier, key);
|
||||
}
|
||||
|
||||
private void Window_KeyPressed(object sender, KeyPressedEventArgs e)
|
||||
{
|
||||
KeyPressed?.Invoke(this, e);
|
||||
}
|
||||
|
||||
private void RegisterHotKey(uint modifier, Keys key)
|
||||
{
|
||||
currentId += 1;
|
||||
|
||||
if (!NativeMethods.User32RegisterHotKey(
|
||||
window.Handle, currentId, modifier, (uint)key))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
Global.Utilities.Translator.GetText("Could not register the hot key."));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the window that is used internally to get the messages.
|
||||
/// </summary>
|
||||
private class Window : NativeWindow, IDisposable
|
||||
{
|
||||
private const int WmHotkey = 0x0312;
|
||||
|
||||
public Window()
|
||||
{
|
||||
// create the handle for the window.
|
||||
CreateHandle(new CreateParams());
|
||||
}
|
||||
|
||||
public event EventHandler<KeyPressedEventArgs> KeyPressed;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
DestroyHandle();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overridden to get the notifications.
|
||||
/// </summary>
|
||||
/// <param name="m">m.</param>
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
base.WndProc(ref m);
|
||||
|
||||
// check if we got a hot key pressed.
|
||||
if (m.Msg == WmHotkey)
|
||||
{
|
||||
// get the keys.
|
||||
Keys key = (Keys)(((int)m.LParam >> 16) & 0xFFFF);
|
||||
KeyboardHookModifierKeys modifier = (KeyboardHookModifierKeys)((int)m.LParam & 0xFFFF);
|
||||
|
||||
// invoke the event to notify the parent.
|
||||
KeyPressed?.Invoke(this, new KeyPressedEventArgs(modifier, key));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
26
FSI.BT.Tools/RadialMenu/Provider/CmdProvider.cs
Normal file
26
FSI.BT.Tools/RadialMenu/Provider/CmdProvider.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using AutoCompleteTextBox.Editors;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FSI.BT.Tools.RadialMenu.Provider
|
||||
{
|
||||
public class CmdProvider : ISuggestionProvider
|
||||
{
|
||||
private readonly ObservableCollection<string> _cmds;
|
||||
|
||||
public IEnumerable GetSuggestions(string filter)
|
||||
{
|
||||
return _cmds.Where(x => x.StartsWith(filter, StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
|
||||
public CmdProvider(ref ObservableCollection<string> cmds)
|
||||
{
|
||||
this._cmds = cmds;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
FSI.BT.Tools/RadialMenu/Settings/IInterface.cs
Normal file
19
FSI.BT.Tools/RadialMenu/Settings/IInterface.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Config.Net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FSI.BT.Tools.RadialMenu.Settings
|
||||
{
|
||||
public class Interface
|
||||
{
|
||||
public interface IInterface
|
||||
{
|
||||
[Option(DefaultValue = "Ctrl+RWin")]
|
||||
string HotKey { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
48
FSI.BT.Tools/RadialMenu/UserInterface/FrmAdmin.xaml
Normal file
48
FSI.BT.Tools/RadialMenu/UserInterface/FrmAdmin.xaml
Normal file
@@ -0,0 +1,48 @@
|
||||
<Window x:Class="FSI.BT.Tools.RadialMenu.UserInterface.FrmAdmin"
|
||||
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:FSI.BT.Tools.RadialMenu.UserInterface"
|
||||
mc:Ignorable="d"
|
||||
Title="Admin-/Benutzerverwaltung"
|
||||
SizeToContent="WidthAndHeight"
|
||||
Height="Auto"
|
||||
MinWidth="800"
|
||||
Loaded="Window_Loaded">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="200" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="200" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Content="Benutzer:" />
|
||||
<TextBox x:Name="tbUsers"
|
||||
Grid.Row="1"
|
||||
AcceptsReturn="true"
|
||||
VerticalScrollBarVisibility="Visible"
|
||||
HorizontalScrollBarVisibility="Visible" />
|
||||
|
||||
<Label Grid.Row="2"
|
||||
Content="Admins:" />
|
||||
<TextBox x:Name="tbAdmins"
|
||||
Grid.Row="3"
|
||||
AcceptsReturn="true"
|
||||
VerticalScrollBarVisibility="Visible"
|
||||
HorizontalScrollBarVisibility="Visible" />
|
||||
|
||||
<StackPanel Grid.Row="4" Orientation="Horizontal">
|
||||
<Button x:Name="btnOk"
|
||||
Margin="5 5 5 5"
|
||||
Content="Speichern"
|
||||
Click="btnOk_Click" />
|
||||
<Button x:Name="btnCancel"
|
||||
Margin="5 5 5 5 "
|
||||
Content="Abbruch"
|
||||
Click="btnCancel_Click" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
56
FSI.BT.Tools/RadialMenu/UserInterface/FrmAdmin.xaml.cs
Normal file
56
FSI.BT.Tools/RadialMenu/UserInterface/FrmAdmin.xaml.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
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 FSI.BT.Tools.RadialMenu.UserInterface
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für FrmAdmin.xaml
|
||||
/// </summary>
|
||||
public partial class FrmAdmin : Window
|
||||
{
|
||||
|
||||
public string[] Admins { get; set; }
|
||||
public string[] Users { get; set; }
|
||||
|
||||
public FrmAdmin()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnOk_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
#if NET472
|
||||
Admins = tbAdmins.Text.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
|
||||
Users = tbUsers.Text.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
|
||||
#elif NET6_0
|
||||
Admins = tbAdmins.Text.Split(Environment.NewLine);
|
||||
Users = tbUsers.Text.Split(Environment.NewLine);
|
||||
#endif
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = false;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
tbAdmins.Text = String.Join(Environment.NewLine, Admins);
|
||||
tbUsers.Text = String.Join(Environment.NewLine, Users);
|
||||
}
|
||||
}
|
||||
}
|
||||
329
FSI.BT.Tools/RadialMenu/UserInterface/FrmProcesses.xaml
Normal file
329
FSI.BT.Tools/RadialMenu/UserInterface/FrmProcesses.xaml
Normal file
@@ -0,0 +1,329 @@
|
||||
<Window x:Class="FSI.BT.Tools.RadialMenu.UserInterface.FrmProcesses"
|
||||
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:FSI.BT.Tools.RadialMenu.UserInterface"
|
||||
mc:Ignorable="d"
|
||||
Title="FSI.BT.Tools Prozesse"
|
||||
SizeToContent="WidthAndHeight"
|
||||
Height="Auto"
|
||||
Width="Auto">
|
||||
<Grid>
|
||||
<TabControl>
|
||||
<TabItem Header="WinCC"
|
||||
DataContext="{Binding WinCC }">
|
||||
|
||||
<StackPanel Grid.IsSharedSizeScope="True">
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="*"
|
||||
MinWidth="200" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Fenster-Name:"
|
||||
Margin="5 5 5 5" />
|
||||
<TextBox Grid.Column="1"
|
||||
Text="{Binding Data.WindowsName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5 5 5 5" />
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Class-Name:"
|
||||
Margin="5 5 5 5" />
|
||||
<TextBox Grid.Column="1"
|
||||
Text="{Binding Data.WindowsClassName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5 5 5 5" />
|
||||
</Grid>
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Schältfläche-Name:"
|
||||
Margin="5 5 5 5" />
|
||||
<TextBox Grid.Column="1"
|
||||
Text="{Binding Data.ButtonName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5 5 5 5" />
|
||||
</Grid>
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Update-Intervall:"
|
||||
Margin="5 5 5 5" />
|
||||
<TextBox Grid.Column="1"
|
||||
Text="{Binding Data.UpdateIntervall, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5 5 5 5" />
|
||||
<TextBlock Text="ms"
|
||||
Grid.Column="2"
|
||||
Margin="5 5 5 5" />
|
||||
</Grid>
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="*" />
|
||||
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Autostart:"
|
||||
Margin="5 5 5 5" />
|
||||
<CheckBox Grid.Column="1"
|
||||
IsChecked="{Binding Data.AutoStart, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5 5 5 5" />
|
||||
</Grid>
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Right">
|
||||
<Button Content="Start"
|
||||
MinWidth="75"
|
||||
Command="{Binding CmdStart}"
|
||||
Margin="0 0 10 0" />
|
||||
<Button Content="Stop"
|
||||
MinWidth="75"
|
||||
Command="{Binding CmdStop}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="IBA-Sync"
|
||||
DataContext="{Binding Iba }">
|
||||
|
||||
<StackPanel Grid.IsSharedSizeScope="True">
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="*"
|
||||
MinWidth="200" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Quell-Verzeichnis:"
|
||||
Margin="5 5 5 5" />
|
||||
<TextBox Grid.Column="1"
|
||||
Text="{Binding Data.Source, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5 5 5 5" />
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Ziel-Verzeichnis:"
|
||||
Margin="5 5 5 5" />
|
||||
<TextBox Grid.Column="1"
|
||||
Text="{Binding Data.Destination, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5 5 5 5" />
|
||||
</Grid>
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="*" />
|
||||
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Autostart:"
|
||||
Margin="5 5 5 5" />
|
||||
<CheckBox Grid.Column="1"
|
||||
IsChecked="{Binding Iba.AutoStart, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5 5 5 5" />
|
||||
</Grid>
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Right">
|
||||
<Button Content="Start"
|
||||
MinWidth="75"
|
||||
Command="{Binding CmdStart}"
|
||||
Margin="0 0 10 0" />
|
||||
<Button Content="Stop"
|
||||
MinWidth="75"
|
||||
Command="{Binding CmdStop}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Fenster Mgt"
|
||||
DataContext="{Binding WindowMgt }"
|
||||
HorizontalAlignment="Left"
|
||||
Width="76">
|
||||
|
||||
<StackPanel Grid.IsSharedSizeScope="True">
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Fenster:"
|
||||
Margin="5 5 5 5" />
|
||||
<ComboBox ItemsSource="{Binding Windows}"
|
||||
SelectedItem="{Binding SelectedWindow, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
DisplayMemberPath="Name"
|
||||
SelectedIndex="0"
|
||||
Grid.Column="1"
|
||||
MinWidth="250"
|
||||
Margin="5 5 5 5" />
|
||||
<Separator Width="10"
|
||||
Grid.Column="2"
|
||||
Background="Transparent" />
|
||||
<Button Content="neu"
|
||||
Name="ABC"
|
||||
Command="{Binding CmdNew}"
|
||||
Grid.Column="3"
|
||||
MinWidth="50"
|
||||
Margin="5 5 5 5"/>
|
||||
<Button Content="löschen"
|
||||
Command="{Binding CmdDelDel}"
|
||||
Grid.Column="4"
|
||||
Margin="5 5 5 5"
|
||||
MinWidth="50" />
|
||||
</Grid>
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Bezeichnung:"
|
||||
Margin="5 5 5 5" />
|
||||
<TextBox Grid.Column="1"
|
||||
Text="{Binding SelectedWindow.Bezeichnung, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5 5 5 5" />
|
||||
</Grid>
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Fenster Name:"
|
||||
Margin="5 5 5 5" />
|
||||
<TextBox Grid.Column="1"
|
||||
Text="{Binding SelectedWindow.Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5 5 5 5" />
|
||||
</Grid>
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Klassen Name:"
|
||||
Margin="5 5 5 5" />
|
||||
<TextBox Grid.Column="1"
|
||||
Text="{Binding SelectedWindow.ClassName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5 5 5 5" />
|
||||
</Grid>
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Fenster Höhe:"
|
||||
Margin="5 5 5 5" />
|
||||
<TextBox Grid.Column="1"
|
||||
Text="{Binding SelectedWindow.Height, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5 5 5 5" />
|
||||
</Grid>
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Fenster Breite:"
|
||||
Margin="5 5 5 5" />
|
||||
<TextBox Grid.Column="1"
|
||||
Text="{Binding SelectedWindow.Width, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5 5 5 5" />
|
||||
</Grid>
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="X-Position:"
|
||||
Margin="5 5 5 5" />
|
||||
<TextBox Grid.Column="1"
|
||||
Text="{Binding SelectedWindow.X, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5 5 5 5" />
|
||||
</Grid>
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Y-Position:"
|
||||
Margin="5 5 5 5" />
|
||||
<TextBox Grid.Column="1"
|
||||
Text="{Binding SelectedWindow.Y, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5 5 5 5" />
|
||||
</Grid>
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Update-Intervall:"
|
||||
Margin="5 5 5 5" />
|
||||
<TextBox Grid.Column="1"
|
||||
Text="{Binding UpdateIntervall, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5 5 5 5" />
|
||||
<TextBlock Text="ms"
|
||||
Grid.Column="2"
|
||||
Margin="5 5 5 5" />
|
||||
</Grid>
|
||||
<Grid Margin="0 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="a" />
|
||||
<ColumnDefinition Width="*" />
|
||||
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Autostart:"
|
||||
Margin="5 5 5 5" />
|
||||
<CheckBox Grid.Column="1"
|
||||
IsChecked="{Binding AutoStart, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5 5 5 5" />
|
||||
</Grid>
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Right">
|
||||
<Button Content="Start"
|
||||
MinWidth="75"
|
||||
Command="{Binding CmdStart}"
|
||||
Margin="0 0 10 0" />
|
||||
<Button Content="Stop"
|
||||
MinWidth="75"
|
||||
Command="{Binding CmdStop}" />
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
20
FSI.BT.Tools/RadialMenu/UserInterface/FrmProcesses.xaml.cs
Normal file
20
FSI.BT.Tools/RadialMenu/UserInterface/FrmProcesses.xaml.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace FSI.BT.Tools.RadialMenu.UserInterface
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für FrmProcesses.xaml
|
||||
/// </summary>
|
||||
public partial class FrmProcesses : Window
|
||||
{
|
||||
public FSI.Lib.Guis.SieTiaWinCCMsgMgt.ViewModel WinCC { get; set; }
|
||||
public FSI.Lib.Guis.IbaDirSync.ViewModel Iba { get; set; }
|
||||
public FSI.Lib.Guis.SetSizePosExWindow.ViewModel WindowMgt { get; set; }
|
||||
|
||||
public FrmProcesses()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
1196
FSI.BT.Tools/RadialMenu/UserInterface/FrmRadialMenu.xaml
Normal file
1196
FSI.BT.Tools/RadialMenu/UserInterface/FrmRadialMenu.xaml
Normal file
File diff suppressed because it is too large
Load Diff
131
FSI.BT.Tools/RadialMenu/UserInterface/FrmRadialMenu.xaml.cs
Normal file
131
FSI.BT.Tools/RadialMenu/UserInterface/FrmRadialMenu.xaml.cs
Normal file
@@ -0,0 +1,131 @@
|
||||
using FSI.BT.Tools.Global.Commands;
|
||||
using FSI.BT.Tools.RadialMenu;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
using FSI.Lib.Wpf.ExtensionMethods;
|
||||
|
||||
namespace FSI.BT.Tools.RadialMenu.UserInterface
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class FrmRadialMenu : Window//, INotifyPropertyChanged
|
||||
{
|
||||
private CmdCommand _cmd;
|
||||
private MainViewModel _radialMenu;
|
||||
|
||||
public FrmRadialMenu()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
List<string> cmds = new List<string>();
|
||||
foreach (var cmd in Global.Vars.GlobalSettings.Cmds)
|
||||
{
|
||||
cmds.Add(cmd.Cmd);
|
||||
}
|
||||
|
||||
cmds = cmds.Distinct().ToList(); // Duplikate entfernen
|
||||
cmds.Sort(); // Liste sortieren
|
||||
|
||||
_radialMenu = new MainViewModel(this, cmds);
|
||||
DataContext = _radialMenu;
|
||||
|
||||
tbversion.Text = "v" + Assembly.GetExecutingAssembly().GetName().Version.Major + "." + Assembly.GetExecutingAssembly().GetName().Version.Minor + "b";
|
||||
_cmd = new();
|
||||
}
|
||||
|
||||
private void Window_Activated(object sender, EventArgs e)
|
||||
{
|
||||
ChangeBtnIcon();
|
||||
tbCmd.Focus();
|
||||
}
|
||||
|
||||
private void Window_Deactivated(object sender, EventArgs e)
|
||||
{
|
||||
tbCmd.Text = String.Empty;
|
||||
tbCmd.Focus();
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ChangeBtnIcon();
|
||||
|
||||
tbCmd.Focus();
|
||||
}
|
||||
|
||||
private void tbCmd_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (_cmd.CanExecute(tbCmd.Text))
|
||||
tbCmd.Background = new SolidColorBrush(Colors.Green);
|
||||
else
|
||||
tbCmd.Background = new SolidColorBrush(Colors.White);
|
||||
|
||||
if (e.Key == Key.Enter && _cmd.CanExecute(tbCmd.Text))
|
||||
{
|
||||
_cmd.Execute(tbCmd.Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnMute_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Lib.Audio.AudioManager.SetMasterVolumeMute(!Lib.Audio.AudioManager.GetMasterVolumeMute());
|
||||
ChangeBtnIcon();
|
||||
}
|
||||
|
||||
private void btnVolUp_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Lib.Audio.AudioManager.StepMasterVolume(2F);
|
||||
}
|
||||
|
||||
private void btnVolDwn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Lib.Audio.AudioManager.StepMasterVolume(-2F);
|
||||
}
|
||||
|
||||
private void ChangeBtnIcon()
|
||||
{
|
||||
if (FSI.Lib.Audio.AudioManager.GetMasterVolumeMute())
|
||||
{
|
||||
btnMute.Content = new System.Windows.Controls.Image
|
||||
{
|
||||
Source = new BitmapImage(new Uri("/Global/Icons/VolOff.png", UriKind.RelativeOrAbsolute)),
|
||||
Width = 15,
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
btnMute.Content = new System.Windows.Controls.Image
|
||||
{
|
||||
Source = new BitmapImage(new Uri("/Global/Icons/VolOn.png", UriKind.RelativeOrAbsolute)),
|
||||
Width = 15,
|
||||
};
|
||||
}
|
||||
|
||||
btnVolUp.Content = new System.Windows.Controls.Image
|
||||
{
|
||||
Source = new BitmapImage(new Uri("/Global/Icons/VolUp.png", UriKind.RelativeOrAbsolute)),
|
||||
Width = 15,
|
||||
};
|
||||
|
||||
btnVolDwn.Content = new System.Windows.Controls.Image
|
||||
{
|
||||
Source = new BitmapImage(new Uri("/Global/Icons/VolDown.png", UriKind.RelativeOrAbsolute)),
|
||||
Width = 15,
|
||||
};
|
||||
}
|
||||
|
||||
private void tbCmd_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user