diff --git a/FsConnector/DataDefinition.cs b/FsConnector/DataDefinition.cs
index 8ca0876..7f9b5f5 100644
--- a/FsConnector/DataDefinition.cs
+++ b/FsConnector/DataDefinition.cs
@@ -11,7 +11,8 @@ namespace MSFSPopoutPanelManager.FsConnector
var def = new List<(string, string, string, SIMCONNECT_DATATYPE, Type)>
{
("Title", "Title", null, SIMCONNECT_DATATYPE.STRING256, typeof(string)),
- ("ElectricalMasterBattery", "ELECTRICAL MASTER BATTERY", "Bool", SIMCONNECT_DATATYPE.FLOAT64, typeof(bool))
+ ("ElectricalMasterBattery", "ELECTRICAL MASTER BATTERY", "Bool", SIMCONNECT_DATATYPE.FLOAT64, typeof(bool)),
+ ("TrackIREnable", "TRACK IR ENABLE", "Bool", SIMCONNECT_DATATYPE.FLOAT64, typeof(bool))
};
return def;
diff --git a/FsConnector/FsConnector.csproj b/FsConnector/FsConnector.csproj
index 3fd128a..6222033 100644
--- a/FsConnector/FsConnector.csproj
+++ b/FsConnector/FsConnector.csproj
@@ -5,15 +5,15 @@
FsConnector
MSFS 2020 Popout Panel Manager FsConnector
MSFS 2020 Popout Panel Manager FsConnector
- 3.3.0.0
+ 3.3.1.0
Stanley Kwok
Stanley Kwok
Stanley Kwok 2021
https://github.com/hawkeye-stan/msfs-popout-panel-manager
MSFSPopoutPanelManager.FsConnector
x64;AnyCPU
- 3.3.0.0
- 3.3.0.0
+ 3.3.1.0
+ 3.3.1.0
diff --git a/FsConnector/SimConnectStruct.cs b/FsConnector/SimConnectStruct.cs
index fa5bc60..20f2ead 100644
--- a/FsConnector/SimConnectStruct.cs
+++ b/FsConnector/SimConnectStruct.cs
@@ -11,14 +11,5 @@ namespace MSFSPopoutPanelManager.FsConnector
public double Prop02;
public double Prop03;
- public double Prop04;
- public double Prop05;
- public double Prop06;
- public double Prop07;
- public double Prop08;
- public double Prop09;
- public double Prop10;
-
- // Add more as DataDefinition grows
}
}
diff --git a/FsConnector/SimConnector.cs b/FsConnector/SimConnector.cs
index a5f73e9..9b7c5ce 100644
--- a/FsConnector/SimConnector.cs
+++ b/FsConnector/SimConnector.cs
@@ -134,6 +134,21 @@ namespace MSFSPopoutPanelManager.FsConnector
}
}
+ public void SetDataObject(SimConnectStruct simConnectStruct)
+ {
+ if (_simConnect != null)
+ {
+ try
+ {
+ _simConnect.SetDataOnSimObject(SimConnectDefinition.SimConnectDataStruct, SimConnect.SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_DATA_SET_FLAG.DEFAULT, simConnectStruct);
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine($"Unable to set SimConnect variable: {ex.Message}");
+ }
+ }
+ }
+
private void HandleOnRecvQuit(SimConnect sender, SIMCONNECT_RECV data)
{
OnDisconnected?.Invoke(this, null);
@@ -147,9 +162,15 @@ namespace MSFSPopoutPanelManager.FsConnector
{
var exception = (SIMCONNECT_EXCEPTION)data.dwException;
- if (exception != SIMCONNECT_EXCEPTION.NAME_UNRECOGNIZED && exception != SIMCONNECT_EXCEPTION.EVENT_ID_DUPLICATE)
+ switch(exception)
{
- Debug.WriteLine($"MSFS Error - {exception}");
+ case SIMCONNECT_EXCEPTION.DATA_ERROR:
+ case SIMCONNECT_EXCEPTION.NAME_UNRECOGNIZED:
+ case SIMCONNECT_EXCEPTION.EVENT_ID_DUPLICATE:
+ return;
+ default:
+ Debug.WriteLine($"MSFS Error - {exception}");
+ break;
}
}
diff --git a/Model/AppSetting.cs b/Model/AppSetting.cs
index 1737c86..84ba0cc 100644
--- a/Model/AppSetting.cs
+++ b/Model/AppSetting.cs
@@ -21,6 +21,8 @@ namespace MSFSPopoutPanelManager.Model
public AppSetting()
{
// Set defaults
+ AutoUpdaterUrl = "https://raw.githubusercontent.com/hawkeye-stan/msfs-popout-panel-manager/master/autoupdate.xml";
+ //AutoUpdaterUrl = "https://raw.githubusercontent.com/hawkeye-stan/AutoUpdateTest/main/autoupdate.xml"; // Test URL against test repo
LastUsedProfileId = -1;
MinimizeToTray = false;
AlwaysOnTop = true;
@@ -28,6 +30,7 @@ namespace MSFSPopoutPanelManager.Model
AutoPanningKeyBinding = "0";
StartMinimized = false;
IncludeBuiltInPanel = false;
+ AutoDisableTrackIR = true;
AutoPopOutPanels = false;
AutoPopOutPanelsWaitDelay = new AutoPopOutPanelsWaitDelay();
}
@@ -35,6 +38,7 @@ namespace MSFSPopoutPanelManager.Model
public void Load()
{
var appSetting = ReadAppSetting();
+ this.AutoUpdaterUrl = appSetting.AutoUpdaterUrl;
this.LastUsedProfileId = appSetting.LastUsedProfileId;
this.MinimizeToTray = appSetting.MinimizeToTray;
this.AlwaysOnTop = appSetting.AlwaysOnTop;
@@ -42,6 +46,7 @@ namespace MSFSPopoutPanelManager.Model
this.AutoPanningKeyBinding = appSetting.AutoPanningKeyBinding;
this.StartMinimized = appSetting.StartMinimized;
this.IncludeBuiltInPanel = appSetting.IncludeBuiltInPanel;
+ this.AutoDisableTrackIR = appSetting.AutoDisableTrackIR;
this.AutoPopOutPanels = appSetting.AutoPopOutPanels;
this.AutoPopOutPanelsWaitDelay = appSetting.AutoPopOutPanelsWaitDelay;
AutoPopOutPanelsWaitDelay.DataChanged += (e, source) => WriteAppSetting(this);
@@ -66,6 +71,8 @@ namespace MSFSPopoutPanelManager.Model
}
}
+ public string AutoUpdaterUrl { get; set; }
+
public int LastUsedProfileId { get; set; }
public bool MinimizeToTray { get; set; }
@@ -82,6 +89,8 @@ namespace MSFSPopoutPanelManager.Model
public bool AutoPopOutPanels { get; set; }
+ public bool AutoDisableTrackIR { get; set; }
+
public AutoPopOutPanelsWaitDelay AutoPopOutPanelsWaitDelay { get; set; }
[JsonIgnore]
diff --git a/Model/Model.csproj b/Model/Model.csproj
index 6d91695..6d16b1e 100644
--- a/Model/Model.csproj
+++ b/Model/Model.csproj
@@ -5,7 +5,7 @@
MSFSPopoutPanelManager.Model
Model
MSFS 2020 Popout Panel Manager Model
- 3.3.0.0
+ 3.3.1.0
Stanley Kwok
Stanley Kwok
Stanley Kwok 2021
diff --git a/Provider/Provider.csproj b/Provider/Provider.csproj
index c52b939..a0d7339 100644
--- a/Provider/Provider.csproj
+++ b/Provider/Provider.csproj
@@ -7,7 +7,7 @@
MSFSPopoutPanelManager.Provider
MSFS 2020 Popout Panel Manager Provider
MSFS 2020 Popout Panel Manager Provider
- 3.3.0.0
+ 3.3.1.0
Stanley Kwok
Stanley Kwok 2021
https://github.com/hawkeye-stan/msfs-popout-panel-manager
diff --git a/Provider/SimConnectManager.cs b/Provider/SimConnectManager.cs
index 2f67997..d20fdce 100644
--- a/Provider/SimConnectManager.cs
+++ b/Provider/SimConnectManager.cs
@@ -1,7 +1,6 @@
using MSFSPopoutPanelManager.FsConnector;
using MSFSPopoutPanelManager.Shared;
using System;
-using System.ComponentModel;
using System.Diagnostics;
using System.Threading;
using System.Timers;
@@ -19,6 +18,7 @@ namespace MSFSPopoutPanelManager.Provider
private SimConnectSystemEvent _lastSystemEvent;
private bool _isSimActive;
private bool _isPowerOnForPopOut;
+ private bool _isTrackIRManaged;
public event EventHandler OnConnected;
public event EventHandler OnDisconnected;
@@ -91,6 +91,32 @@ namespace MSFSPopoutPanelManager.Provider
}
}
+ public void TurnOffTrackIR()
+ {
+ if(_simData.TrackIREnable)
+ {
+ SetTrackIREnable(false);
+ _isTrackIRManaged = true;
+ }
+ }
+
+ public void TurnOnTrackIR()
+ {
+ if (_isTrackIRManaged && !_simData.TrackIREnable)
+ {
+ SetTrackIREnable(true);
+ _isTrackIRManaged = false;
+ }
+ }
+
+ private void SetTrackIREnable(bool enable)
+ {
+ // It is prop3 in SimConnectStruct (by DataDefinitions.cs)
+ SimConnectStruct simConnectStruct = new SimConnectStruct();
+ simConnectStruct.Prop03 = enable ? Convert.ToDouble(1): Convert.ToDouble(0);
+ _simConnector.SetDataObject(simConnectStruct);
+ }
+
private void HandleDataRequested(object sender, ElapsedEventArgs e)
{
try
diff --git a/Shared/Shared.csproj b/Shared/Shared.csproj
index cc14c1e..85ed6c7 100644
--- a/Shared/Shared.csproj
+++ b/Shared/Shared.csproj
@@ -9,7 +9,7 @@
Stanley Kwok
Stanley Kwok 2021
https://github.com/hawkeye-stan/msfs-popout-panel-manager
- 3.3.0.0
+ 3.3.1.0
AnyCPU;x64
true
diff --git a/VERSION.md b/VERSION.md
index 36a58ea..26889b0 100644
--- a/VERSION.md
+++ b/VERSION.md
@@ -1,6 +1,8 @@
# Version History
+## Version 3.3.1
+* Added support to automatic disable Track IR during panel selection and panel pop out process.
## Version 3.3.0
* Pop out panel without a title bar can now be moved and resized.
diff --git a/WpfApp/PreferencesDialog.xaml b/WpfApp/PreferencesDialog.xaml
index 3d34e1b..2a6f369 100644
--- a/WpfApp/PreferencesDialog.xaml
+++ b/WpfApp/PreferencesDialog.xaml
@@ -45,6 +45,7 @@
+
@@ -135,6 +136,12 @@
+
+
+
+ Automactically disable Track IR during panel selections and pop out process. Track IR will be re-enable once these processes are completed.
+
+
diff --git a/WpfApp/PreferencesDialog.xaml.cs b/WpfApp/PreferencesDialog.xaml.cs
index 39478b1..5c923df 100644
--- a/WpfApp/PreferencesDialog.xaml.cs
+++ b/WpfApp/PreferencesDialog.xaml.cs
@@ -23,6 +23,7 @@ namespace MSFSPopoutPanelManager.WpfApp
ApplicationSettingsVisibility = Visibility.Visible;
PopOutSettingsVisibility = Visibility.Collapsed;
AutoPopOutSettingsVisibility = Visibility.Collapsed;
+ TrackIRSettingsVisibility = Visibility.Collapsed;
}
public AppSetting AppSetting { get; set; }
@@ -33,6 +34,8 @@ namespace MSFSPopoutPanelManager.WpfApp
public Visibility AutoPopOutSettingsVisibility { get; set; }
+ public Visibility TrackIRSettingsVisibility { get; set; }
+
private void TreeViewItem_Selected(object sender, RoutedEventArgs e)
{
var treeViewItem = (TreeViewItem)e.Source;
@@ -40,6 +43,7 @@ namespace MSFSPopoutPanelManager.WpfApp
ApplicationSettingsVisibility = Visibility.Collapsed;
PopOutSettingsVisibility = Visibility.Collapsed;
AutoPopOutSettingsVisibility = Visibility.Collapsed;
+ TrackIRSettingsVisibility = Visibility.Collapsed;
if (treeViewItem.Header.ToString() == "Application Settings")
{
@@ -53,6 +57,10 @@ namespace MSFSPopoutPanelManager.WpfApp
{
AutoPopOutSettingsVisibility = Visibility.Visible;
}
+ else if (treeViewItem.Header.ToString() == "Track IR Settings")
+ {
+ TrackIRSettingsVisibility = Visibility.Visible;
+ }
}
}
}
diff --git a/WpfApp/ViewModel/ApplicationViewModel.cs b/WpfApp/ViewModel/ApplicationViewModel.cs
index 8c8d4f7..5851a5a 100644
--- a/WpfApp/ViewModel/ApplicationViewModel.cs
+++ b/WpfApp/ViewModel/ApplicationViewModel.cs
@@ -294,8 +294,7 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
AutoUpdater.AppTitle = "MSFS Pop Out Panel Manager";
AutoUpdater.RunUpdateAsAdmin = false;
AutoUpdater.UpdateFormSize = new System.Drawing.Size(930, 675);
- AutoUpdater.Start("https://raw.githubusercontent.com/hawkeye-stan/msfs-popout-panel-manager/master/autoupdate.xml");
- //AutoUpdater.Start("https://raw.githubusercontent.com/hawkeye-stan/AutoUpdateTest/main/autoupdate.xml");
+ AutoUpdater.Start(DataStore.AppSetting.AutoUpdaterUrl);
}
private void AutoSwitchProfile(string activeAircraftTitle)
diff --git a/WpfApp/ViewModel/PanelSelectionViewModel.cs b/WpfApp/ViewModel/PanelSelectionViewModel.cs
index dce5816..cb2fd7d 100644
--- a/WpfApp/ViewModel/PanelSelectionViewModel.cs
+++ b/WpfApp/ViewModel/PanelSelectionViewModel.cs
@@ -121,6 +121,10 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
private void OnStartPanelSelection(object commandParameter)
{
+ // Turn off TrackIR if TrackIR is started
+ if (DataStore.AppSetting.AutoDisableTrackIR)
+ _simConnectManager.TurnOffTrackIR();
+
WindowManager.MinimizeWindow(DataStore.ApplicationHandle); // Window hide doesn't work when try to reshow window after selection completes. So need to use minimize.
_panelSelectionManager.UserProfile = DataStore.ActiveUserProfile;
_panelSelectionManager.AppSetting = DataStore.AppSetting;
@@ -171,6 +175,15 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
private void OnEditPanelCoorOverlay(object commandParameter)
{
+ // Turn off TrackIR if TrackIR is started
+ if (commandParameter == null && DataStore.AppSetting.AutoDisableTrackIR)
+ {
+ if(IsEditingPanelCoorOverlay)
+ _simConnectManager.TurnOffTrackIR();
+ else
+ _simConnectManager.TurnOnTrackIR();
+ }
+
if (IsEditingPanelCoorOverlay)
{
RemoveAllPanelCoorOverlay();
@@ -232,11 +245,15 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
{
// Hide panel coordinate overlays
IsEditingPanelCoorOverlay = false;
- OnEditPanelCoorOverlay(null);
+ OnEditPanelCoorOverlay(false);
// Close all pop out panels
WindowManager.CloseAllCustomPopoutPanels();
+ // Turn off TrackIR if TrackIR is started
+ if (DataStore.AppSetting.AutoDisableTrackIR)
+ _simConnectManager.TurnOffTrackIR();
+
// Temporary minimize the app for pop out process
_minimizeForPopOut = DataStore.ApplicationWindow.WindowState != WindowState.Minimized;
if (_minimizeForPopOut)
@@ -258,6 +275,10 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
{
OnPopOutCompleted?.Invoke(this, null);
}
+
+ // Turn off TrackIR if TrackIR is started
+ if (DataStore.AppSetting.AutoDisableTrackIR)
+ _simConnectManager.TurnOnTrackIR();
}
private void HandlePanelSelectionCompleted(object sender, EventArgs e)
@@ -272,6 +293,10 @@ namespace MSFSPopoutPanelManager.WpfApp.ViewModel
Logger.LogStatus("Panels selection is completed. Please click 'Start Pop Out' to start popping out these panels.", StatusMessageType.Info);
else
Logger.LogStatus("Panels selection is completed. No panel has been selected.", StatusMessageType.Info);
+
+ // Turn off TrackIR if TrackIR is started
+ if (DataStore.AppSetting.AutoDisableTrackIR)
+ _simConnectManager.TurnOnTrackIR();
}
private bool CanExecute(object commandParameter)
diff --git a/WpfApp/WpfApp.csproj b/WpfApp/WpfApp.csproj
index cf3eec3..4778977 100644
--- a/WpfApp/WpfApp.csproj
+++ b/WpfApp/WpfApp.csproj
@@ -4,7 +4,7 @@
WinExe
net5.0-windows
true
- 3.3.0.0
+ 3.3.1.0
MSFS 2020 Popout Panel Manager
Stanley Kwok
MSFS 2020 Popout Panel Manager