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 { /// /// Interaction logic for MainWindow.xaml /// public partial class FrmRadialMenu : Window//, INotifyPropertyChanged { private CmdCommand _cmd; public FrmRadialMenu() { InitializeComponent(); List cmds = new List(); 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(); } private void Window_Activated(object sender, EventArgs e) { tbCmd.Focus(); ChangeBtnIcon(); } 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 (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); 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, }; } } }