mirror of
https://github.com/hawkeye-stan/msfs-popout-panel-manager.git
synced 2024-12-28 07:11:59 +00:00
Version 3.3.1
This commit is contained in:
parent
e20d512ef8
commit
ba2f308b35
15 changed files with 112 additions and 23 deletions
|
@ -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;
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
<AssemblyName>FsConnector</AssemblyName>
|
||||
<PackageId>MSFS 2020 Popout Panel Manager FsConnector</PackageId>
|
||||
<Product>MSFS 2020 Popout Panel Manager FsConnector</Product>
|
||||
<Version>3.3.0.0</Version>
|
||||
<Version>3.3.1.0</Version>
|
||||
<Authors>Stanley Kwok</Authors>
|
||||
<Company>Stanley Kwok</Company>
|
||||
<Copyright>Stanley Kwok 2021</Copyright>
|
||||
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
|
||||
<RootNamespace>MSFSPopoutPanelManager.FsConnector</RootNamespace>
|
||||
<Platforms>x64;AnyCPU</Platforms>
|
||||
<AssemblyVersion>3.3.0.0</AssemblyVersion>
|
||||
<FileVersion>3.3.0.0</FileVersion>
|
||||
<AssemblyVersion>3.3.1.0</AssemblyVersion>
|
||||
<FileVersion>3.3.1.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<RootNamespace>MSFSPopoutPanelManager.Model</RootNamespace>
|
||||
<AssemblyName>Model</AssemblyName>
|
||||
<PackageId>MSFS 2020 Popout Panel Manager Model</PackageId>
|
||||
<Version>3.3.0.0</Version>
|
||||
<Version>3.3.1.0</Version>
|
||||
<Authors>Stanley Kwok</Authors>
|
||||
<Company>Stanley Kwok</Company>
|
||||
<Copyright>Stanley Kwok 2021</Copyright>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<RootNamespace>MSFSPopoutPanelManager.Provider</RootNamespace>
|
||||
<PackageId>MSFS 2020 Popout Panel Manager Provider</PackageId>
|
||||
<Product>MSFS 2020 Popout Panel Manager Provider</Product>
|
||||
<Version>3.3.0.0</Version>
|
||||
<Version>3.3.1.0</Version>
|
||||
<Authors>Stanley Kwok</Authors>
|
||||
<Copyright>Stanley Kwok 2021</Copyright>
|
||||
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<Company>Stanley Kwok</Company>
|
||||
<Copyright>Stanley Kwok 2021</Copyright>
|
||||
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
|
||||
<Version>3.3.0.0</Version>
|
||||
<Version>3.3.1.0</Version>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# Version History
|
||||
<hr/>
|
||||
|
||||
## 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.
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
<TreeViewItem Header="Application Settings" Selected="TreeViewItem_Selected" Margin="0,15,0,10" IsSelected="True"></TreeViewItem>
|
||||
<TreeViewItem Header="Pop Out Settings" Selected="TreeViewItem_Selected" Margin="0,0,0,10"></TreeViewItem>
|
||||
<TreeViewItem Header="Auto Pop Out Panel Settings" Selected="TreeViewItem_Selected" Margin="0,0,0,10"></TreeViewItem>
|
||||
<TreeViewItem Header="Track IR Settings" Selected="TreeViewItem_Selected" Margin="0,0,0,10"></TreeViewItem>
|
||||
</TreeView>
|
||||
<WrapPanel DockPanel.Dock="Right" Margin="20,15,20,0" Width="Auto" >
|
||||
<WrapPanel Orientation="Vertical" Width="Auto" Visibility="{Binding Path=ApplicationSettingsVisibility, Mode=TwoWay}">
|
||||
|
@ -135,6 +136,12 @@
|
|||
</WrapPanel>
|
||||
<WrapPanel Orientation="Vertical" Visibility="Visible">
|
||||
</WrapPanel>
|
||||
<WrapPanel Orientation="Vertical" Width="Auto" Visibility="{Binding Path=TrackIRSettingsVisibility, Mode=TwoWay}">
|
||||
<CheckBox IsChecked="{Binding Path=AppSetting.AutoDisableTrackIR, Mode=TwoWay}" Content="Auto Disable Track IR"></CheckBox>
|
||||
<TextBlock Style="{StaticResource TextBlockDescription}">
|
||||
Automactically disable Track IR during panel selections and pop out process. Track IR will be re-enable once these processes are completed.
|
||||
</TextBlock>
|
||||
</WrapPanel>
|
||||
</WrapPanel>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<UseWPF>true</UseWPF>
|
||||
<Version>3.3.0.0</Version>
|
||||
<Version>3.3.1.0</Version>
|
||||
<PackageId>MSFS 2020 Popout Panel Manager</PackageId>
|
||||
<Authors>Stanley Kwok</Authors>
|
||||
<Product>MSFS 2020 Popout Panel Manager</Product>
|
||||
|
|
Loading…
Reference in a new issue