Sicherung

This commit is contained in:
Maier Stephan SI
2023-04-17 07:07:49 +02:00
parent f3f89b94f5
commit 1c68b8f401
1307 changed files with 7918 additions and 82491 deletions

View 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)
{
}
}
}

View 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();
}
}
}

View 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();
}
}
}

View 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;
}
}
}