diff --git a/DS4Windows/DS4Forms/MainWindow.xaml b/DS4Windows/DS4Forms/MainWindow.xaml index e411cd3..eed744c 100644 --- a/DS4Windows/DS4Forms/MainWindow.xaml +++ b/DS4Windows/DS4Forms/MainWindow.xaml @@ -37,7 +37,7 @@ - + - + - + diff --git a/DS4Windows/DS4Forms/MainWindow.xaml.cs b/DS4Windows/DS4Forms/MainWindow.xaml.cs index 802f88f..d7fb418 100644 --- a/DS4Windows/DS4Forms/MainWindow.xaml.cs +++ b/DS4Windows/DS4Forms/MainWindow.xaml.cs @@ -32,6 +32,7 @@ namespace DS4WinWPF.DS4Forms /// public partial class MainWindow : Window { + private MainWindowsViewModel mainWinVM; private StatusLogMsg lastLogMsg = new StatusLogMsg(); private ProfileList profileListHolder = new ProfileList(); private LogViewModel logvm; @@ -58,6 +59,9 @@ namespace DS4WinWPF.DS4Forms { InitializeComponent(); + mainWinVM = new MainWindowsViewModel(); + DataContext = mainWinVM; + App root = Application.Current as App; settingsWrapVM = new SettingsViewModel(); settingsTab.DataContext = settingsWrapVM; @@ -257,6 +261,7 @@ Properties.Resources.DS4Update, MessageBoxButton.YesNo, MessageBoxImage.Question autoprofileChecker.RequestServiceChange += AutoprofileChecker_RequestServiceChange; autoProfileHolder.AutoProfileColl.CollectionChanged += AutoProfileColl_CollectionChanged; //autoProfControl.AutoProfVM.AutoProfileSystemChange += AutoProfVM_AutoProfileSystemChange; + mainWinVM.FullTabsEnabledChanged += MainWinVM_FullTabsEnabledChanged; bool wmiConnected = false; WqlEventQuery q = new WqlEventQuery(); @@ -288,6 +293,11 @@ Suspend support not enabled.", true); } } + private void MainWinVM_FullTabsEnabledChanged(object sender, EventArgs e) + { + settingsWrapVM.ViewEnabled = mainWinVM.FullTabsEnabled; + } + private void TrayIconVM_RequestServiceChange(object sender, EventArgs e) { ChangeService(); @@ -1274,6 +1284,7 @@ Suspend support not enabled.", true); editor = null; mainTabCon.SelectedIndex = 0; + mainWinVM.FullTabsEnabled = true; //Task.Run(() => GC.Collect(0, GCCollectionMode.Forced, false)); } @@ -1288,6 +1299,7 @@ Suspend support not enabled.", true); { profOptsToolbar.Visibility = Visibility.Collapsed; profilesListBox.Visibility = Visibility.Collapsed; + mainWinVM.FullTabsEnabled = false; preserveSize = false; oldSize.Width = Width; diff --git a/DS4Windows/DS4Forms/ViewModels/MainWindowsViewModel.cs b/DS4Windows/DS4Forms/ViewModels/MainWindowsViewModel.cs new file mode 100644 index 0000000..89a36be --- /dev/null +++ b/DS4Windows/DS4Forms/ViewModels/MainWindowsViewModel.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS4WinWPF.DS4Forms.ViewModels +{ + public class MainWindowsViewModel + { + private bool fullTabsEnabled = true; + + public bool FullTabsEnabled + { + get => fullTabsEnabled; + set + { + fullTabsEnabled = value; + FullTabsEnabledChanged?.Invoke(this, EventArgs.Empty); + } + } + public event EventHandler FullTabsEnabledChanged; + } +} diff --git a/DS4Windows/DS4Forms/ViewModels/SettingsViewModel.cs b/DS4Windows/DS4Forms/ViewModels/SettingsViewModel.cs index 11489bb..7b35b60 100644 --- a/DS4Windows/DS4Forms/ViewModels/SettingsViewModel.cs +++ b/DS4Windows/DS4Forms/ViewModels/SettingsViewModel.cs @@ -173,6 +173,19 @@ namespace DS4WinWPF.DS4Forms.ViewModels } } + private bool viewEnabled = true; + public bool ViewEnabled + { + get => viewEnabled; + set + { + viewEnabled = value; + ViewEnabledChanged?.Invoke(this, EventArgs.Empty); + } + } + public event EventHandler ViewEnabledChanged; + + public SettingsViewModel() { checkEveryUnitIdx = 1; diff --git a/DS4Windows/DS4WinWPF.csproj b/DS4Windows/DS4WinWPF.csproj index 00df91f..e4fe6ac 100644 --- a/DS4Windows/DS4WinWPF.csproj +++ b/DS4Windows/DS4WinWPF.csproj @@ -225,6 +225,7 @@ +