Sicherung
This commit is contained in:
@@ -1,429 +1,128 @@
|
||||
using FSI.BT.Tools.Commands;
|
||||
using AutoCompleteTextBox.Editors;
|
||||
using FSI.BT.Tools.Commands;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace FSI.BT.Tools
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class FrmRadialMenu : Window, INotifyPropertyChanged
|
||||
public partial class FrmRadialMenu : Window//, INotifyPropertyChanged
|
||||
{
|
||||
private CmdCommand _cmd;
|
||||
|
||||
|
||||
public FrmRadialMenu()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = this;
|
||||
_isOpenHome = true;
|
||||
|
||||
List<string> cmds = new List<string>();
|
||||
foreach(var cmd in Global.AppSettings.Cmds)
|
||||
{
|
||||
cmds.Add(cmd.Cmd);
|
||||
}
|
||||
DataContext = new RadialMenu.MainViewModel(this, cmds);
|
||||
|
||||
tbversion.Text = "v" + Assembly.GetExecutingAssembly().GetName().Version.Major + "." + Assembly.GetExecutingAssembly().GetName().Version.Minor + "b";
|
||||
_cmd = new ();
|
||||
_cmd = new();
|
||||
}
|
||||
|
||||
#region Home
|
||||
private bool _isOpenHome = true;
|
||||
public bool IsOpenHome
|
||||
private void Window_Activated(object sender, EventArgs e)
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isOpenHome;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isOpenHome = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand CloseRadialMenuHome
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand(() => 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;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand OpenRadialMenuAppsVncRdp
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand(() =>
|
||||
{
|
||||
IsOpenAppsVncRdp = true;
|
||||
IsOpenApps = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
void RaisePropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
tbCmd.Focus();
|
||||
|
||||
ChangeBtnIcon();
|
||||
}
|
||||
|
||||
private void Window_Deactivated(object sender, EventArgs e)
|
||||
{
|
||||
tbCmd.Text = String.Empty;
|
||||
tbCmd.Focus();
|
||||
Visibility = Visibility.Hidden;
|
||||
|
||||
IsOpenHome = true;
|
||||
IsOpenEpl =
|
||||
IsOpenTools =
|
||||
IsOpenSie =
|
||||
IsOpenLinks =
|
||||
IsOpenApps =
|
||||
IsOpenPlantLinksPl1 =
|
||||
IsOpenPlantLinksPl2 =
|
||||
IsOpenPlantLinksPl3 =
|
||||
IsOpenAppsVncRdp =
|
||||
IsOpenPlantLinks = false;
|
||||
tbCmd.Focus();
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
tbCmd.Focus();
|
||||
ChangeBtnIcon();
|
||||
|
||||
tbCmd.Focus();
|
||||
}
|
||||
|
||||
private void tbCmd_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter && _cmd.CanExecute(((TextBox)sender).Text))
|
||||
{
|
||||
_cmd.Execute(((TextBox)sender).Text);
|
||||
}
|
||||
{
|
||||
if (e.Key == Key.Enter && _cmd.CanExecute(tbCmd.Text))
|
||||
{
|
||||
_cmd.Execute(tbCmd.Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void tbCmd_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (_cmd.CanExecute(((TextBox)sender).Text))
|
||||
((TextBox)sender).Background = new SolidColorBrush(Colors.Green);
|
||||
((TextBox)sender).Background = new SolidColorBrush(Colors.Green);
|
||||
else
|
||||
((TextBox)sender).Background = new SolidColorBrush(Colors.White);
|
||||
}
|
||||
|
||||
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("../../Icons/VolOff.png", UriKind.RelativeOrAbsolute)),
|
||||
Width = 15,
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
btnMute.Content = new System.Windows.Controls.Image
|
||||
{
|
||||
Source = new BitmapImage(new Uri("../../Icons/VolOn.png", UriKind.RelativeOrAbsolute)),
|
||||
Width = 15,
|
||||
};
|
||||
}
|
||||
|
||||
btnVolUp.Content = new System.Windows.Controls.Image
|
||||
{
|
||||
Source = new BitmapImage(new Uri("../../Icons/VolUp.png", UriKind.RelativeOrAbsolute)),
|
||||
Width = 15,
|
||||
};
|
||||
|
||||
btnVolDwn.Content = new System.Windows.Controls.Image
|
||||
{
|
||||
Source = new BitmapImage(new Uri("../../Icons/VolDown.png", UriKind.RelativeOrAbsolute)),
|
||||
Width = 15,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user