1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-10-16 14:10:45 +00:00

Version 3.1

This commit is contained in:
hawkeye 2022-01-18 09:58:11 -05:00
parent 0a3d485363
commit 3be805e49a
33 changed files with 1328 additions and 868 deletions

View file

@ -5,7 +5,7 @@
<TargetFramework>net5.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<Platforms>x64;AnyCPU</Platforms>
<Version>3.0.1</Version>
<Version>3.1.0</Version>
<AssemblyName>MSFSPopoutPanelManager</AssemblyName>
<RootNamespace>MSFSPopoutPanelManager</RootNamespace>
<ApplicationIcon>WindowManager.ico</ApplicationIcon>
@ -13,8 +13,8 @@
<Product>MSFS 2020 Popout Panel Manager</Product>
<PackageId>MSFS 2020 Popout Panel Manager</PackageId>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyVersion>3.0.1.0</AssemblyVersion>
<FileVersion>3.0.1.0</FileVersion>
<AssemblyVersion>3.1.0.0</AssemblyVersion>
<FileVersion>3.1.0.0</FileVersion>
<WeaverConfiguration>
<Weavers>
<PropertyChanged />
@ -75,4 +75,13 @@
<SubType>Form</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
</Project>

View file

@ -63,7 +63,11 @@ namespace MSFSPopoutPanelManager.Provider
}
catch (Exception ex)
{
return new AppSettingData();
// if file does not exist, write default data
var appSettings = new AppSettingData();
WriteAppSettingData(appSettings);
return appSettings;
}
}

View file

@ -12,21 +12,18 @@ namespace MSFSPopoutPanelManager.Provider
{
private IKeyboardMouseEvents _mouseHook;
private int _panelIndex;
private Form _appForm;
public event EventHandler OnSelectionStarted;
public event EventHandler OnSelectionCompleted;
public event EventHandler<EventArgs<PanelSourceCoordinate>> OnPanelAdded;
public event EventHandler OnPanelSubtracted;
public List<PanelSourceCoordinate> PanelCoordinates { get; set; }
public PanelSelectionManager()
public PanelSelectionManager(Form form)
{
PanelCoordinates = new List<PanelSourceCoordinate>();
_appForm = form;
}
public Form AppForm { get; set; }
public void Start()
{
if (_mouseHook == null)
@ -36,74 +33,31 @@ namespace MSFSPopoutPanelManager.Provider
}
_panelIndex = 1;
PanelCoordinates = new List<PanelSourceCoordinate>();
ShowPanelLocationOverlay(true);
OnSelectionStarted?.Invoke(this, null);
DrawPanelLocationOverlay();
Logger.Status("Panels selection has started.", StatusMessageType.Info);
}
public void Reset()
{
PanelCoordinates = new List<PanelSourceCoordinate>();
_panelIndex = 1;
DrawPanelLocationOverlay();
ShowPanelLocationOverlay(false);
}
public void DrawPanelLocationOverlay()
public void ShowPanelLocationOverlay(bool show)
{
// close all overlays
for (int i = Application.OpenForms.Count - 1; i >= 0; i--)
{
if (Application.OpenForms[i].GetType() == typeof(PopoutCoorOverlayForm))
Application.OpenForms[i].Close();
}
if (PanelCoordinates.Count > 0)
if (show && PanelCoordinates.Count > 0)
{
foreach (var coor in PanelCoordinates)
WindowManager.AddPanelLocationSelectionOverlay(coor.PanelIndex.ToString(), coor.X, coor.Y);
}
}
public void ShowPanelLocationOverlay(bool show)
{
for (int i = 0; i < Application.OpenForms.Count; i++)
{
if (Application.OpenForms[i].GetType() == typeof(PopoutCoorOverlayForm))
Application.OpenForms[i].Visible = show;
}
}
private void Stop()
{
if (_mouseHook != null)
{
_mouseHook.MouseDownExt -= HandleMouseHookMouseDownExt;
_mouseHook.Dispose();
_mouseHook = null;
}
// If enable, save the current viewport into custom view by Ctrl-Alt-0
if (FileManager.ReadAppSettingData().UseAutoPanning)
{
var simualatorProcess = WindowManager.GetSimulatorProcess();
if (simualatorProcess != null)
{
InputEmulationManager.SaveCustomViewZero(simualatorProcess.Handle);
Thread.Sleep(500);
}
}
OnSelectionCompleted?.Invoke(this, null);
DrawPanelLocationOverlay();
}
private void HandleMouseHookMouseDownExt(object sender, MouseEventExtArgs e)
{
if (e.Button == MouseButtons.Left)
@ -113,44 +67,40 @@ namespace MSFSPopoutPanelManager.Provider
if (ctrlPressed)
{
Stop();
if (_mouseHook != null)
{
_mouseHook.MouseDownExt -= HandleMouseHookMouseDownExt;
_mouseHook.Dispose();
_mouseHook = null;
}
if (PanelCoordinates.Count > 0)
Logger.Status("Panels selection is completed. Please click 'Start Pop Out' to start popping out these panels.", StatusMessageType.Info);
else
Logger.Status("Panels selection is completed. No panel has been selected.", StatusMessageType.Info);
// Bring app windows back to top
PInvoke.SetForegroundWindow(AppForm.Handle);
OnSelectionCompleted?.Invoke(this, null);
}
else if (shiftPressed && Application.OpenForms.Count >= 1)
{
if (Application.OpenForms[Application.OpenForms.Count - 1].GetType() == typeof(PopoutCoorOverlayForm))
{
// Remove last drawn overlay
Application.OpenForms[Application.OpenForms.Count - 1].Close();
PanelCoordinates.RemoveAt(PanelCoordinates.Count - 1);
OnPanelSubtracted?.Invoke(this, e);
_panelIndex--;
DrawPanelLocationOverlay();
}
}
else if (!shiftPressed)
{
var minX = AppForm.Location.X;
var minY = AppForm.Location.Y;
var maxX = AppForm.Location.X + AppForm.Width;
var maxY = AppForm.Location.Y + AppForm.Height;
var minX = _appForm.Location.X;
var minY = _appForm.Location.Y;
var maxX = _appForm.Location.X + _appForm.Width;
var maxY = _appForm.Location.Y + _appForm.Height;
if (e.X < minX || e.X > maxX || e.Y < minY || e.Y > maxY)
{
var newPanelCoordinates = new PanelSourceCoordinate() { PanelIndex = _panelIndex, X = e.X, Y = e.Y };
PanelCoordinates.Add(newPanelCoordinates);
OnPanelAdded?.Invoke(this, new EventArgs<PanelSourceCoordinate>(newPanelCoordinates));
WindowManager.AddPanelLocationSelectionOverlay(_panelIndex.ToString(), e.X, e.Y);
_panelIndex++;
}
DrawPanelLocationOverlay();
}
}
}

View file

@ -53,18 +53,14 @@ namespace MSFSPopoutPanelManager.Provider
else
{
_profile.PanelConfigs = popoutReslts;
Logger.Status("Panels have been popped out succesfully. Please click 'Save Profile' once you're done making adjustment to the panels.", StatusMessageType.Info);
Logger.Status("Panels have been popped out succesfully.", StatusMessageType.Info);
}
// If enable, center the view port by Ctrl-Space
if (FileManager.ReadAppSettingData().UseAutoPanning)
{
// Recenter the view port by Ctrl-Space
var simualatorProcess = WindowManager.GetSimulatorProcess();
if (simualatorProcess != null)
{
InputEmulationManager.CenterView(simualatorProcess.Handle);
Thread.Sleep(500);
}
}
return true;
@ -106,8 +102,8 @@ namespace MSFSPopoutPanelManager.Provider
else
{
var panel = GetCustomPopoutPanelByIndex(i);
panel.PanelName = $"Panel{i + 1} (Custom)";
PInvoke.SetWindowText(panel.PanelHandle, panel.PanelName);
panel.PanelName = $"Panel{i + 1}";
PInvoke.SetWindowText(panel.PanelHandle, panel.PanelName + " (Custom)");
break;
}
}
@ -131,8 +127,8 @@ namespace MSFSPopoutPanelManager.Provider
var panel = GetCustomPopoutPanelByIndex(i);
PInvoke.MoveWindow(panel.PanelHandle, 0, 0, 800, 600, true);
panel.PanelName = $"Panel{i + 1} (Custom)";
PInvoke.SetWindowText(panel.PanelHandle, panel.PanelName);
panel.PanelName = $"Panel{i + 1}";
PInvoke.SetWindowText(panel.PanelHandle, panel.PanelName + " (Custom)");
break;
}
}
@ -204,7 +200,8 @@ namespace MSFSPopoutPanelManager.Provider
});
_profile.PanelConfigs.RemoveAll(x => x.PanelHandle == IntPtr.Zero && x.PanelType == PanelType.BuiltInPopout);
//_profile.PanelConfigs.RemoveAll(x => x.PanelHandle == IntPtr.Zero && x.PanelType == PanelType.BuiltInPopout);
_profile.PanelConfigs.RemoveAll(x => x.PanelHandle == IntPtr.Zero);
//_profile.PanelSettings.ForEach(panel =>
Parallel.ForEach(_profile.PanelConfigs, panel =>
@ -214,7 +211,11 @@ namespace MSFSPopoutPanelManager.Provider
// Apply panel name
if (panel.PanelType == PanelType.CustomPopout)
{
PInvoke.SetWindowText(panel.PanelHandle, panel.PanelName);
var name = panel.PanelName;
if (name.IndexOf("(Custom)") == -1)
name = name + " (Custom)";
PInvoke.SetWindowText(panel.PanelHandle, name);
Thread.Sleep(500);
}
@ -234,6 +235,8 @@ namespace MSFSPopoutPanelManager.Provider
{
WindowManager.ApplyHidePanelTitleBar(panel.PanelHandle, true);
}
PInvoke.ShowWindow(panel.PanelHandle, PInvokeConstant.SW_RESTORE);
}
});
}

View file

@ -9,21 +9,6 @@ namespace MSFSPopoutPanelManager.Provider
{
public class WindowManager
{
private const int SWP_NOMOVE = 0x0002;
private const int SWP_NOSIZE = 0x0001;
private const int SWP_ALWAYS_ON_TOP = SWP_NOMOVE | SWP_NOSIZE;
private const int GWL_STYLE = -16;
private const int WS_SIZEBOX = 0x00040000;
private const int WS_BORDER = 0x00800000;
private const int WS_DLGFRAME = 0x00400000;
private const int WS_CAPTION = WS_BORDER | WS_DLGFRAME;
private const int HWND_TOPMOST = -1;
private const int HWND_NOTOPMOST = -2;
private const uint WM_CLOSE = 0x0010;
public static void AddPanelLocationSelectionOverlay(string text, int x, int y)
{
PopoutCoorOverlayForm frm = new PopoutCoorOverlayForm();
@ -35,25 +20,32 @@ namespace MSFSPopoutPanelManager.Provider
public static void ApplyHidePanelTitleBar(IntPtr handle, bool hideTitleBar)
{
var currentStyle = PInvoke.GetWindowLong(handle, GWL_STYLE).ToInt64();
var currentStyle = PInvoke.GetWindowLong(handle, PInvokeConstant.GWL_STYLE).ToInt64();
if (hideTitleBar)
PInvoke.SetWindowLong(handle, GWL_STYLE, (uint)(currentStyle & ~(WS_CAPTION | WS_SIZEBOX)));
PInvoke.SetWindowLong(handle, PInvokeConstant.GWL_STYLE, (uint)(currentStyle & ~(PInvokeConstant.WS_CAPTION | PInvokeConstant.WS_SIZEBOX)));
else
PInvoke.SetWindowLong(handle, GWL_STYLE, (uint)(currentStyle | (WS_CAPTION | WS_SIZEBOX)));
PInvoke.SetWindowLong(handle, PInvokeConstant.GWL_STYLE, (uint)(currentStyle | (PInvokeConstant.WS_CAPTION | PInvokeConstant.WS_SIZEBOX)));
}
public static void ApplyAlwaysOnTop(IntPtr handle, bool alwaysOnTop, Rectangle panelRectangle)
{
if (alwaysOnTop)
PInvoke.SetWindowPos(handle, HWND_TOPMOST, panelRectangle.Left, panelRectangle.Top, panelRectangle.Width, panelRectangle.Height, SWP_ALWAYS_ON_TOP);
PInvoke.SetWindowPos(handle, PInvokeConstant.HWND_TOPMOST, panelRectangle.Left, panelRectangle.Top, panelRectangle.Width, panelRectangle.Height, PInvokeConstant.SWP_ALWAYS_ON_TOP);
else
PInvoke.SetWindowPos(handle, HWND_NOTOPMOST, panelRectangle.Left, panelRectangle.Top, panelRectangle.Width, panelRectangle.Height, 0);
PInvoke.SetWindowPos(handle, PInvokeConstant.HWND_NOTOPMOST, panelRectangle.Left, panelRectangle.Top, panelRectangle.Width, panelRectangle.Height, 0);
}
public static void CloseWindow(IntPtr handle)
{
PInvoke.SendMessage(handle, WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
PInvoke.SendMessage(handle, PInvokeConstant.WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
}
public static void MoveWindow(IntPtr handle, int x, int y)
{
Rectangle rectangle;
PInvoke.GetClientRect(handle, out rectangle);
PInvoke.MoveWindow(handle, x, y, rectangle.Width, rectangle.Height, false);
}
public static WindowProcess GetSimulatorProcess()
@ -83,5 +75,27 @@ namespace MSFSPopoutPanelManager.Provider
return null;
}
public static void CloseAllCustomPopoutPanels()
{
PInvoke.EnumWindows(new PInvoke.CallBack(EnumAllCustomPopoutPanels), 1);
}
private static bool EnumAllCustomPopoutPanels(IntPtr hwnd, int index)
{
var className = PInvoke.GetClassName(hwnd);
var caption = PInvoke.GetWindowText(hwnd);
if (className == "AceApp" && (caption.IndexOf("(Custom)") > -1 || caption == String.Empty)) // Only close non-builtin pop out panels
{
WindowManager.CloseWindow(hwnd);
}
else if (className == "AceApp") // for builtin pop out (ATC, VFR Map, ect)
{
WindowManager.MoveWindow(hwnd, 0, 0);
}
return true;
}
}
}

View file

@ -12,7 +12,8 @@ MSFS Pop Out Panel Manager is an application for MSFS 2020 which helps pop out,
* New Cold Start feature. Panels can be popped out and recalled later even when they're not turned on.
* New Auto Panning feature remembers the cockpit camera angle when you first define the pop out panels. You can now pan, zoom in, and zoom out to identify offscreen panels and the camera angle will be saved and reused. This feature requires the use of Ctrl-Alt-0 and Alt-0 keyboard binding to save custom camera view per plane configuration. If the keyboard binding is currently being used. The auto-panning feature will overwrite the saved camera view if enabled.
* New fine-grain control in positioning panels down to pixel level.
* New user friendly features such as Always on Top, realtime readout as you position panels, a more intuitive user interface and status messages.
* New user-friendly features such as Always on Top, real time readout as you position panels, a more intuitive user interface and status messages.
* New auto save feature. All profile and panel changes get save automatically.
* Technical: Rewritten code base to improve code structure and performance.
@ -20,7 +21,7 @@ MSFS Pop Out Panel Manager is an application for MSFS 2020 which helps pop out,
In MSFS, by holding **RIGHT ALT** + **LEFT CLICKING** some instrumentation panels, these panels will pop out as floating windows that can be moved to a different monitor. But this needs to be done every time you start a new flight, ALT-RIGHT clicking, split out child windows, move these windows to final location, rinse and repeat. For predefined toolbar menu windows such as ATC, Checklist, VFR Map, their positions can be saved easily and reposition at the start of each new flight using 3rd party windows positioning tool because these windows have a **TITLE** in the title bar when they are popped out. But any custom pop outs such as PFD and MFD do not have window title. This makes remembering their last used position more difficult and it seems very annoying to resize and re-adjust their positions to be used by Air Manager or other overlay tool on each new flight.
## Concepts of the Application
What if you can do the setup once by defining on screen where the pop out panels will be, click a button, and the application will pop these panels out and separate them for you. Then you just need to move these panels to their final positions. Next time when you start a flight, with a single button click, your panels will automatically pop out for you and move to their preconfigured positions. Easy peasy!
What if you can do the setup once by defining on screen where the pop out panels will be, click a button, and the application will pop these panels out and separate them for you. Then you just need to move these panels to their final positions. Next time when you start a flight, with a single button click, your panels will automatically pop out for you and move to their preconfigured positions. Easy peasy lemon squeezy!
Before v3.0 of the application, heavy image recognition was used to figure out how to pop out and separate the panels, figure out which panel is which by plane type and configure them accordingly. Although, the image recognition is reasonably accurate, there is lot to be desired. Especially on Cold Start, image recognition will not work at all because all panels are black to start with.
@ -28,7 +29,7 @@ With v3.0, redesign from the ground up about how to pop out and separate the pan
## How to Use?
[Here](images/doc/userguide.mp4) is a video of what the app will do. TBD: will get update to show v3.0.
[Here](images/doc/userguide.mp4) or [Online](https://vimeo.com/668430955) is a video of how the app works.
1. Start the application **MSFSPopoutPanelManager.exe** and it will automatically connect when MSFS starts. You maybe prompt to download .NET framework 5.0. Please see the screenshot below to download and install x64 desktop version of the framework.
@ -50,13 +51,13 @@ With v3.0, redesign from the ground up about how to pop out and separate the pan
4. Now, click "Start Pop Out". At this point, please be patient. The application will start popping out and separating panels one by one and you will see a lot of movement on the screen. If something goes wrong, just follow the instruction in the status message and try again.
5. Once the process is done, you will see a list of panels line up in the upper left corner of the screen. All the panels are give a default name. You can name them anything you want if desire. Please go ahead and click "Save Profile". This will save the initial pop out configuration for this profile.
5. Once the process is done, you will see a list of panels line up in the upper left corner of the screen. All the panels are given a default name. You can name them anything you want if desire.
<p align="center">
<img src="images/doc/v3.0/s2.png" width="1000" hspace="10"/>
</p>
6. Now, start the panel configruation by dragging the pop out panels into their final position. You can also type value directly into the data grid to move and resize a panel. The +/- pixel buttons by the lower left corner of the grid allow you to change panel position at the chosen increment/decrement by selecting the datagrid cell (X-Pos, Y-Pos, Width, Height). You can also select "Always on top" and "Hide titlebar" if desire. Once all the panels are at their final position, just click "Save Profile" again.
6. Now, start the panel configuration by dragging the pop out panels into their final position. You can also type value directly into the data grid to move and resize a panel. The +/- pixel buttons by the lower left corner of the grid allow you to change panel position at the chosen increment/decrement by selecting the datagrid cell (X-Pos, Y-Pos, Width, Height). You can also select "Always on Top" and "Hide Titlebar" if desire. Once all the panels are at their final position, just click "Lock Panel" to prevent further panel changes.
<p align="center">
<img src="images/doc/v3.0/s3.png" width="600" hspace="10"/>
@ -66,7 +67,7 @@ With v3.0, redesign from the ground up about how to pop out and separate the pan
<img src="images/doc/v3.0/s4.png" width="1000" hspace="10"/>
</p>
7. To test if everything is working. Once the profile is saved, please click "Restart". This will close all the pop out (except the main menu bar ones) and you're back to the start of the application. Now click "Start Pop Out" and see the magic happens!
7. To test if everything is working. Once the profile is saved, please click "Restart" in the File menu. This will close all pop out, except the built-in ones from the game main menu bar, and you're back to the start of the application. Now click "Start Pop Out" and see the magic happens!
8. With auto panning feature enabled, you do not have to line up the circles that identified the panels in order for the panels to be popped out. But if you would like to do it manually without auto-panning, on next start of the flight, just line up the panels before clicking "Start Pop Out".
@ -86,22 +87,21 @@ The user plane profile data and application settings data are stored as JSON fil
* userdata/userprofiledata.json
* userdata/appsettingdata.json
Note for technical user. If you would like to transfer existing profile data into v3.0 file format, you can first create a new profile in v3.0 of the app with the same panels and save it. Then you can open previous version of the configuration in config/userdata.json. You can match the old JSON attribute of "PanelDestinationList" of (Top, Left, Width, Height) for each panel and tranfer it over to the new file JSON attribute of "PanelConfigs". Please edit at your own risk.
Note for technical user. If you would like to transfer existing profile data into v3.0 file format, you can first create a new profile in v3.0 of the app with the same panels and save it. Then you can open previous version of the configuration in config/userdata.json. You can match the old JSON attribute of "PanelDestinationList" of (Top, Left, Width, Height) for each panel and transfer it over to the new file JSON attribute of "PanelConfigs". Please edit at your own risk.
## Current Known Issue
* You may encounter a bug with MSFS where a pop out panel is not Right-Alt clickable or the same panel is able to be popped out twice. This causes the application to not function properly. A new MSFS bug introduced since SU7 which I haven't encountered before?
* Sometimes when using the auto-panning feature, the keyboard combination of Ctrl-Alt-0 and Alt-0 do not work to save and load panel panning coordiates. First try to restart the flightsim and it usually fixes the problem. Otherwise, the only way to fix this is to redo the profile if you want the auto-panning feature since the camera angle is only being saved during the initial creation of the profile. The is another MSFS bug.
* If running the game in windows mode on your non-primary monitor in a multi-monitor setup with differnt display resolution, panel identification and separation may not work correctly.
* Sometimes when using the auto-panning feature, the keyboard combination of Ctrl-Alt-0 and Alt-0 do not work to save and load panel panning coordinates. First try to restart the flightsim and it usually fixes the problem. Otherwise, the only way to fix this is to redo the profile if you want the auto-panning feature since the camera angle is only being saved during the initial creation of the profile. The is another MSFS bug.
* If running the game in windows mode on your non-primary monitor in a multi-monitor setup with different display resolution, panel identification and separation may not work correctly.
* Current application package size is bigger than previous version of the application because it is not a single EXE file package. With added feature of exception logging and stack trace to support user feedback and troubleshooting, a Single EXE package in .NET 5.0 as well as .NET 6.0 has a bug that stack trace information is not complete. Hopefully, Microsoft will be fixing this problem.
## Common Problem Resolution
* Unable to pop out panels when creating a profile for the first time with error such as "Unabled to pop out panel #X". If the panel is not being obstructed, by changing the sequence of the pop out when defining the profile may help solve the issue. Currently there are some panels in certain plane configuration that does not follow predefined MSFS pop out rule.
* Unable to pop out panels when creating a profile for the first time with error such as "Unable to pop out panel #X". If the panel is not being obstructed, by changing the sequence of the pop out when defining the profile may help solve the issue. Currently there are some panels in certain plane configuration that does not follow predefined MSFS pop out rule.
* Unable to pop out panels on subsequent flight. Please follow status message instruction. Also, if using auto-panning, Ctrl-Alt-0 may not have been saved correctly during profile creation. You will be able to fix thie by manually line up the panel circles identifier and do a force save view by pressing Ctrl-Alt-0.
* Unable to pop out panels on subsequent flight. Please follow status message instruction. Also, if using auto-panning, Ctrl-Alt-0 may not have been saved correctly during profile creation. You will be able to fix this by manually line up the panel circles identifier and do a force save view by pressing Ctrl-Alt-0.
* Unable to pop out ALL panels. This may indicate a potential miscount of selected panels (circles) and the number of actual panels that got popped out. You may have duplicate panels in your selection or panels that cannot be popped out.

View file

@ -1,4 +1,6 @@
namespace MSFSPopoutPanelManager.Shared
using Newtonsoft.Json;
namespace MSFSPopoutPanelManager.Shared
{
public class AppSettingData
{
@ -15,5 +17,8 @@
public bool AlwaysOnTop { get; set; }
public bool UseAutoPanning { get; set; }
[JsonIgnore]
public bool AutoStart { get; set; }
}
}

53
Shared/DataStore.cs Normal file
View file

@ -0,0 +1,53 @@
using System.Linq;
using System.ComponentModel;
namespace MSFSPopoutPanelManager.Shared
{
public class DataStore : INotifyPropertyChanged
{
private int _activeProfileId;
public event PropertyChangedEventHandler PropertyChanged;
public DataStore()
{
_activeProfileId = -1;
ActiveUserProfile = null;
ActiveProfilePanelCoordinates = new BindingList<PanelSourceCoordinate>();
PanelConfigs = new BindingList<PanelConfig>();
}
public BindingList<UserProfileData> UserProfiles { get; set; }
public BindingList<PanelSourceCoordinate> ActiveProfilePanelCoordinates { get; set; }
public BindingList<PanelConfig> PanelConfigs { get; set; }
public UserProfileData ActiveUserProfile { get; set; }
public int ActiveUserProfileId
{
get
{
return _activeProfileId;
}
set
{
_activeProfileId = value;
if(value == -1)
{
ActiveUserProfile = null;
ActiveProfilePanelCoordinates.Clear();
}
else
{
ActiveUserProfile = UserProfiles.ToList().Find(x => x.ProfileId == value);
ActiveProfilePanelCoordinates.Clear();
ActiveUserProfile.PanelSourceCoordinates.ForEach(c => ActiveProfilePanelCoordinates.Add(c));
}
}
}
}
}

View file

@ -5,6 +5,35 @@ using System.Text;
namespace MSFSPopoutPanelManager.Shared
{
public static class PInvokeConstant
{
public const int SW_SHOWNORMAL = 1;
public const int SW_SHOWMINIMIZED = 2;
public const int SW_SHOWMAXIMIZED = 3;
public const int SW_NORMAL = 1;
public const int SW_MINIMIZE = 6;
public const int SW_RESTORE = 9;
public const uint EVENT_SYSTEM_MOVESIZEEND = 0x000B;
public const uint EVENT_OBJECT_LOCATIONCHANGE = 0x800B;
public const int SWP_NOMOVE = 0x0002;
public const int SWP_NOSIZE = 0x0001;
public const int SWP_ALWAYS_ON_TOP = SWP_NOMOVE | SWP_NOSIZE;
public const int GWL_STYLE = -16;
public const int WS_SIZEBOX = 0x00040000;
public const int WS_BORDER = 0x00800000;
public const int WS_DLGFRAME = 0x00400000;
public const int WS_CAPTION = WS_BORDER | WS_DLGFRAME;
public const int HWND_TOPMOST = -1;
public const int HWND_NOTOPMOST = -2;
public const uint WM_CLOSE = 0x0010;
public const int WINEVENT_OUTOFCONTEXT = 0;
}
public class PInvoke
{
[DllImport("user32")]
@ -30,6 +59,10 @@ namespace MSFSPopoutPanelManager.Shared
[DllImport("user32.dll")]
public static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);
[DllImport("user32.dll")]
public static extern int GetWindowRect(IntPtr hwnd, out Rectangle lpRect);
@ -76,6 +109,9 @@ namespace MSFSPopoutPanelManager.Shared
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr SetWinEventHook(uint eventMin, uint eventMax, IntPtr hmodWinEventProc, WinEventProc lpfnWinEventProc, int idProcess, int idThread, uint dwflags);
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")]
public static extern int UnhookWinEvent(IntPtr hWinEventHook);
@ -83,4 +119,16 @@ namespace MSFSPopoutPanelManager.Shared
public delegate void WinEventProc(IntPtr hWinEventHook, uint iEvent, IntPtr hWnd, int idObject, int idChild, int dwEventThread, int dwmsEventTime);
}
[StructLayout(LayoutKind.Sequential)]
public struct WINDOWPLACEMENT
{
public int length;
public int flags;
public int showCmd;
public Point ptMinPosition;
public Point ptMaxPosition;
public Rectangle rcNormalPosition;
public Rectangle rcDevice;
}
}

View file

@ -10,6 +10,7 @@ namespace MSFSPopoutPanelManager.Shared
{
PanelSourceCoordinates = new List<PanelSourceCoordinate>();
PanelConfigs = new List<PanelConfig>();
IsLocked = false;
}
public int ProfileId { get; set; }
@ -18,9 +19,18 @@ namespace MSFSPopoutPanelManager.Shared
public bool IsDefaultProfile { get; set; }
public bool IsLocked { get; set; }
public List<PanelSourceCoordinate> PanelSourceCoordinates;
public List<PanelConfig> PanelConfigs { get; set; }
public void Reset()
{
PanelSourceCoordinates.Clear();
PanelConfigs.Clear();
IsLocked = false;
}
}
public class PanelSourceCoordinate

View file

@ -32,44 +32,40 @@ namespace MSFSPopoutPanelManager.UI
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(StartupForm));
this.panelSteps = new System.Windows.Forms.Panel();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.labelMsfsConnection = new System.Windows.Forms.Label();
this.panelStatus = new System.Windows.Forms.Panel();
this.darkLabel3 = new DarkUI.Controls.DarkLabel();
this.txtBoxStatus = new DarkUI.Controls.DarkTextBox();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.darkLabel1 = new DarkUI.Controls.DarkLabel();
this.darkLabel2 = new DarkUI.Controls.DarkLabel();
this.checkBoxMinimizeToTray = new DarkUI.Controls.DarkCheckBox();
this.lblVersion = new DarkUI.Controls.DarkLabel();
this.checkBoxAutoStart = new DarkUI.Controls.DarkCheckBox();
this.checkBoxAutoPanning = new DarkUI.Controls.DarkCheckBox();
this.checkBoxAlwaysOnTop = new DarkUI.Controls.DarkCheckBox();
this.darkMenuStrip1 = new DarkUI.Controls.DarkMenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuItem_restart = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.preferencesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuItem_alwaysOnTop = new System.Windows.Forms.ToolStripMenuItem();
this.menuItem_autoPanning = new System.Windows.Forms.ToolStripMenuItem();
this.menuItem_autoStart = new System.Windows.Forms.ToolStripMenuItem();
this.menuItem_minimizeToSystemTray = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.menuItem_exit = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuItem_minimizeAllPanels = new System.Windows.Forms.ToolStripMenuItem();
this.menuItem_help = new System.Windows.Forms.ToolStripMenuItem();
this.menuItem_userGuide = new System.Windows.Forms.ToolStripMenuItem();
this.menuItem_downloadLatestRelease = new System.Windows.Forms.ToolStripMenuItem();
this.panelStatus.SuspendLayout();
this.darkMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// panelSteps
//
this.panelSteps.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(61)))), ((int)(((byte)(101)))), ((int)(((byte)(171)))));
this.panelSteps.Location = new System.Drawing.Point(0, 64);
this.panelSteps.Location = new System.Drawing.Point(0, 30);
this.panelSteps.Name = "panelSteps";
this.panelSteps.Size = new System.Drawing.Size(915, 405);
this.panelSteps.TabIndex = 0;
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.linkLabel1.LinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.linkLabel1.Location = new System.Drawing.Point(344, 35);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(41, 21);
this.linkLabel1.TabIndex = 1;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "here";
this.linkLabel1.VisitedLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
//
// labelMsfsConnection
//
this.labelMsfsConnection.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -78,7 +74,7 @@ namespace MSFSPopoutPanelManager.UI
this.labelMsfsConnection.AutoSize = true;
this.labelMsfsConnection.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.labelMsfsConnection.ForeColor = System.Drawing.Color.Red;
this.labelMsfsConnection.Location = new System.Drawing.Point(766, 546);
this.labelMsfsConnection.Location = new System.Drawing.Point(763, 511);
this.labelMsfsConnection.Name = "labelMsfsConnection";
this.labelMsfsConnection.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.labelMsfsConnection.Size = new System.Drawing.Size(33, 20);
@ -90,7 +86,7 @@ namespace MSFSPopoutPanelManager.UI
//
this.panelStatus.Controls.Add(this.darkLabel3);
this.panelStatus.Controls.Add(this.txtBoxStatus);
this.panelStatus.Location = new System.Drawing.Point(0, 469);
this.panelStatus.Location = new System.Drawing.Point(0, 435);
this.panelStatus.Name = "panelStatus";
this.panelStatus.Size = new System.Drawing.Size(915, 74);
this.panelStatus.TabIndex = 20;
@ -126,96 +122,194 @@ namespace MSFSPopoutPanelManager.UI
this.notifyIcon1.Visible = true;
this.notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick);
//
// darkLabel1
//
this.darkLabel1.AutoSize = true;
this.darkLabel1.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
this.darkLabel1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.darkLabel1.Location = new System.Drawing.Point(13, 9);
this.darkLabel1.Name = "darkLabel1";
this.darkLabel1.Size = new System.Drawing.Size(591, 25);
this.darkLabel1.TabIndex = 21;
this.darkLabel1.Text = "Welcome and thank you for using MSFS Pop Out Panel Manager!";
//
// darkLabel2
//
this.darkLabel2.AutoSize = true;
this.darkLabel2.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.darkLabel2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.darkLabel2.Location = new System.Drawing.Point(13, 36);
this.darkLabel2.Name = "darkLabel2";
this.darkLabel2.Size = new System.Drawing.Size(334, 20);
this.darkLabel2.TabIndex = 22;
this.darkLabel2.Text = "Instruction on how to use this utility can be found";
//
// checkBoxMinimizeToTray
//
this.checkBoxMinimizeToTray.AutoSize = true;
this.checkBoxMinimizeToTray.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.checkBoxMinimizeToTray.Location = new System.Drawing.Point(13, 545);
this.checkBoxMinimizeToTray.Name = "checkBoxMinimizeToTray";
this.checkBoxMinimizeToTray.Size = new System.Drawing.Size(189, 24);
this.checkBoxMinimizeToTray.TabIndex = 23;
this.checkBoxMinimizeToTray.Text = "Minimize to System Tray";
//
// lblVersion
//
this.lblVersion.AutoSize = true;
this.lblVersion.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.lblVersion.Location = new System.Drawing.Point(423, 591);
this.lblVersion.Location = new System.Drawing.Point(423, 520);
this.lblVersion.Name = "lblVersion";
this.lblVersion.Size = new System.Drawing.Size(48, 15);
this.lblVersion.TabIndex = 24;
this.lblVersion.Text = "Version ";
//
// checkBoxAutoStart
// darkMenuStrip1
//
this.checkBoxAutoStart.AutoSize = true;
this.checkBoxAutoStart.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.checkBoxAutoStart.Location = new System.Drawing.Point(210, 545);
this.checkBoxAutoStart.Name = "checkBoxAutoStart";
this.checkBoxAutoStart.Size = new System.Drawing.Size(95, 24);
this.checkBoxAutoStart.TabIndex = 25;
this.checkBoxAutoStart.Text = "Auto Start";
this.darkMenuStrip1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.darkMenuStrip1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.darkMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.viewToolStripMenuItem,
this.menuItem_help});
this.darkMenuStrip1.Location = new System.Drawing.Point(0, 0);
this.darkMenuStrip1.Name = "darkMenuStrip1";
this.darkMenuStrip1.Padding = new System.Windows.Forms.Padding(3, 2, 0, 2);
this.darkMenuStrip1.Size = new System.Drawing.Size(914, 28);
this.darkMenuStrip1.TabIndex = 29;
this.darkMenuStrip1.Text = "darkMenuStrip1";
//
// checkBoxAutoPanning
// fileToolStripMenuItem
//
this.checkBoxAutoPanning.AutoSize = true;
this.checkBoxAutoPanning.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.checkBoxAutoPanning.Location = new System.Drawing.Point(441, 545);
this.checkBoxAutoPanning.Name = "checkBoxAutoPanning";
this.checkBoxAutoPanning.Size = new System.Drawing.Size(116, 24);
this.checkBoxAutoPanning.TabIndex = 27;
this.checkBoxAutoPanning.Text = "Auto Panning";
this.fileToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuItem_restart,
this.toolStripSeparator1,
this.preferencesToolStripMenuItem,
this.toolStripSeparator2,
this.menuItem_exit});
this.fileToolStripMenuItem.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.fileToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24);
this.fileToolStripMenuItem.Text = "File";
//
// checkBoxAlwaysOnTop
// menuItem_restart
//
this.checkBoxAlwaysOnTop.AutoSize = true;
this.checkBoxAlwaysOnTop.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.checkBoxAlwaysOnTop.Location = new System.Drawing.Point(311, 545);
this.checkBoxAlwaysOnTop.Name = "checkBoxAlwaysOnTop";
this.checkBoxAlwaysOnTop.Size = new System.Drawing.Size(124, 24);
this.checkBoxAlwaysOnTop.TabIndex = 28;
this.checkBoxAlwaysOnTop.Text = "Always on Top";
this.menuItem_restart.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.menuItem_restart.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.menuItem_restart.Name = "menuItem_restart";
this.menuItem_restart.Size = new System.Drawing.Size(154, 24);
this.menuItem_restart.Text = "Restart";
//
// toolStripSeparator1
//
this.toolStripSeparator1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.toolStripSeparator1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.toolStripSeparator1.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(151, 6);
//
// preferencesToolStripMenuItem
//
this.preferencesToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.preferencesToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuItem_alwaysOnTop,
this.menuItem_autoPanning,
this.menuItem_autoStart,
this.menuItem_minimizeToSystemTray});
this.preferencesToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.preferencesToolStripMenuItem.Name = "preferencesToolStripMenuItem";
this.preferencesToolStripMenuItem.Size = new System.Drawing.Size(154, 24);
this.preferencesToolStripMenuItem.Text = "Preferences";
//
// menuItem_alwaysOnTop
//
this.menuItem_alwaysOnTop.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.menuItem_alwaysOnTop.CheckOnClick = true;
this.menuItem_alwaysOnTop.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.menuItem_alwaysOnTop.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.menuItem_alwaysOnTop.Name = "menuItem_alwaysOnTop";
this.menuItem_alwaysOnTop.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.T)));
this.menuItem_alwaysOnTop.Size = new System.Drawing.Size(256, 24);
this.menuItem_alwaysOnTop.Text = "Always on Top ";
this.menuItem_alwaysOnTop.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage;
//
// menuItem_autoPanning
//
this.menuItem_autoPanning.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.menuItem_autoPanning.CheckOnClick = true;
this.menuItem_autoPanning.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.menuItem_autoPanning.Name = "menuItem_autoPanning";
this.menuItem_autoPanning.Size = new System.Drawing.Size(256, 24);
this.menuItem_autoPanning.Text = "Auto Panning";
//
// menuItem_autoStart
//
this.menuItem_autoStart.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.menuItem_autoStart.CheckOnClick = true;
this.menuItem_autoStart.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.menuItem_autoStart.Name = "menuItem_autoStart";
this.menuItem_autoStart.Size = new System.Drawing.Size(256, 24);
this.menuItem_autoStart.Text = "Auto Start";
//
// menuItem_minimizeToSystemTray
//
this.menuItem_minimizeToSystemTray.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.menuItem_minimizeToSystemTray.CheckOnClick = true;
this.menuItem_minimizeToSystemTray.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.menuItem_minimizeToSystemTray.Name = "menuItem_minimizeToSystemTray";
this.menuItem_minimizeToSystemTray.Size = new System.Drawing.Size(256, 24);
this.menuItem_minimizeToSystemTray.Text = "Minimize to Tray";
//
// toolStripSeparator2
//
this.toolStripSeparator2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.toolStripSeparator2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.toolStripSeparator2.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(151, 6);
//
// menuItem_exit
//
this.menuItem_exit.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.menuItem_exit.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.menuItem_exit.Name = "menuItem_exit";
this.menuItem_exit.Size = new System.Drawing.Size(154, 24);
this.menuItem_exit.Text = "Exit";
//
// viewToolStripMenuItem
//
this.viewToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuItem_minimizeAllPanels});
this.viewToolStripMenuItem.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.viewToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
this.viewToolStripMenuItem.Size = new System.Drawing.Size(122, 24);
this.viewToolStripMenuItem.Text = "View";
//
// menuItem_minimizeAllPanels
//
this.menuItem_minimizeAllPanels.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.menuItem_minimizeAllPanels.CheckOnClick = true;
this.menuItem_minimizeAllPanels.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.menuItem_minimizeAllPanels.Name = "menuItem_minimizeAllPanels";
this.menuItem_minimizeAllPanels.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.M)));
this.menuItem_minimizeAllPanels.Size = new System.Drawing.Size(281, 24);
this.menuItem_minimizeAllPanels.Text = "Minimize All Panels ";
//
// menuItem_help
//
this.menuItem_help.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.menuItem_help.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuItem_userGuide,
this.menuItem_downloadLatestRelease});
this.menuItem_help.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.menuItem_help.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.menuItem_help.Name = "menuItem_help";
this.menuItem_help.Size = new System.Drawing.Size(53, 24);
this.menuItem_help.Text = "Help";
//
// menuItem_userGuide
//
this.menuItem_userGuide.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.menuItem_userGuide.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.menuItem_userGuide.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.menuItem_userGuide.Name = "menuItem_userGuide";
this.menuItem_userGuide.Size = new System.Drawing.Size(245, 24);
this.menuItem_userGuide.Text = "User Guide";
this.menuItem_userGuide.TextDirection = System.Windows.Forms.ToolStripTextDirection.Horizontal;
//
// menuItem_downloadLatestRelease
//
this.menuItem_downloadLatestRelease.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.menuItem_downloadLatestRelease.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.menuItem_downloadLatestRelease.Name = "menuItem_downloadLatestRelease";
this.menuItem_downloadLatestRelease.Size = new System.Drawing.Size(245, 24);
this.menuItem_downloadLatestRelease.Text = "Download Latest Release";
//
// StartupForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(914, 611);
this.Controls.Add(this.checkBoxAlwaysOnTop);
this.Controls.Add(this.checkBoxAutoPanning);
this.Controls.Add(this.checkBoxAutoStart);
this.ClientSize = new System.Drawing.Size(914, 540);
this.Controls.Add(this.lblVersion);
this.Controls.Add(this.checkBoxMinimizeToTray);
this.Controls.Add(this.darkLabel2);
this.Controls.Add(this.darkLabel1);
this.Controls.Add(this.linkLabel1);
this.Controls.Add(this.labelMsfsConnection);
this.Controls.Add(this.panelStatus);
this.Controls.Add(this.panelSteps);
this.Controls.Add(this.darkMenuStrip1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.darkMenuStrip1;
this.MaximizeBox = false;
this.Name = "StartupForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
@ -224,6 +318,8 @@ namespace MSFSPopoutPanelManager.UI
this.Resize += new System.EventHandler(this.StartupForm_Resize);
this.panelStatus.ResumeLayout(false);
this.panelStatus.PerformLayout();
this.darkMenuStrip1.ResumeLayout(false);
this.darkMenuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -235,15 +331,24 @@ namespace MSFSPopoutPanelManager.UI
private System.Windows.Forms.Label labelMsfsConnection;
private System.Windows.Forms.Panel panelStatus;
private System.Windows.Forms.NotifyIcon notifyIcon1;
private System.Windows.Forms.LinkLabel linkLabel1;
private DarkUI.Controls.DarkLabel darkLabel1;
private DarkUI.Controls.DarkLabel darkLabel2;
private DarkUI.Controls.DarkTextBox txtBoxStatus;
private DarkUI.Controls.DarkCheckBox checkBoxMinimizeToTray;
private DarkUI.Controls.DarkLabel lblVersion;
private DarkUI.Controls.DarkLabel darkLabel3;
private DarkUI.Controls.DarkCheckBox checkBoxAutoStart;
private DarkUI.Controls.DarkCheckBox checkBoxAutoPanning;
private DarkUI.Controls.DarkCheckBox checkBoxAlwaysOnTop;
private DarkUI.Controls.DarkMenuStrip darkMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem menuItem_exit;
private System.Windows.Forms.ToolStripMenuItem menuItem_autoStart;
private System.Windows.Forms.ToolStripMenuItem menuItem_alwaysOnTop;
private System.Windows.Forms.ToolStripMenuItem menuItem_autoPanning;
private System.Windows.Forms.ToolStripMenuItem menuItem_minimizeToSystemTray;
private System.Windows.Forms.ToolStripMenuItem menuItem_help;
private System.Windows.Forms.ToolStripMenuItem menuItem_userGuide;
private System.Windows.Forms.ToolStripMenuItem menuItem_downloadLatestRelease;
private System.Windows.Forms.ToolStripMenuItem menuItem_restart;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem menuItem_minimizeAllPanels;
}
}

View file

@ -9,7 +9,7 @@ using System.Windows.Forms;
namespace MSFSPopoutPanelManager.UI
{
public partial class StartupForm : DarkForm
public partial class StartupForm : DarkForm, IApplicationView
{
private Color ERROR_MESSAGE_COLOR = Color.FromArgb(1, 255, 71, 71);
private Color SUCCESS_MESSAGE_COLOR = Color.LightGreen;
@ -19,40 +19,86 @@ namespace MSFSPopoutPanelManager.UI
private UserControlPanelSelection _ucPanelSelection;
private UserControlPanelConfiguration _ucPanelConfiguration;
private StartUpController _controller;
private ApplicationController _controller;
public StartupForm()
{
InitializeComponent();
_syncRoot = SynchronizationContext.Current;
_ucPanelSelection = new UserControlPanelSelection();
_ucPanelConfiguration = new UserControlPanelConfiguration();
panelSteps.Controls.Add(_ucPanelSelection);
panelSteps.Controls.Add(_ucPanelConfiguration);
_syncRoot = SynchronizationContext.Current;
// Set version number
lblVersion.Text += $"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Major}.{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Minor}.{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Build}";
_controller = new StartUpController(this);
_controller.OnSimConnectionChanged += HandleSimConnectionChanged;
_controller.OnPanelSelectionActivated += (source, e) => { _ucPanelSelection.Visible = true; _ucPanelConfiguration.Visible = false; };
_controller.OnPanelConfigurationActivated += (source, e) => { _ucPanelSelection.Visible = false; _ucPanelConfiguration.Visible = true; };
_controller.Initialize();
checkBoxMinimizeToTray.DataBindings.Add("Checked", _controller, "IsMinimizeToTray");
checkBoxMinimizeToTray.CheckedChanged += (source, e) => _controller.SetMinimizeToTray(checkBoxMinimizeToTray.Checked);
checkBoxAlwaysOnTop.DataBindings.Add("Checked", _controller, "IsAlwaysOnTop");
checkBoxAlwaysOnTop.CheckedChanged += (source, e) => _controller.SetAlwaysOnTop(checkBoxAlwaysOnTop.Checked);
checkBoxAutoStart.DataBindings.Add("Checked", _controller, "IsAutoStart");
checkBoxAutoStart.CheckedChanged += (source, e) => _controller.SetAutoStart(checkBoxAutoStart.Checked);
checkBoxAutoPanning.DataBindings.Add("Checked", _controller, "UseAutoPanning");
checkBoxAutoPanning.CheckedChanged += (source, e) => _controller.SetAutoPanning(checkBoxAutoPanning.Checked);
Logger.OnStatusLogged += Logger_OnStatusLogged;
Logger.OnBackgroundStatusLogged += Logger_OnBackgroundStatusLogged;
_controller = new ApplicationController(this);
_controller.OnSimConnectionChanged += HandleSimConnectionChanged;
_controller.OnPanelSelectionActivated += HandleShowPanelSelection;
_controller.OnPanelConfigurationActivated += HandleShowPanelConfiguration;
_controller.Initialize();
_ucPanelSelection.Initialize(_controller.PanelSelectionController);
_ucPanelConfiguration.Initialize(_controller.PanelConfigurationController);
menuItem_restart.Click += HandleMenuClicked;
menuItem_exit.Click += HandleMenuClicked;
menuItem_alwaysOnTop.Click += HandleMenuClicked;
menuItem_autoPanning.Click += HandleMenuClicked;
menuItem_autoStart.Click += HandleMenuClicked;
menuItem_minimizeToSystemTray.Click += HandleMenuClicked;
menuItem_minimizeAllPanels.Click += HandleMenuClicked;
menuItem_userGuide.Click += HandleMenuClicked;
menuItem_downloadLatestRelease.Click += HandleMenuClicked;
}
#region Implement view interface
public Form Form { get => this; }
public IPanelSelectionView PanelSelection { get => _ucPanelSelection; }
public IPanelConfigurationView PanelConfiguration { get => _ucPanelConfiguration; }
public bool MinimizeToTray { get => menuItem_minimizeToSystemTray.Checked; set => menuItem_minimizeToSystemTray.Checked = value; }
public bool AlwaysOnTop { get => menuItem_alwaysOnTop.Checked; set => menuItem_alwaysOnTop.Checked = value; }
public bool AutoStart { get => menuItem_autoStart.Checked; set => menuItem_autoStart.Checked = value; }
public bool AutoPanning { get => menuItem_autoPanning.Checked; set => menuItem_autoPanning.Checked = value; }
#endregion
private void StartupForm_Load(object sender, EventArgs e)
{
notifyIcon1.BalloonTipText = "Application Minimized";
notifyIcon1.BalloonTipTitle = "MSFS 2020 Pop Out Panel Manager";
}
private void StartupForm_Resize(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Minimized)
{
if (menuItem_minimizeToSystemTray.Checked)
{
ShowInTaskbar = false;
notifyIcon1.Visible = true;
notifyIcon1.ShowBalloonTip(1000);
}
}
}
private void notifyIcon1_DoubleClick(object sender, EventArgs e)
{
ShowInTaskbar = true;
notifyIcon1.Visible = false;
WindowState = FormWindowState.Normal;
}
private void HandleSimConnectionChanged(object sender, EventArgs<bool> e)
@ -79,6 +125,7 @@ namespace MSFSPopoutPanelManager.UI
{
txtBoxStatus.ForeColor = e.Value.MessageType == StatusMessageType.Info ? INFO_MESSAGE_COLOR : ERROR_MESSAGE_COLOR;
txtBoxStatus.Text = e.Value.Message;
this.ActiveControl = this.panelStatus;
}
if (e.Value.MessageType == StatusMessageType.Error)
@ -94,6 +141,7 @@ namespace MSFSPopoutPanelManager.UI
{
txtBoxStatus.ForeColor = statusMessage.MessageType == StatusMessageType.Info ? INFO_MESSAGE_COLOR : ERROR_MESSAGE_COLOR;
txtBoxStatus.Text = statusMessage.Message;
this.ActiveControl = this.panelStatus;
}
if (e.Value.MessageType == StatusMessageType.Error)
@ -101,37 +149,65 @@ namespace MSFSPopoutPanelManager.UI
}, e.Value);
}
private void StartupForm_Load(object sender, EventArgs e)
private void HandleMenuClicked(object sender, EventArgs e)
{
notifyIcon1.BalloonTipText = "Application Minimized";
notifyIcon1.BalloonTipTitle = "MSFS 2020 Pop Out Panel Manager";
}
var itemName = ((ToolStripMenuItem)sender).Name;
private void StartupForm_Resize(object sender, EventArgs e)
switch (itemName)
{
if (WindowState == FormWindowState.Minimized)
{
if (checkBoxMinimizeToTray.Checked)
{
ShowInTaskbar = false;
notifyIcon1.Visible = true;
notifyIcon1.ShowBalloonTip(1000);
}
case nameof(menuItem_restart):
_controller.Restart();
break;
case nameof(menuItem_exit):
Application.Exit();
break;
case nameof(menuItem_alwaysOnTop):
_controller.SetAlwaysOnTop(menuItem_alwaysOnTop.Checked);
break;
case nameof(menuItem_autoPanning):
_controller.SetAutoPanning(menuItem_autoPanning.Checked);
break;
case nameof(menuItem_autoStart):
_controller.SetAutoStart(menuItem_autoStart.Checked);
break;
case nameof(menuItem_minimizeToSystemTray):
_controller.SetMinimizeToTray(menuItem_minimizeToSystemTray.Checked);
break;
case nameof(menuItem_minimizeAllPanels):
_controller.MinimizeAllPanels(menuItem_minimizeAllPanels.Checked);
break;
case nameof(menuItem_userGuide):
Process.Start(new ProcessStartInfo("https://github.com/hawkeye-stan/msfs-popout-panel-manager#msfs-pop-out-panel-manager") { UseShellExecute = true });
return;
case nameof(menuItem_downloadLatestRelease):
Process.Start(new ProcessStartInfo("https://github.com/hawkeye-stan/msfs-popout-panel-manager/releases") { UseShellExecute = true });
return;
}
}
private void notifyIcon1_DoubleClick(object sender, EventArgs e)
private void HandleShowPanelSelection(object sender, EventArgs e)
{
ShowInTaskbar = true;
notifyIcon1.Visible = false;
WindowState = FormWindowState.Normal;
if (_ucPanelSelection != null && _ucPanelConfiguration != null)
{
_ucPanelSelection.Visible = true;
_ucPanelConfiguration.Visible = false;
menuItem_restart.Enabled = false;
menuItem_minimizeAllPanels.Checked = false;
menuItem_minimizeAllPanels.Enabled = false;
}
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
private void HandleShowPanelConfiguration(object sender, EventArgs e)
{
linkLabel1.LinkVisited = true;
if (_ucPanelSelection != null && _ucPanelConfiguration != null)
{
_ucPanelSelection.Visible = false;
_ucPanelConfiguration.Visible = true;
Process.Start(new ProcessStartInfo("https://github.com/hawkeye-stan/msfs-popout-panel-manager") { UseShellExecute = true });
menuItem_restart.Enabled = true;
menuItem_minimizeAllPanels.Enabled = true;
}
}
}
}

View file

@ -1193,8 +1193,8 @@
//////////////////////////////////8=
</value>
</data>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
<metadata name="darkMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>141, 17</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

View file

@ -29,16 +29,17 @@ namespace MSFSPopoutPanelManager.UI
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
this.panel1 = new System.Windows.Forms.Panel();
this.dataGridViewPanels = new System.Windows.Forms.DataGridView();
this.PanelName = new System.Windows.Forms.DataGridViewTextBoxColumn();
@ -49,12 +50,15 @@ namespace MSFSPopoutPanelManager.UI
this.AlwaysOnTop = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.HideTitlebar = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.label2 = new System.Windows.Forms.Label();
this.buttonRestart = new System.Windows.Forms.Button();
this.buttonSaveSettings = new System.Windows.Forms.Button();
this.buttonPixelMinusLarge = new System.Windows.Forms.Button();
this.buttonPixelLargeMinus = new System.Windows.Forms.Button();
this.buttonPixelMinusSmall = new System.Windows.Forms.Button();
this.buttonPixelPlusSmall = new System.Windows.Forms.Button();
this.buttonPixelPlusLarge = new System.Windows.Forms.Button();
this.buttonLockPanel = new System.Windows.Forms.Button();
this.toolTipLargeMinus = new System.Windows.Forms.ToolTip(this.components);
this.toolTipSmallMinus = new System.Windows.Forms.ToolTip(this.components);
this.toolTipSmallPlus = new System.Windows.Forms.ToolTip(this.components);
this.toolTipLargePlus = new System.Windows.Forms.ToolTip(this.components);
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridViewPanels)).BeginInit();
this.SuspendLayout();
@ -75,20 +79,20 @@ namespace MSFSPopoutPanelManager.UI
this.dataGridViewPanels.AllowUserToDeleteRows = false;
this.dataGridViewPanels.AllowUserToResizeColumns = false;
this.dataGridViewPanels.AllowUserToResizeRows = false;
dataGridViewCellStyle1.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
dataGridViewCellStyle1.ForeColor = System.Drawing.Color.Black;
dataGridViewCellStyle1.Padding = new System.Windows.Forms.Padding(3);
this.dataGridViewPanels.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle11.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
dataGridViewCellStyle11.ForeColor = System.Drawing.Color.Black;
dataGridViewCellStyle11.Padding = new System.Windows.Forms.Padding(3);
this.dataGridViewPanels.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11;
this.dataGridViewPanels.CausesValidation = false;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.Padding = new System.Windows.Forms.Padding(10, 3, 3, 3);
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridViewPanels.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle12.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle12.Padding = new System.Windows.Forms.Padding(10, 3, 3, 3);
dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridViewPanels.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12;
this.dataGridViewPanels.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridViewPanels.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.PanelName,
@ -98,29 +102,29 @@ namespace MSFSPopoutPanelManager.UI
this.Height,
this.AlwaysOnTop,
this.HideTitlebar});
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle8.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
dataGridViewCellStyle8.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridViewPanels.DefaultCellStyle = dataGridViewCellStyle8;
dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle18.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle18.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
dataGridViewCellStyle18.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle18.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle18.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridViewPanels.DefaultCellStyle = dataGridViewCellStyle18;
this.dataGridViewPanels.Location = new System.Drawing.Point(20, 35);
this.dataGridViewPanels.MultiSelect = false;
this.dataGridViewPanels.Name = "dataGridViewPanels";
dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle9.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridViewPanels.RowHeadersDefaultCellStyle = dataGridViewCellStyle9;
dataGridViewCellStyle19.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle19.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
dataGridViewCellStyle19.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle19.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle19.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridViewPanels.RowHeadersDefaultCellStyle = dataGridViewCellStyle19;
this.dataGridViewPanels.RowHeadersVisible = false;
dataGridViewCellStyle10.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle10.Padding = new System.Windows.Forms.Padding(3);
this.dataGridViewPanels.RowsDefaultCellStyle = dataGridViewCellStyle10;
dataGridViewCellStyle20.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
dataGridViewCellStyle20.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle20.Padding = new System.Windows.Forms.Padding(3);
this.dataGridViewPanels.RowsDefaultCellStyle = dataGridViewCellStyle20;
this.dataGridViewPanels.RowTemplate.Height = 25;
this.dataGridViewPanels.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.dataGridViewPanels.ShowCellErrors = false;
@ -133,8 +137,8 @@ namespace MSFSPopoutPanelManager.UI
// PanelName
//
this.PanelName.DataPropertyName = "PanelName";
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
this.PanelName.DefaultCellStyle = dataGridViewCellStyle3;
dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
this.PanelName.DefaultCellStyle = dataGridViewCellStyle13;
this.PanelName.FillWeight = 80F;
this.PanelName.HeaderText = "Panel Name";
this.PanelName.Name = "PanelName";
@ -143,8 +147,8 @@ namespace MSFSPopoutPanelManager.UI
// Left
//
this.Left.DataPropertyName = "Left";
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.Left.DefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.Left.DefaultCellStyle = dataGridViewCellStyle14;
this.Left.FillWeight = 80F;
this.Left.HeaderText = "X Pos";
this.Left.MaxInputLength = 6;
@ -155,8 +159,8 @@ namespace MSFSPopoutPanelManager.UI
// Top
//
this.Top.DataPropertyName = "Top";
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.Top.DefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.Top.DefaultCellStyle = dataGridViewCellStyle15;
this.Top.FillWeight = 80F;
this.Top.HeaderText = "Y Pos";
this.Top.MaxInputLength = 6;
@ -167,8 +171,8 @@ namespace MSFSPopoutPanelManager.UI
// Width
//
this.Width.DataPropertyName = "Width";
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.Width.DefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.Width.DefaultCellStyle = dataGridViewCellStyle16;
this.Width.FillWeight = 80F;
this.Width.HeaderText = "Width";
this.Width.MaxInputLength = 6;
@ -179,8 +183,8 @@ namespace MSFSPopoutPanelManager.UI
// Height
//
this.Height.DataPropertyName = "Height";
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.Height.DefaultCellStyle = dataGridViewCellStyle7;
dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.Height.DefaultCellStyle = dataGridViewCellStyle17;
this.Height.FillWeight = 80F;
this.Height.HeaderText = "Height";
this.Height.MaxInputLength = 6;
@ -221,41 +225,18 @@ namespace MSFSPopoutPanelManager.UI
this.label2.TabIndex = 7;
this.label2.Text = "Panel locations and settings";
//
// buttonRestart
// buttonPixelLargeMinus
//
this.buttonRestart.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(158)))), ((int)(((byte)(218)))));
this.buttonRestart.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.buttonRestart.ForeColor = System.Drawing.Color.White;
this.buttonRestart.Location = new System.Drawing.Point(787, 354);
this.buttonRestart.Name = "buttonRestart";
this.buttonRestart.Size = new System.Drawing.Size(107, 35);
this.buttonRestart.TabIndex = 19;
this.buttonRestart.Text = "Restart";
this.buttonRestart.UseVisualStyleBackColor = false;
//
// buttonSaveSettings
//
this.buttonSaveSettings.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(158)))), ((int)(((byte)(218)))));
this.buttonSaveSettings.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.buttonSaveSettings.ForeColor = System.Drawing.Color.White;
this.buttonSaveSettings.Location = new System.Drawing.Point(624, 354);
this.buttonSaveSettings.Name = "buttonSaveSettings";
this.buttonSaveSettings.Size = new System.Drawing.Size(145, 35);
this.buttonSaveSettings.TabIndex = 23;
this.buttonSaveSettings.Text = "Save Profile";
this.buttonSaveSettings.UseVisualStyleBackColor = false;
//
// buttonPixelMinusLarge
//
this.buttonPixelMinusLarge.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(158)))), ((int)(((byte)(218)))));
this.buttonPixelMinusLarge.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.buttonPixelMinusLarge.ForeColor = System.Drawing.Color.White;
this.buttonPixelMinusLarge.Location = new System.Drawing.Point(20, 354);
this.buttonPixelMinusLarge.Name = "buttonPixelMinusLarge";
this.buttonPixelMinusLarge.Size = new System.Drawing.Size(69, 35);
this.buttonPixelMinusLarge.TabIndex = 24;
this.buttonPixelMinusLarge.Text = "-10 px";
this.buttonPixelMinusLarge.UseVisualStyleBackColor = false;
this.buttonPixelLargeMinus.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(158)))), ((int)(((byte)(218)))));
this.buttonPixelLargeMinus.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.buttonPixelLargeMinus.ForeColor = System.Drawing.Color.White;
this.buttonPixelLargeMinus.Location = new System.Drawing.Point(20, 354);
this.buttonPixelLargeMinus.Name = "buttonPixelLargeMinus";
this.buttonPixelLargeMinus.Size = new System.Drawing.Size(69, 35);
this.buttonPixelLargeMinus.TabIndex = 24;
this.buttonPixelLargeMinus.Text = "-10 px";
this.toolTipLargeMinus.SetToolTip(this.buttonPixelLargeMinus, "Ctrl -");
this.buttonPixelLargeMinus.UseVisualStyleBackColor = false;
//
// buttonPixelMinusSmall
//
@ -267,6 +248,7 @@ namespace MSFSPopoutPanelManager.UI
this.buttonPixelMinusSmall.Size = new System.Drawing.Size(69, 35);
this.buttonPixelMinusSmall.TabIndex = 25;
this.buttonPixelMinusSmall.Text = "-1 px";
this.toolTipSmallMinus.SetToolTip(this.buttonPixelMinusSmall, "Ctrl [");
this.buttonPixelMinusSmall.UseVisualStyleBackColor = false;
//
// buttonPixelPlusSmall
@ -279,6 +261,7 @@ namespace MSFSPopoutPanelManager.UI
this.buttonPixelPlusSmall.Size = new System.Drawing.Size(69, 35);
this.buttonPixelPlusSmall.TabIndex = 26;
this.buttonPixelPlusSmall.Text = "+1 px";
this.toolTipSmallPlus.SetToolTip(this.buttonPixelPlusSmall, "Ctrl ]");
this.buttonPixelPlusSmall.UseVisualStyleBackColor = false;
//
// buttonPixelPlusLarge
@ -291,19 +274,31 @@ namespace MSFSPopoutPanelManager.UI
this.buttonPixelPlusLarge.Size = new System.Drawing.Size(69, 35);
this.buttonPixelPlusLarge.TabIndex = 27;
this.buttonPixelPlusLarge.Text = "+10 px";
this.toolTipLargePlus.SetToolTip(this.buttonPixelPlusLarge, "Ctrl +");
this.buttonPixelPlusLarge.UseVisualStyleBackColor = false;
//
// buttonLockPanel
//
this.buttonLockPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(158)))), ((int)(((byte)(218)))));
this.buttonLockPanel.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.buttonLockPanel.ForeColor = System.Drawing.Color.White;
this.buttonLockPanel.Location = new System.Drawing.Point(772, 354);
this.buttonLockPanel.Name = "buttonLockPanel";
this.buttonLockPanel.Size = new System.Drawing.Size(122, 35);
this.buttonLockPanel.TabIndex = 28;
this.buttonLockPanel.Text = "Lock Panels";
this.buttonLockPanel.UseVisualStyleBackColor = false;
//
// UserControlPanelConfiguration
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Transparent;
this.Controls.Add(this.buttonLockPanel);
this.Controls.Add(this.buttonPixelPlusLarge);
this.Controls.Add(this.buttonPixelPlusSmall);
this.Controls.Add(this.buttonPixelMinusSmall);
this.Controls.Add(this.buttonPixelMinusLarge);
this.Controls.Add(this.buttonSaveSettings);
this.Controls.Add(this.buttonRestart);
this.Controls.Add(this.buttonPixelLargeMinus);
this.Controls.Add(this.panel1);
this.Name = "UserControlPanelConfiguration";
this.Size = new System.Drawing.Size(915, 405);
@ -318,10 +313,8 @@ namespace MSFSPopoutPanelManager.UI
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button buttonRestart;
private System.Windows.Forms.DataGridView dataGridViewPanels;
private System.Windows.Forms.Button buttonSaveSettings;
private System.Windows.Forms.Button buttonPixelMinusLarge;
private System.Windows.Forms.Button buttonPixelLargeMinus;
private System.Windows.Forms.Button buttonPixelMinusSmall;
private System.Windows.Forms.Button buttonPixelPlusSmall;
private System.Windows.Forms.Button buttonPixelPlusLarge;
@ -332,5 +325,10 @@ namespace MSFSPopoutPanelManager.UI
private System.Windows.Forms.DataGridViewTextBoxColumn Height;
private System.Windows.Forms.DataGridViewCheckBoxColumn AlwaysOnTop;
private System.Windows.Forms.DataGridViewCheckBoxColumn HideTitlebar;
private System.Windows.Forms.Button buttonLockPanel;
private System.Windows.Forms.ToolTip toolTipLargeMinus;
private System.Windows.Forms.ToolTip toolTipSmallMinus;
private System.Windows.Forms.ToolTip toolTipSmallPlus;
private System.Windows.Forms.ToolTip toolTipLargePlus;
}
}

View file

@ -1,37 +1,62 @@
using MSFSPopoutPanelManager.Shared;
using MSFSPopoutPanelManager.UIController;
using System;
using System.Drawing;
using System.Windows.Forms;
namespace MSFSPopoutPanelManager.UI
{
public partial class UserControlPanelConfiguration : UserControl
public partial class UserControlPanelConfiguration : UserControl, IPanelConfigurationView
{
private PanelConfigurationController _controller;
public bool IsPanelLocked { set => SetProfileLockButtonText(_controller.DataStore.ActiveUserProfile.IsLocked); }
public bool IsPanelChangeDisabled { set => this.Enabled = !value; }
public UserControlPanelConfiguration()
{
InitializeComponent();
_controller = new PanelConfigurationController();
}
public void Initialize(PanelConfigurationController controller)
{
_controller = controller;
_controller.RefreshDataUI += (source, e) => dataGridViewPanels.Refresh();
_controller.HightlightSelectedPanel += HandleHighlightSelectedPanel;
dataGridViewPanels.AutoGenerateColumns = false;
dataGridViewPanels.AutoSize = false;
dataGridViewPanels.DataSource = _controller.PanelConfigs;
dataGridViewPanels.CellBeginEdit += HandleCellBeginEdit;
dataGridViewPanels.DataSource = _controller.DataStore.PanelConfigs;
dataGridViewPanels.CellValidating += HandleCellValidating;
dataGridViewPanels.CellEndEdit += HandleCellValueChanged;
dataGridViewPanels.CellContentClick += HandleCellValueChanged;
buttonSaveSettings.Click += (source, e) => { dataGridViewPanels.EndEdit(); _controller.SaveSettings(); };
buttonRestart.Click += (source, e) => _controller.BackToPanelSelection();
dataGridViewPanels.CellContentClick += HandleCellContentChanged; // for checkbox columns
dataGridViewPanels.CellFormatting += HandleCellFormatting;
buttonPixelPlusLarge.Click += (source, e) => HandleCellValueIncrDecr(10);
buttonPixelPlusSmall.Click += (source, e) => HandleCellValueIncrDecr(1);
buttonPixelMinusLarge.Click += (source, e) => HandleCellValueIncrDecr(-10);
buttonPixelLargeMinus.Click += (source, e) => HandleCellValueIncrDecr(-10);
buttonPixelMinusSmall.Click += (source, e) => HandleCellValueIncrDecr(-1);
buttonLockPanel.Click += HandleLockPanelChanged;
}
private void HandleCellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
{
var column = (PanelConfigDataColumn)Enum.Parse(typeof(PanelConfigDataColumn), dataGridViewPanels.Columns[e.ColumnIndex].Name);
var dgv = sender as DataGridView;
var data = dgv.Rows[e.RowIndex].DataBoundItem as PanelConfig;
if (column == PanelConfigDataColumn.PanelName || column == PanelConfigDataColumn.HideTitlebar)
{
if(data.PanelType == PanelType.BuiltInPopout)
dgv[e.ColumnIndex, e.RowIndex].ReadOnly = true;
}
}
}
private void HandleCellValueIncrDecr(int changedAmount)
@ -48,29 +73,20 @@ namespace MSFSPopoutPanelManager.UI
private void HandleCellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
if (e.ColumnIndex >= 0 && e.ColumnIndex <= 4 && e.RowIndex >= 0)
{
dataGridViewPanels.EndEdit();
var column = (PanelConfigDataColumn)Enum.Parse(typeof(PanelConfigDataColumn), dataGridViewPanels.Columns[e.ColumnIndex].Name);
_controller.CellValueChanged(e.RowIndex, column, dataGridViewPanels[e.ColumnIndex, e.RowIndex].EditedFormattedValue);
}
}
private void HandleCellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
private void HandleCellContentChanged(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
if ((e.ColumnIndex == 5 || e.ColumnIndex == 6) && e.RowIndex >= 0)
{
var column = (PanelConfigDataColumn)Enum.Parse(typeof(PanelConfigDataColumn), dataGridViewPanels.Columns[e.ColumnIndex].Name);
// Disallow cell edit
var dgv = sender as DataGridView;
var data = dgv.Rows[e.RowIndex].DataBoundItem as PanelConfig;
if (column == PanelConfigDataColumn.PanelName || column == PanelConfigDataColumn.AlwaysOnTop || column == PanelConfigDataColumn.HideTitlebar)
{
if (data.PanelType == PanelType.BuiltInPopout)
e.Cancel = true;
}
_controller.CellValueChanged(e.RowIndex, column, dataGridViewPanels[e.ColumnIndex, e.RowIndex].EditedFormattedValue);
}
}
@ -109,5 +125,63 @@ namespace MSFSPopoutPanelManager.UI
dataGridViewPanels.ClearSelection();
dataGridViewPanels.Rows[e.Value].Selected = true;
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (!_controller.DataStore.ActiveUserProfile.IsLocked)
{
if (keyData == (Keys.Oemplus | Keys.Control) || keyData == (Keys.Add | Keys.Control))
{
HandleCellValueIncrDecr(10);
}
else if (keyData == (Keys.OemMinus | Keys.Control) || keyData == (Keys.Subtract | Keys.Control))
{
HandleCellValueIncrDecr(-10);
}
else if (keyData == (Keys.OemCloseBrackets | Keys.Control))
{
HandleCellValueIncrDecr(1);
}
else if (keyData == (Keys.OemOpenBrackets | Keys.Control))
{
HandleCellValueIncrDecr(-1);
}
}
return base.ProcessCmdKey(ref msg, keyData);
}
private void HandleLockPanelChanged(object sender, EventArgs e)
{
if (!_controller.DataStore.ActiveUserProfile.IsLocked)
{
_controller.LockPanelChanged(true);
}
else
{
var title = "Confirm Unlock Panels";
var message = "Are you sure you want to unlock all panels to make changes?";
using (var form = new ConfirmDialogForm(title, message) { StartPosition = FormStartPosition.CenterParent })
{
if (form.ShowDialog() == DialogResult.Yes)
{
_controller.LockPanelChanged(false);
}
}
}
}
private void SetProfileLockButtonText(bool isLocked)
{
buttonLockPanel.Text = isLocked ? "Unlock Panels" : "Lock Panels";
buttonLockPanel.BackColor = isLocked ? Color.Red : Color.FromArgb(17, 158, 218);
dataGridViewPanels.ReadOnly = isLocked;
buttonPixelLargeMinus.Enabled = !isLocked;
buttonPixelMinusSmall.Enabled = !isLocked;
buttonPixelPlusLarge.Enabled = !isLocked;
buttonPixelPlusSmall.Enabled = !isLocked;
}
}
}

View file

@ -78,4 +78,28 @@
<metadata name="HideTitlebar.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="toolTipLargeMinus.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolTipSmallMinus.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>187, 17</value>
</metadata>
<metadata name="toolTipSmallPlus.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>292, 17</value>
</metadata>
<metadata name="toolTipLargePlus.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>397, 17</value>
</metadata>
<metadata name="toolTipLargeMinus.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolTipSmallMinus.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>187, 17</value>
</metadata>
<metadata name="toolTipSmallPlus.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>292, 17</value>
</metadata>
<metadata name="toolTipLargePlus.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>397, 17</value>
</metadata>
</root>

View file

@ -29,14 +29,14 @@ namespace MSFSPopoutPanelManager.UI
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
this.dataGridViewPanelCoor = new System.Windows.Forms.DataGridView();
this.PanelIndex = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.X = new System.Windows.Forms.DataGridViewTextBoxColumn();
@ -51,7 +51,7 @@ namespace MSFSPopoutPanelManager.UI
this.label1 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.buttonPanelSelection = new System.Windows.Forms.Button();
this.buttonStartPanelSelection = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.panel4 = new System.Windows.Forms.Panel();
@ -72,48 +72,48 @@ namespace MSFSPopoutPanelManager.UI
this.dataGridViewPanelCoor.AllowUserToDeleteRows = false;
this.dataGridViewPanelCoor.AllowUserToResizeColumns = false;
this.dataGridViewPanelCoor.AllowUserToResizeRows = false;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.ForeColor = System.Drawing.Color.Black;
this.dataGridViewPanelCoor.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle9.ForeColor = System.Drawing.Color.Black;
this.dataGridViewPanelCoor.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9;
this.dataGridViewPanelCoor.CausesValidation = false;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.Padding = new System.Windows.Forms.Padding(18, 3, 3, 3);
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridViewPanelCoor.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle10.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle10.Padding = new System.Windows.Forms.Padding(18, 3, 3, 3);
dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridViewPanelCoor.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10;
this.dataGridViewPanelCoor.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridViewPanelCoor.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.PanelIndex,
this.X,
this.Y});
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle6.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridViewPanelCoor.DefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle14.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridViewPanelCoor.DefaultCellStyle = dataGridViewCellStyle14;
this.dataGridViewPanelCoor.Location = new System.Drawing.Point(18, 42);
this.dataGridViewPanelCoor.MultiSelect = false;
this.dataGridViewPanelCoor.Name = "dataGridViewPanelCoor";
this.dataGridViewPanelCoor.ReadOnly = true;
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle7.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle7.Padding = new System.Windows.Forms.Padding(3);
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridViewPanelCoor.RowHeadersDefaultCellStyle = dataGridViewCellStyle7;
dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle15.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle15.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
dataGridViewCellStyle15.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle15.Padding = new System.Windows.Forms.Padding(3);
dataGridViewCellStyle15.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle15.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridViewPanelCoor.RowHeadersDefaultCellStyle = dataGridViewCellStyle15;
this.dataGridViewPanelCoor.RowHeadersVisible = false;
dataGridViewCellStyle8.Padding = new System.Windows.Forms.Padding(3);
this.dataGridViewPanelCoor.RowsDefaultCellStyle = dataGridViewCellStyle8;
dataGridViewCellStyle16.Padding = new System.Windows.Forms.Padding(3);
this.dataGridViewPanelCoor.RowsDefaultCellStyle = dataGridViewCellStyle16;
this.dataGridViewPanelCoor.RowTemplate.Height = 25;
this.dataGridViewPanelCoor.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.dataGridViewPanelCoor.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
@ -121,15 +121,15 @@ namespace MSFSPopoutPanelManager.UI
this.dataGridViewPanelCoor.ShowCellToolTips = false;
this.dataGridViewPanelCoor.ShowEditingIcon = false;
this.dataGridViewPanelCoor.ShowRowErrors = false;
this.dataGridViewPanelCoor.Size = new System.Drawing.Size(303, 309);
this.dataGridViewPanelCoor.Size = new System.Drawing.Size(303, 286);
this.dataGridViewPanelCoor.TabIndex = 18;
//
// PanelIndex
//
this.PanelIndex.DataPropertyName = "PanelIndex";
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle3.ForeColor = System.Drawing.Color.Black;
this.PanelIndex.DefaultCellStyle = dataGridViewCellStyle3;
dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle11.ForeColor = System.Drawing.Color.Black;
this.PanelIndex.DefaultCellStyle = dataGridViewCellStyle11;
this.PanelIndex.HeaderText = "Panel";
this.PanelIndex.Name = "PanelIndex";
this.PanelIndex.ReadOnly = true;
@ -137,9 +137,9 @@ namespace MSFSPopoutPanelManager.UI
// X
//
this.X.DataPropertyName = "X";
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle4.ForeColor = System.Drawing.Color.Black;
this.X.DefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle12.ForeColor = System.Drawing.Color.Black;
this.X.DefaultCellStyle = dataGridViewCellStyle12;
this.X.HeaderText = "X-Pos";
this.X.Name = "X";
this.X.ReadOnly = true;
@ -147,9 +147,9 @@ namespace MSFSPopoutPanelManager.UI
// Y
//
this.Y.DataPropertyName = "Y";
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle5.ForeColor = System.Drawing.Color.Black;
this.Y.DefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle13.ForeColor = System.Drawing.Color.Black;
this.Y.DefaultCellStyle = dataGridViewCellStyle13;
this.Y.HeaderText = "Y-Pos";
this.Y.Name = "Y";
this.Y.ReadOnly = true;
@ -230,11 +230,11 @@ namespace MSFSPopoutPanelManager.UI
this.panel2.Controls.Add(this.label1);
this.panel2.Controls.Add(this.label5);
this.panel2.Controls.Add(this.label4);
this.panel2.Controls.Add(this.buttonPanelSelection);
this.panel2.Controls.Add(this.buttonStartPanelSelection);
this.panel2.Controls.Add(this.label3);
this.panel2.Location = new System.Drawing.Point(0, 117);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(579, 191);
this.panel2.Size = new System.Drawing.Size(579, 172);
this.panel2.TabIndex = 8;
//
// label1
@ -242,7 +242,7 @@ namespace MSFSPopoutPanelManager.UI
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.label1.ForeColor = System.Drawing.Color.White;
this.label1.Location = new System.Drawing.Point(35, 55);
this.label1.Location = new System.Drawing.Point(35, 37);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(213, 20);
this.label1.TabIndex = 12;
@ -253,34 +253,34 @@ namespace MSFSPopoutPanelManager.UI
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.label5.ForeColor = System.Drawing.Color.White;
this.label5.Location = new System.Drawing.Point(35, 115);
this.label5.Location = new System.Drawing.Point(35, 97);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(517, 20);
this.label5.Size = new System.Drawing.Size(523, 20);
this.label5.TabIndex = 11;
this.label5.Text = "CTRL + LEFT CLICK when all panels have been selected or to cancel selection.";
this.label5.Text = "CTRL + LEFT CLICK when all panels have been selected or to cancel selections.";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.label4.ForeColor = System.Drawing.Color.White;
this.label4.Location = new System.Drawing.Point(35, 84);
this.label4.Location = new System.Drawing.Point(35, 66);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(418, 20);
this.label4.TabIndex = 10;
this.label4.Text = "SHIFT + LEFT CLICK to remove the most recently added panel.";
//
// buttonPanelSelection
// buttonStartPanelSelection
//
this.buttonPanelSelection.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(158)))), ((int)(((byte)(218)))));
this.buttonPanelSelection.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.buttonPanelSelection.ForeColor = System.Drawing.Color.White;
this.buttonPanelSelection.Location = new System.Drawing.Point(32, 142);
this.buttonPanelSelection.Name = "buttonPanelSelection";
this.buttonPanelSelection.Size = new System.Drawing.Size(170, 35);
this.buttonPanelSelection.TabIndex = 9;
this.buttonPanelSelection.Text = "Start Panel Selection";
this.buttonPanelSelection.UseVisualStyleBackColor = false;
this.buttonStartPanelSelection.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(158)))), ((int)(((byte)(218)))));
this.buttonStartPanelSelection.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.buttonStartPanelSelection.ForeColor = System.Drawing.Color.White;
this.buttonStartPanelSelection.Location = new System.Drawing.Point(32, 127);
this.buttonStartPanelSelection.Name = "buttonStartPanelSelection";
this.buttonStartPanelSelection.Size = new System.Drawing.Size(170, 35);
this.buttonStartPanelSelection.TabIndex = 9;
this.buttonStartPanelSelection.Text = "Start Panel Selection";
this.buttonStartPanelSelection.UseVisualStyleBackColor = false;
//
// label3
//
@ -288,11 +288,9 @@ namespace MSFSPopoutPanelManager.UI
this.label3.ForeColor = System.Drawing.Color.White;
this.label3.Location = new System.Drawing.Point(20, 4);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(551, 47);
this.label3.Size = new System.Drawing.Size(551, 27);
this.label3.TabIndex = 7;
this.label3.Text = "2. Identify the pop out panels in the game by clicking on them. Their locations w" +
"ill be saved for use on future flights. (You only need to do this once per profi" +
"le)";
this.label3.Text = "2. Identify pop out panel locations in the game by clicking on them.";
//
// label6
//
@ -320,7 +318,7 @@ namespace MSFSPopoutPanelManager.UI
this.checkBoxShowPanelLocation.AutoSize = true;
this.checkBoxShowPanelLocation.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.checkBoxShowPanelLocation.ForeColor = System.Drawing.Color.White;
this.checkBoxShowPanelLocation.Location = new System.Drawing.Point(67, 361);
this.checkBoxShowPanelLocation.Location = new System.Drawing.Point(67, 342);
this.checkBoxShowPanelLocation.Name = "checkBoxShowPanelLocation";
this.checkBoxShowPanelLocation.Size = new System.Drawing.Size(213, 24);
this.checkBoxShowPanelLocation.TabIndex = 17;
@ -344,9 +342,9 @@ namespace MSFSPopoutPanelManager.UI
this.panel3.Controls.Add(this.buttonStartPopOut);
this.panel3.Controls.Add(this.label7);
this.panel3.ForeColor = System.Drawing.Color.White;
this.panel3.Location = new System.Drawing.Point(0, 309);
this.panel3.Location = new System.Drawing.Point(0, 290);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(579, 94);
this.panel3.Size = new System.Drawing.Size(579, 113);
this.panel3.TabIndex = 14;
//
// label7
@ -356,9 +354,9 @@ namespace MSFSPopoutPanelManager.UI
this.label7.ForeColor = System.Drawing.Color.White;
this.label7.Location = new System.Drawing.Point(20, 10);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(348, 20);
this.label7.Size = new System.Drawing.Size(323, 20);
this.label7.TabIndex = 7;
this.label7.Text = "3. Start the pop out process for the selected panels.";
this.label7.Text = "3. Start the pop out process for selected panels.";
//
// UserControlPanelSelection
//
@ -391,7 +389,7 @@ namespace MSFSPopoutPanelManager.UI
private System.Windows.Forms.ComboBox comboBoxProfile;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button buttonPanelSelection;
private System.Windows.Forms.Button buttonStartPanelSelection;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label1;

View file

@ -5,39 +5,56 @@ using System.Windows.Forms;
namespace MSFSPopoutPanelManager.UI
{
public partial class UserControlPanelSelection : UserControl
public partial class UserControlPanelSelection : UserControl, IPanelSelectionView
{
private PanelSelectionController _controller;
#region Implement view interface
public Form Form { get => ParentForm; }
public bool ShowPanelLocationOverlay { get => checkBoxShowPanelLocation.Checked; set => checkBoxShowPanelLocation.Checked = value; }
#endregion
public UserControlPanelSelection()
{
InitializeComponent();
_controller = new PanelSelectionController();
}
// Listen to controller event
public void Initialize(PanelSelectionController controller)
{
_controller = controller;
_controller.OnUIStateChanged += HandleOnUIStateChanged;
_controller.Initialize();
// Set bindings
comboBoxProfile.DisplayMember = "ProfileName";
comboBoxProfile.ValueMember = "ProfileId";
comboBoxProfile.DataSource = _controller.PlaneProfileList;
comboBoxProfile.DataBindings.Add("SelectedValue", _controller, "SelectedProfileId");
comboBoxProfile.DataSource = _controller.DataStore.UserProfiles;
comboBoxProfile.DataBindings.Add("SelectedValue", _controller.DataStore, "ActiveUserProfileId");
comboBoxProfile.SelectedValue = -1; // forced a default
comboBoxProfile.SelectedIndexChanged += HandleProfileChanged;
buttonAddProfile.Click += HandleAddProfile;
buttonDeleteProfile.Click += HandleDeleteProfile;
buttonSetDefault.Click += (source, e) => _controller.SetDefaultProfile();
buttonPanelSelection.Click += HandlePanelSelectionStarted;
buttonStartPopOut.Click += (source, e) => _controller.StartPopOut(ParentForm);
buttonStartPanelSelection.Click += HandleStartPanelSelection;
buttonStartPopOut.Click += (source, e) => _controller.StartPopOut();
dataGridViewPanelCoor.AutoGenerateColumns = false;
dataGridViewPanelCoor.AutoSize = false;
dataGridViewPanelCoor.DataSource = _controller.PanelCoordinates;
dataGridViewPanelCoor.DataSource = _controller.DataStore.ActiveProfilePanelCoordinates;
checkBoxShowPanelLocation.DataBindings.Add("Checked", _controller, "ShowPanelLocationOverlay");
checkBoxShowPanelLocation.CheckedChanged += (source, e) => _controller.ShowPanelLocationOverlayChanged(checkBoxShowPanelLocation.Checked);
checkBoxShowPanelLocation.CheckedChanged += (source, e) => _controller.SetPanelLocationOverlayChanged();
}
private void HandleProfileChanged(object sender, EventArgs e)
{
if(Convert.ToInt32(comboBoxProfile.SelectedValue) > 0)
_controller.ProfileChanged(Convert.ToInt32(comboBoxProfile.SelectedValue));
}
private void HandleAddProfile(object sender, EventArgs e)
@ -48,7 +65,7 @@ namespace MSFSPopoutPanelManager.UI
if (dialogResult == DialogResult.OK)
{
_controller.AddUserProfile(form.ProfileName);
_controller.AddProfile(form.ProfileName);
}
}
}
@ -60,45 +77,30 @@ namespace MSFSPopoutPanelManager.UI
using (var form = new ConfirmDialogForm(title, message) { StartPosition = FormStartPosition.CenterParent })
{
var dialogResult = form.ShowDialog();
if (dialogResult == DialogResult.Yes)
{
if (form.ShowDialog() == DialogResult.Yes)
_controller.DeleteProfile();
}
}
}
private void HandleProfileChanged(object sender, EventArgs e)
private void HandleStartPanelSelection(object sender, EventArgs e)
{
if(Convert.ToInt32(comboBoxProfile.SelectedValue) > 0)
_controller.ProfileChanged(Convert.ToInt32(comboBoxProfile.SelectedValue));
if (!_controller.HasExistingPanelCoordinates)
{
_controller.StartPanelSelection();
}
private void HandlePanelSelectionStarted(object sender, EventArgs e)
{
if (_controller.ActiveProfile != null)
{
if (_controller.ActiveProfile.PanelConfigs.Count > 0)
else
{
var title = "Confirm Overwrite";
var message = "Are you sure you want to overwrite existing saved panel locations and settings for this profile??";
var message = "WARNING! Are you sure you want to overwrite existing saved panel locations and ALL settings for this profile?";
using (var form = new ConfirmDialogForm(title, message) { StartPosition = FormStartPosition.CenterParent })
{
var dialogResult = form.ShowDialog();
if (dialogResult == DialogResult.No)
{
return;
if (form.ShowDialog() == DialogResult.Yes)
_controller.StartPanelSelection();
}
}
}
_controller.StartPanelSelection(ParentForm);
}
}
private void HandleOnUIStateChanged(object sender, EventArgs<PanelSelectionUIState> e)
{
switch (e.Value)
@ -108,7 +110,7 @@ namespace MSFSPopoutPanelManager.UI
buttonAddProfile.Enabled = true;
buttonDeleteProfile.Enabled = false;
buttonSetDefault.Enabled = false;
buttonPanelSelection.Enabled = false;
buttonStartPanelSelection.Enabled = false;
checkBoxShowPanelLocation.Enabled = false;
buttonStartPopOut.Enabled = false;
break;
@ -117,7 +119,7 @@ namespace MSFSPopoutPanelManager.UI
buttonAddProfile.Enabled = true;
buttonDeleteProfile.Enabled = true;
buttonSetDefault.Enabled = true;
buttonPanelSelection.Enabled = true;
buttonStartPanelSelection.Enabled = true;
checkBoxShowPanelLocation.Enabled = true;
buttonStartPopOut.Enabled = false;
break;
@ -126,7 +128,7 @@ namespace MSFSPopoutPanelManager.UI
buttonAddProfile.Enabled = false;
buttonDeleteProfile.Enabled = false;
buttonSetDefault.Enabled = false;
buttonPanelSelection.Enabled = false;
buttonStartPanelSelection.Enabled = false;
checkBoxShowPanelLocation.Enabled = false;
buttonStartPopOut.Enabled = false;
break;
@ -135,7 +137,7 @@ namespace MSFSPopoutPanelManager.UI
buttonAddProfile.Enabled = true;
buttonDeleteProfile.Enabled = true;
buttonSetDefault.Enabled = true;
buttonPanelSelection.Enabled = true;
buttonStartPanelSelection.Enabled = true;
checkBoxShowPanelLocation.Enabled = true;
buttonStartPopOut.Enabled = true;
buttonStartPopOut.Focus();
@ -145,7 +147,7 @@ namespace MSFSPopoutPanelManager.UI
buttonAddProfile.Enabled = true;
buttonDeleteProfile.Enabled = true;
buttonSetDefault.Enabled = true;
buttonPanelSelection.Enabled = true;
buttonStartPanelSelection.Enabled = true;
checkBoxShowPanelLocation.Enabled = true;
buttonStartPopOut.Enabled = false;
break;
@ -154,7 +156,7 @@ namespace MSFSPopoutPanelManager.UI
buttonAddProfile.Enabled = false;
buttonDeleteProfile.Enabled = false;
buttonSetDefault.Enabled = false;
buttonPanelSelection.Enabled = false;
buttonStartPanelSelection.Enabled = false;
checkBoxShowPanelLocation.Enabled = false;
buttonStartPopOut.Enabled = false;
break;

View file

@ -0,0 +1,140 @@

using MSFSPopoutPanelManager.Provider;
using MSFSPopoutPanelManager.Shared;
using System;
namespace MSFSPopoutPanelManager.UIController
{
public class ApplicationController
{
private const int MSFS_CONNECTION_CHECK_INTERVAL = 3000;
private System.Timers.Timer _timer;
private IApplicationView _view;
private AppSettingData _appSettings;
protected DataStore UserProfileDataStore { get; set; }
public ApplicationController(IApplicationView view)
{
_view = view;
UserProfileDataStore = new DataStore();
}
public PanelSelectionController PanelSelectionController { get; set; }
public PanelConfigurationController PanelConfigurationController { get; set; }
public event EventHandler<EventArgs<bool>> OnSimConnectionChanged;
public event EventHandler OnPanelSelectionActivated;
public event EventHandler OnPanelConfigurationActivated;
public void Initialize()
{
PanelSelectionController = new PanelSelectionController(_view.PanelSelection, UserProfileDataStore);
PanelConfigurationController = new PanelConfigurationController(_view.PanelConfiguration, UserProfileDataStore);
PanelSelectionController.OnPopOutCompleted += (source, e) =>
{
PanelConfigurationController.Initialize();
OnPanelConfigurationActivated?.Invoke(this, null);
};
OnPanelSelectionActivated?.Invoke(this, null);
CheckSimulatorStarted();
_appSettings = FileManager.ReadAppSettingData();
_view.AlwaysOnTop = _appSettings.AlwaysOnTop;
_view.AutoPanning = _appSettings.UseAutoPanning;
_view.AutoStart = Autostart.CheckIsAutoStart();
_view.MinimizeToTray = _appSettings.MinimizeToTray;
if (_view.AlwaysOnTop)
_view.Form.TopMost = true;
}
private void CheckSimulatorStarted()
{
OnSimConnectionChanged?.Invoke(this, new EventArgs<bool>(false));
// Autoconnect to flight simulator
_timer = new System.Timers.Timer();
_timer.Interval = MSFS_CONNECTION_CHECK_INTERVAL;
_timer.Enabled = true;
_timer.Elapsed += (source, e) =>
{
var simulatorProcess = WindowManager.GetSimulatorProcess();
OnSimConnectionChanged?.Invoke(this, new EventArgs<bool>(simulatorProcess != null));
};
}
public void Restart()
{
PanelConfigurationController.UnhookWinEvent();
// Try to close all Cutome Panel window
UserProfileDataStore.ActiveUserProfile.PanelConfigs.FindAll(p => p.PanelType == PanelType.CustomPopout).ForEach(panel => WindowManager.CloseWindow(panel.PanelHandle));
OnPanelSelectionActivated?.Invoke(this, null);
Logger.ClearStatus();
}
public void SetMinimizeToTray(bool value) {
_appSettings.MinimizeToTray = value;
FileManager.WriteAppSettingData(_appSettings);
}
public void SetAlwaysOnTop(bool value)
{
_appSettings.AlwaysOnTop = value;
FileManager.WriteAppSettingData(_appSettings);
WindowManager.ApplyAlwaysOnTop(_view.Form.Handle, value, _view.Form.Bounds);
}
public void SetAutoStart(bool value)
{
if (value)
Autostart.Activate();
else
Autostart.Deactivate();
}
public void SetAutoPanning(bool value)
{
_appSettings.UseAutoPanning = value;
FileManager.WriteAppSettingData(_appSettings);
}
public void MinimizeAllPanels(bool isMinimized)
{
if (isMinimized)
{
PanelConfigurationController.DisablePanelChanges(true);
PInvoke.EnumWindows(new PInvoke.CallBack(EnumAllPanels), 0);
}
else
{
PanelConfigurationController.DisablePanelChanges(false);
PInvoke.EnumWindows(new PInvoke.CallBack(EnumAllPanels), 1);
}
}
public bool EnumAllPanels(IntPtr hwnd, int index)
{
var className = PInvoke.GetClassName(hwnd);
var caption = PInvoke.GetWindowText(hwnd);
if (className == "AceApp" && caption.IndexOf("Microsoft Flight Simulator") == -1) // MSFS windows designation
{
if(index == 0)
PInvoke.ShowWindow(hwnd, PInvokeConstant.SW_MINIMIZE);
else
PInvoke.ShowWindow(hwnd, PInvokeConstant.SW_RESTORE);
}
return true;
}
}
}

View file

@ -1,33 +0,0 @@
using MSFSPopoutPanelManager.Shared;
using System;
using System.ComponentModel;
namespace MSFSPopoutPanelManager.UIController
{
public class BaseController : INotifyPropertyChanged
{
// Need this for PropertyChanged.Fody plugin to add dynamic notification for binding for default SET property in controllers
public event PropertyChangedEventHandler PropertyChanged;
public static UserProfileData ActiveUserPlaneProfile { get; set; }
#region Shared Events
public static event EventHandler OnPopOutCompleted;
public static event EventHandler OnRestart;
public void PopOutCompleted()
{
OnPopOutCompleted?.Invoke(this, null);
}
public void Restart()
{
ActiveUserPlaneProfile = null;
OnRestart?.Invoke(this, null);
}
#endregion
}
}

View file

@ -0,0 +1,21 @@
using System.Windows.Forms;
namespace MSFSPopoutPanelManager.UIController
{
public interface IApplicationView
{
public Form Form { get; }
public IPanelSelectionView PanelSelection { get; }
public IPanelConfigurationView PanelConfiguration { get; }
public bool MinimizeToTray { get; set; }
public bool AlwaysOnTop { get; set; }
public bool AutoStart { get; set; }
public bool AutoPanning { get; set; }
}
}

View file

@ -0,0 +1,9 @@
namespace MSFSPopoutPanelManager.UIController
{
public interface IPanelConfigurationView
{
public bool IsPanelLocked { set; }
public bool IsPanelChangeDisabled { set; }
}
}

View file

@ -0,0 +1,11 @@
using System.Windows.Forms;
namespace MSFSPopoutPanelManager.UIController
{
public interface IPanelSelectionView
{
public Form Form { get; }
public bool ShowPanelLocationOverlay { get; set; }
}
}

View file

@ -1,118 +1,148 @@
using MSFSPopoutPanelManager.Provider;
using MSFSPopoutPanelManager.Shared;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
namespace MSFSPopoutPanelManager.UIController
{
public class PanelConfigurationController : BaseController
public class PanelConfigurationController
{
private const int WINEVENT_OUTOFCONTEXT = 0;
//private const uint EVENT_SYSTEM_MOVESIZEEND = 0x000B;
private const uint EVENT_OBJECT_LOCATIONCHANGE = 0x800B;
private IPanelConfigurationView _view;
private bool _isDisablePanelChanges;
private static PInvoke.WinEventProc _winEvent; // keep this as static to prevent garbage collect or the app will crash
private IntPtr _winEventHook;
public PanelConfigurationController()
public PanelConfigurationController(IPanelConfigurationView view, DataStore dataStore)
{
BaseController.OnPopOutCompleted += HandlePopOutCompleted;
PanelConfigs = new BindingList<PanelConfig>();
_view = view;
DataStore = dataStore;
_winEvent = new PInvoke.WinEventProc(EventCallback);
}
public DataStore DataStore { get; set; }
public void Initialize()
{
// Populate panel data
DataStore.PanelConfigs.Clear();
DataStore.ActiveUserProfile.PanelConfigs.ForEach(p => DataStore.PanelConfigs.Add(p));
// Setup panel config event hooks
_winEventHook = PInvoke.SetWinEventHook(PInvokeConstant.EVENT_SYSTEM_MOVESIZEEND, PInvokeConstant.EVENT_OBJECT_LOCATIONCHANGE, WindowManager.GetApplicationProcess().Handle, _winEvent, 0, 0, PInvokeConstant.WINEVENT_OUTOFCONTEXT);
_view.IsPanelLocked = DataStore.ActiveUserProfile.IsLocked;
_isDisablePanelChanges = false;
_view.IsPanelChangeDisabled = false;
}
public event EventHandler RefreshDataUI;
public event EventHandler<EventArgs<int>> HightlightSelectedPanel;
public BindingList<PanelConfig> PanelConfigs { get; set; }
public void SaveSettings()
{
var profile = BaseController.ActiveUserPlaneProfile;
profile.PanelConfigs = PanelConfigs.ToList();
var allProfiles = FileManager.ReadUserProfileData();
var index = allProfiles.FindIndex(x => x.ProfileId == profile.ProfileId);
allProfiles[index] = profile;
FileManager.WriteUserProfileData(allProfiles);
}
public void BackToPanelSelection()
public void UnhookWinEvent()
{
// Unhook all Win API events
PInvoke.UnhookWinEvent(_winEventHook);
}
// Try to close all Cutome Panel window
PanelConfigs.ToList().FindAll(p => p.PanelType == PanelType.CustomPopout).ForEach(panel => WindowManager.CloseWindow(panel.PanelHandle));
public void LockPanelChanged(bool isLocked)
{
DataStore.ActiveUserProfile.IsLocked = isLocked;
SaveSettings();
PanelConfigs.Clear();
Restart();
_view.IsPanelLocked = isLocked;
}
public void DisablePanelChanges(bool isDisabled)
{
_isDisablePanelChanges = isDisabled;
_view.IsPanelChangeDisabled = isDisabled;
}
public void CellValueChanged(int rowIndex, PanelConfigDataColumn column, object newCellValue)
{
int orignalLeft = PanelConfigs[rowIndex].Left;
if (_isDisablePanelChanges || DataStore.ActiveUserProfile.IsLocked || DataStore.PanelConfigs == null || DataStore.PanelConfigs.Count == 0)
return;
int orignalLeft = DataStore.PanelConfigs[rowIndex].Left;
if (rowIndex != -1)
{
switch (column)
{
case PanelConfigDataColumn.PanelName:
PInvoke.SetWindowText(PanelConfigs[rowIndex].PanelHandle, PanelConfigs[rowIndex].PanelName);
var name = DataStore.PanelConfigs[rowIndex].PanelName;
if (name.IndexOf("(Custom)") == -1)
name = name + " (Custom)";
PInvoke.SetWindowText(DataStore.PanelConfigs[rowIndex].PanelHandle, name);
break;
case PanelConfigDataColumn.Left:
PInvoke.MoveWindow(PanelConfigs[rowIndex].PanelHandle, PanelConfigs[rowIndex].Left, PanelConfigs[rowIndex].Top, PanelConfigs[rowIndex].Width, PanelConfigs[rowIndex].Height, true);
PInvoke.MoveWindow(DataStore.PanelConfigs[rowIndex].PanelHandle, DataStore.PanelConfigs[rowIndex].Left, DataStore.PanelConfigs[rowIndex].Top, DataStore.PanelConfigs[rowIndex].Width, DataStore.PanelConfigs[rowIndex].Height, true);
break;
case PanelConfigDataColumn.Top:
PInvoke.MoveWindow(PanelConfigs[rowIndex].PanelHandle, PanelConfigs[rowIndex].Left, PanelConfigs[rowIndex].Top, PanelConfigs[rowIndex].Width, PanelConfigs[rowIndex].Height, true);
PInvoke.MoveWindow(DataStore.PanelConfigs[rowIndex].PanelHandle, DataStore.PanelConfigs[rowIndex].Left, DataStore.PanelConfigs[rowIndex].Top, DataStore.PanelConfigs[rowIndex].Width, DataStore.PanelConfigs[rowIndex].Height, true);
break;
case PanelConfigDataColumn.Width:
PInvoke.MoveWindow(PanelConfigs[rowIndex].PanelHandle, PanelConfigs[rowIndex].Left, PanelConfigs[rowIndex].Top, PanelConfigs[rowIndex].Width, PanelConfigs[rowIndex].Height, true);
MSFSBugPanelShiftWorkaround(PanelConfigs[rowIndex].PanelHandle, orignalLeft, PanelConfigs[rowIndex].Top, PanelConfigs[rowIndex].Width, PanelConfigs[rowIndex].Height);
PInvoke.MoveWindow(DataStore.PanelConfigs[rowIndex].PanelHandle, DataStore.PanelConfigs[rowIndex].Left, DataStore.PanelConfigs[rowIndex].Top, DataStore.PanelConfigs[rowIndex].Width, DataStore.PanelConfigs[rowIndex].Height, true);
MSFSBugPanelShiftWorkaround(DataStore.PanelConfigs[rowIndex].PanelHandle, orignalLeft, DataStore.PanelConfigs[rowIndex].Top, DataStore.PanelConfigs[rowIndex].Width, DataStore.PanelConfigs[rowIndex].Height);
break;
case PanelConfigDataColumn.Height:
PInvoke.MoveWindow(PanelConfigs[rowIndex].PanelHandle, PanelConfigs[rowIndex].Left, PanelConfigs[rowIndex].Top, PanelConfigs[rowIndex].Width, PanelConfigs[rowIndex].Height, true);
MSFSBugPanelShiftWorkaround(PanelConfigs[rowIndex].PanelHandle, orignalLeft, PanelConfigs[rowIndex].Top, PanelConfigs[rowIndex].Width, PanelConfigs[rowIndex].Height);
PInvoke.MoveWindow(DataStore.PanelConfigs[rowIndex].PanelHandle, DataStore.PanelConfigs[rowIndex].Left, DataStore.PanelConfigs[rowIndex].Top, DataStore.PanelConfigs[rowIndex].Width, DataStore.PanelConfigs[rowIndex].Height, true);
MSFSBugPanelShiftWorkaround(DataStore.PanelConfigs[rowIndex].PanelHandle, orignalLeft, DataStore.PanelConfigs[rowIndex].Top, DataStore.PanelConfigs[rowIndex].Width, DataStore.PanelConfigs[rowIndex].Height);
break;
case PanelConfigDataColumn.AlwaysOnTop:
WindowManager.ApplyAlwaysOnTop(PanelConfigs[rowIndex].PanelHandle, PanelConfigs[rowIndex].AlwaysOnTop, new Rectangle(PanelConfigs[rowIndex].Left, PanelConfigs[rowIndex].Top, PanelConfigs[rowIndex].Width, PanelConfigs[rowIndex].Height));
DataStore.PanelConfigs[rowIndex].AlwaysOnTop = Convert.ToBoolean(newCellValue);
WindowManager.ApplyAlwaysOnTop(DataStore.PanelConfigs[rowIndex].PanelHandle, DataStore.PanelConfigs[rowIndex].AlwaysOnTop, new Rectangle(DataStore.PanelConfigs[rowIndex].Left, DataStore.PanelConfigs[rowIndex].Top, DataStore.PanelConfigs[rowIndex].Width, DataStore.PanelConfigs[rowIndex].Height));
break;
case PanelConfigDataColumn.HideTitlebar:
WindowManager.ApplyHidePanelTitleBar(PanelConfigs[rowIndex].PanelHandle, PanelConfigs[rowIndex].HideTitlebar);
DataStore.PanelConfigs[rowIndex].HideTitlebar = Convert.ToBoolean(newCellValue);
WindowManager.ApplyHidePanelTitleBar(DataStore.PanelConfigs[rowIndex].PanelHandle, DataStore.PanelConfigs[rowIndex].HideTitlebar);
break;
default:
return;
}
SaveSettings();
}
}
public void CellValueIncrDecr(int rowIndex, PanelConfigDataColumn column, int changeAmount)
{
int orignalLeft = PanelConfigs[rowIndex].Left;
if (_isDisablePanelChanges || DataStore.ActiveUserProfile.IsLocked || DataStore.PanelConfigs == null || DataStore.PanelConfigs.Count == 0)
return;
int orignalLeft = DataStore.PanelConfigs[rowIndex].Left;
if (rowIndex != -1)
{
switch (column)
{
case PanelConfigDataColumn.Left:
PInvoke.MoveWindow(PanelConfigs[rowIndex].PanelHandle, PanelConfigs[rowIndex].Left + changeAmount, PanelConfigs[rowIndex].Top, PanelConfigs[rowIndex].Width, PanelConfigs[rowIndex].Height, false);
PInvoke.MoveWindow(DataStore.PanelConfigs[rowIndex].PanelHandle, DataStore.PanelConfigs[rowIndex].Left + changeAmount, DataStore.PanelConfigs[rowIndex].Top, DataStore.PanelConfigs[rowIndex].Width, DataStore.PanelConfigs[rowIndex].Height, false);
DataStore.PanelConfigs[rowIndex].Left = DataStore.PanelConfigs[rowIndex].Left + changeAmount;
break;
case PanelConfigDataColumn.Top:
PInvoke.MoveWindow(PanelConfigs[rowIndex].PanelHandle, PanelConfigs[rowIndex].Left, PanelConfigs[rowIndex].Top + changeAmount, PanelConfigs[rowIndex].Width, PanelConfigs[rowIndex].Height, false);
PInvoke.MoveWindow(DataStore.PanelConfigs[rowIndex].PanelHandle, DataStore.PanelConfigs[rowIndex].Left, DataStore.PanelConfigs[rowIndex].Top + changeAmount, DataStore.PanelConfigs[rowIndex].Width, DataStore.PanelConfigs[rowIndex].Height, false);
DataStore.PanelConfigs[rowIndex].Top = DataStore.PanelConfigs[rowIndex].Top + changeAmount;
break;
case PanelConfigDataColumn.Width:
PInvoke.MoveWindow(PanelConfigs[rowIndex].PanelHandle, PanelConfigs[rowIndex].Left, PanelConfigs[rowIndex].Top, PanelConfigs[rowIndex].Width + changeAmount, PanelConfigs[rowIndex].Height, false);
MSFSBugPanelShiftWorkaround(PanelConfigs[rowIndex].PanelHandle, orignalLeft, PanelConfigs[rowIndex].Top, PanelConfigs[rowIndex].Width + changeAmount, PanelConfigs[rowIndex].Height);
PInvoke.MoveWindow(DataStore.PanelConfigs[rowIndex].PanelHandle, DataStore.PanelConfigs[rowIndex].Left, DataStore.PanelConfigs[rowIndex].Top, DataStore.PanelConfigs[rowIndex].Width + changeAmount, DataStore.PanelConfigs[rowIndex].Height, false);
MSFSBugPanelShiftWorkaround(DataStore.PanelConfigs[rowIndex].PanelHandle, orignalLeft, DataStore.PanelConfigs[rowIndex].Top, DataStore.PanelConfigs[rowIndex].Width + changeAmount, DataStore.PanelConfigs[rowIndex].Height);
DataStore.PanelConfigs[rowIndex].Width = DataStore.PanelConfigs[rowIndex].Width + changeAmount;
break;
case PanelConfigDataColumn.Height:
PInvoke.MoveWindow(PanelConfigs[rowIndex].PanelHandle, PanelConfigs[rowIndex].Left, PanelConfigs[rowIndex].Top, PanelConfigs[rowIndex].Width, PanelConfigs[rowIndex].Height + changeAmount, false);
MSFSBugPanelShiftWorkaround(PanelConfigs[rowIndex].PanelHandle, orignalLeft, PanelConfigs[rowIndex].Top, PanelConfigs[rowIndex].Width, PanelConfigs[rowIndex].Height + changeAmount);
PInvoke.MoveWindow(DataStore.PanelConfigs[rowIndex].PanelHandle, DataStore.PanelConfigs[rowIndex].Left, DataStore.PanelConfigs[rowIndex].Top, DataStore.PanelConfigs[rowIndex].Width, DataStore.PanelConfigs[rowIndex].Height + changeAmount, false);
MSFSBugPanelShiftWorkaround(DataStore.PanelConfigs[rowIndex].PanelHandle, orignalLeft, DataStore.PanelConfigs[rowIndex].Top, DataStore.PanelConfigs[rowIndex].Width, DataStore.PanelConfigs[rowIndex].Height + changeAmount);
DataStore.PanelConfigs[rowIndex].Height = DataStore.PanelConfigs[rowIndex].Height + changeAmount;
break;
default:
return;
}
SaveSettings();
}
}
@ -129,33 +159,29 @@ namespace MSFSPopoutPanelManager.UIController
PInvoke.MoveWindow(handle, originalLeft, top, width, height, false);
}
private void HandlePopOutCompleted(object sender, EventArgs e)
{
// Populate panel data
BaseController.ActiveUserPlaneProfile.PanelConfigs.ForEach(p => PanelConfigs.Add(p));
// Setup panel config event hooks
_winEventHook = PInvoke.SetWinEventHook(EVENT_OBJECT_LOCATIONCHANGE, EVENT_OBJECT_LOCATIONCHANGE, IntPtr.Zero, _winEvent, 0, 0, WINEVENT_OUTOFCONTEXT);
}
private Rectangle _lastWindowRectangle;
private int count = 1;
private void EventCallback(IntPtr hWinEventHook, uint iEvent, IntPtr hWnd, int idObject, int idChild, int dwEventThread, int dwmsEventTime)
{
if (hWnd == IntPtr.Zero) return;
var panelConfig = PanelConfigs.FirstOrDefault(panel => panel.PanelHandle == hWnd);
if (panelConfig != null)
// check by priority to minimize escaping constraint
if (hWnd == IntPtr.Zero
|| idObject != 0
|| hWinEventHook != _winEventHook
|| !(iEvent == PInvokeConstant.EVENT_OBJECT_LOCATIONCHANGE || iEvent == PInvokeConstant.EVENT_SYSTEM_MOVESIZEEND)
|| _isDisablePanelChanges
|| DataStore.PanelConfigs == null || DataStore.PanelConfigs.Count == 0)
{
var rowIndex = PanelConfigs.IndexOf(panelConfig);
return;
}
var panelConfig = DataStore.PanelConfigs.FirstOrDefault(panel => panel.PanelHandle == hWnd);
if (panelConfig != null)
{
switch (iEvent)
{
case EVENT_OBJECT_LOCATIONCHANGE:
case PInvokeConstant.EVENT_OBJECT_LOCATIONCHANGE:
Rectangle winRectangle;
PInvoke.GetWindowRect(panelConfig.PanelHandle, out winRectangle);
@ -166,19 +192,50 @@ namespace MSFSPopoutPanelManager.UIController
Rectangle clientRectangle;
PInvoke.GetClientRect(panelConfig.PanelHandle, out clientRectangle);
if (!DataStore.ActiveUserProfile.IsLocked)
{
panelConfig.Left = winRectangle.Left;
panelConfig.Top = winRectangle.Top;
panelConfig.Width = clientRectangle.Width + 16;
panelConfig.Height = clientRectangle.Height + 39;
var rowIndex = DataStore.PanelConfigs.IndexOf(panelConfig);
HightlightSelectedPanel?.Invoke(this, new EventArgs<int>(rowIndex));
}
// Detect if window is maximized, if so, save settings
WINDOWPLACEMENT wp = new WINDOWPLACEMENT();
wp.length = System.Runtime.InteropServices.Marshal.SizeOf(wp);
PInvoke.GetWindowPlacement(hWnd, ref wp);
if (wp.showCmd == PInvokeConstant.SW_SHOWMAXIMIZED || wp.showCmd == PInvokeConstant.SW_SHOWMINIMIZED)
{
if (DataStore.ActiveUserProfile.IsLocked && panelConfig.PanelType == PanelType.CustomPopout)
PInvoke.ShowWindow(hWnd, PInvokeConstant.SW_RESTORE);
else
SaveSettings();
}
break;
case PInvokeConstant.EVENT_SYSTEM_MOVESIZEEND:
if(DataStore.ActiveUserProfile.IsLocked && panelConfig.PanelType == PanelType.CustomPopout)
PInvoke.MoveWindow(panelConfig.PanelHandle, panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height, false);
else
SaveSettings();
break;
}
RefreshDataUI?.Invoke(this, null);
}
}
private void SaveSettings()
{
var profile = DataStore.ActiveUserProfile;
profile.PanelConfigs = DataStore.PanelConfigs.ToList();
var allProfiles = FileManager.ReadUserProfileData();
var index = allProfiles.FindIndex(x => x.ProfileId == profile.ProfileId);
allProfiles[index] = profile;
FileManager.WriteUserProfileData(allProfiles);
}
}

View file

@ -9,72 +9,59 @@ using System.Windows.Forms;
namespace MSFSPopoutPanelManager.UIController
{
public class PanelSelectionController : BaseController
public class PanelSelectionController
{
private PanelSelectionManager _panelSelectionManager;
private Form _parentForm;
private IPanelSelectionView _view;
public PanelSelectionController()
public PanelSelectionController(IPanelSelectionView view, DataStore dataStore)
{
_panelSelectionManager = new PanelSelectionManager();
_panelSelectionManager.OnSelectionStarted += PanelSelectionManager_OnPanelSelectionStarted;
_panelSelectionManager.OnSelectionCompleted += PanelSelectionManager_OnPanelSelectionCompleted;
_panelSelectionManager.OnPanelAdded += PanelSelectionManager_OnPanelAdded;
_panelSelectionManager.OnPanelSubtracted += PanelSelectionManager_OnPanelSubtracted;
_view = view;
DataStore = dataStore;
BaseController.OnRestart += HandleOnRestart;
PanelCoordinates = new BindingList<PanelSourceCoordinate>();
_panelSelectionManager = new PanelSelectionManager(_view.Form);
_panelSelectionManager.OnSelectionCompleted += HandleOnPanelSelectionCompleted;
}
public DataStore DataStore { get; set; }
public event EventHandler<EventArgs<PanelSelectionUIState>> OnUIStateChanged;
public int SelectedProfileId { get; set; }
public UserProfileData ActiveProfile { get { return BaseController.ActiveUserPlaneProfile; } }
public BindingList<UserProfileData> PlaneProfileList { get; set; }
public BindingList<PanelSourceCoordinate> PanelCoordinates { get; set; }
public bool HasActiveProfile { get { return true; } }
public bool ShowPanelLocationOverlay { get; set; }
public event EventHandler OnPopOutCompleted;
public void Initialize()
{
// Setup Defaults
LoadPlaneProfileList();
PanelCoordinates.Clear();
_view.ShowPanelLocationOverlay = false;
DataStore.UserProfiles = new BindingList<UserProfileData>(FileManager.ReadUserProfileData().OrderBy(x => x.ProfileName).ToList());
DataStore.ActiveProfilePanelCoordinates = new BindingList<PanelSourceCoordinate>(DataStore.ActiveUserProfile == null ? new List<PanelSourceCoordinate>() : DataStore.ActiveUserProfile.PanelSourceCoordinates);
var defaultProfile = FileManager.ReadUserProfileData().Find(x => x.IsDefaultProfile);
SelectedProfileId = defaultProfile == null ? 0 : defaultProfile.ProfileId;
ActiveUserPlaneProfile = defaultProfile;
ShowPanelLocationOverlay = false;
if (SelectedProfileId < 1)
if(defaultProfile == null)
{
DataStore.ActiveUserProfileId= -1;
OnUIStateChanged?.Invoke(this, new EventArgs<PanelSelectionUIState>(PanelSelectionUIState.NoProfileSelected));
}
else
{
DataStore.ActiveUserProfileId = defaultProfile.ProfileId;
OnUIStateChanged?.Invoke(this, new EventArgs<PanelSelectionUIState>(PanelSelectionUIState.ProfileSelected));
}
}
public void AddUserProfile(string profileName)
public void AddProfile(string profileName)
{
var profileId = PlaneProfileList.Count > 0 ? PlaneProfileList.Max(x => x.ProfileId) + 1 : 1;
var newProfileId = DataStore.UserProfiles.Count > 0 ? DataStore.UserProfiles.Max(x => x.ProfileId) + 1 : 1;
var newPlaneProfile = new UserProfileData() { ProfileId = newProfileId, ProfileName = profileName };
var newPlaneProfile = new UserProfileData() { ProfileId = profileId, ProfileName = profileName };
var tmpList = DataStore.UserProfiles.ToList();
tmpList.Add(newPlaneProfile);
var index = tmpList.OrderBy(x => x.ProfileName).ToList().FindIndex(x => x.ProfileId == newProfileId);
DataStore.UserProfiles.Insert(index, newPlaneProfile);
FileManager.WriteUserProfileData(DataStore.UserProfiles.ToList()); // save the backing list data
// Find insert index for new profile into list in ascending order
var list = PlaneProfileList.ToList();
list.Add(newPlaneProfile);
var index = list.OrderBy(x => x.ProfileName).ToList().FindIndex(x => x.ProfileId == profileId);
PlaneProfileList.Insert(index, newPlaneProfile);
FileManager.WriteUserProfileData(PlaneProfileList.ToList());
SelectedProfileId = profileId;
ActiveUserPlaneProfile = newPlaneProfile;
PanelCoordinates.Clear();
DataStore.ActiveUserProfileId = newProfileId;
OnUIStateChanged?.Invoke(this, new EventArgs<PanelSelectionUIState>(PanelSelectionUIState.ProfileSelected));
Logger.Status($"Profile '{newPlaneProfile.ProfileName}' has been added successfully.", StatusMessageType.Info);
@ -82,16 +69,14 @@ namespace MSFSPopoutPanelManager.UIController
public void DeleteProfile()
{
if (SelectedProfileId != 0)
if (DataStore.ActiveUserProfileId != -1)
{
var profileToRemove = PlaneProfileList.First(x => x.ProfileId == SelectedProfileId);
var profileToRemove = DataStore.UserProfiles.First(x => x.ProfileId == DataStore.ActiveUserProfileId);
DataStore.UserProfiles.Remove(profileToRemove);
FileManager.WriteUserProfileData(DataStore.UserProfiles.ToList());
PlaneProfileList.Remove(profileToRemove);
FileManager.WriteUserProfileData(PlaneProfileList.ToList());
PanelCoordinates.Clear();
_panelSelectionManager.Reset();
SelectedProfileId = -1;
DataStore.ActiveUserProfileId= -1;
OnUIStateChanged?.Invoke(this, new EventArgs<PanelSelectionUIState>(PanelSelectionUIState.NoProfileSelected));
@ -101,18 +86,18 @@ namespace MSFSPopoutPanelManager.UIController
public void SetDefaultProfile()
{
if (SelectedProfileId < 1)
if (DataStore.ActiveUserProfileId== -1)
return;
var profile = PlaneProfileList.First(x => x.ProfileId == SelectedProfileId);
var profile = DataStore.UserProfiles.First(x => x.ProfileId == DataStore.ActiveUserProfileId);
profile.IsDefaultProfile = true;
foreach (var p in PlaneProfileList)
foreach (var p in DataStore.UserProfiles)
{
if (p.ProfileId != SelectedProfileId)
if (p.ProfileId != DataStore.ActiveUserProfileId)
p.IsDefaultProfile = false;
}
FileManager.WriteUserProfileData(PlaneProfileList.ToList());
FileManager.WriteUserProfileData(DataStore.UserProfiles.ToList());
Logger.Status($"Profile '{profile.ProfileName}' has been set as default.", StatusMessageType.Info);
}
@ -121,55 +106,89 @@ namespace MSFSPopoutPanelManager.UIController
{
Logger.ClearStatus();
PanelCoordinates.Clear();
SelectedProfileId = profileId;
if (SelectedProfileId < 1)
if (profileId == -1)
{
ActiveUserPlaneProfile = null;
DataStore.ActiveUserProfileId= -1;
OnUIStateChanged?.Invoke(this, new EventArgs<PanelSelectionUIState>(PanelSelectionUIState.NoProfileSelected));
}
else
{
ActiveUserPlaneProfile = PlaneProfileList.First(x => x.ProfileId == SelectedProfileId);
ActiveUserPlaneProfile.PanelSourceCoordinates.ForEach(c => PanelCoordinates.Add(c));
_panelSelectionManager.PanelCoordinates = PanelCoordinates.ToList();
_panelSelectionManager.DrawPanelLocationOverlay();
_panelSelectionManager.ShowPanelLocationOverlay(false);
ShowPanelLocationOverlay = false;
//if (PanelCoordinates.Count == 0)
// OnUIStateChanged?.Invoke(this, new EventArgs<PanelSelectionUIState>(PanelSelectionUIState.ProfileSelected));
//else
DataStore.ActiveUserProfileId = profileId;
_panelSelectionManager.Reset();
_view.ShowPanelLocationOverlay = false;
OnUIStateChanged?.Invoke(this, new EventArgs<PanelSelectionUIState>(PanelSelectionUIState.PanelSelectionCompletedValid));
}
}
public void StartPanelSelection(Form appForm)
public bool HasExistingPanelCoordinates
{
_parentForm = appForm;
get
{
return DataStore.ActiveUserProfile != null && DataStore.ActiveUserProfile.PanelSourceCoordinates.Count > 0;
}
}
if (WindowManager.GetApplicationProcess() == null)
return;
public void StartPanelSelection()
{
DataStore.ActiveUserProfile.Reset();
// Temporary make app go to background
WindowManager.ApplyAlwaysOnTop(_parentForm.Handle, false, _parentForm.Bounds);
_panelSelectionManager.PanelCoordinates = DataStore.ActiveUserProfile.PanelSourceCoordinates;
ActiveUserPlaneProfile.PanelConfigs = new List<PanelConfig>();
OnUIStateChanged?.Invoke(this, new EventArgs<PanelSelectionUIState>(PanelSelectionUIState.PanelSelectionStarted));
// Temporary minimize the app during panel selection
if (_view.Form != null)
_view.Form.WindowState = FormWindowState.Minimized;
// Set MSFS to foreground for panel selection
var simulatorProcess = WindowManager.GetSimulatorProcess();
if (simulatorProcess != null)
PInvoke.SetForegroundWindow(simulatorProcess.Handle);
_panelSelectionManager.AppForm = appForm;
_panelSelectionManager.Start();
Logger.Status("Panels selection has started.", StatusMessageType.Info);
}
public void ShowPanelLocationOverlayChanged(bool show)
private void HandleOnPanelSelectionCompleted(object sender, EventArgs e)
{
ShowPanelLocationOverlay = show;
_panelSelectionManager.ShowPanelLocationOverlay(show);
// If enable, save the current viewport into custom view by Ctrl-Alt-0
if (FileManager.ReadAppSettingData().UseAutoPanning)
{
var simualatorProcess = WindowManager.GetSimulatorProcess();
if (simualatorProcess != null)
{
InputEmulationManager.SaveCustomViewZero(simualatorProcess.Handle);
}
}
public void StartPopOut(Form appForm)
if (_view.Form != null)
_view.Form.WindowState = FormWindowState.Normal;
PInvoke.SetForegroundWindow(_view.Form.Handle);
DataStore.ActiveProfilePanelCoordinates.Clear();
DataStore.ActiveUserProfile.PanelSourceCoordinates.ForEach(c => DataStore.ActiveProfilePanelCoordinates.Add(c));
FileManager.WriteUserProfileData(DataStore.UserProfiles.ToList());
OnUIStateChanged?.Invoke(this, new EventArgs<PanelSelectionUIState>(PanelSelectionUIState.PanelSelectionCompletedValid));
_view.ShowPanelLocationOverlay = true;
if (DataStore.ActiveUserProfile.PanelSourceCoordinates.Count > 0)
Logger.Status("Panels selection is completed. Please click 'Start Pop Out' to start popping out these panels.", StatusMessageType.Info);
else
Logger.Status("Panels selection is completed. No panel has been selected.", StatusMessageType.Info);
}
public void SetPanelLocationOverlayChanged()
{
_panelSelectionManager.PanelCoordinates = DataStore.ActiveProfilePanelCoordinates.ToList();
_panelSelectionManager.ShowPanelLocationOverlay(_view.ShowPanelLocationOverlay);
}
public void StartPopOut()
{
if (WindowManager.GetApplicationProcess() == null)
return;
@ -177,10 +196,12 @@ namespace MSFSPopoutPanelManager.UIController
OnUIStateChanged?.Invoke(this, new EventArgs<PanelSelectionUIState>(PanelSelectionUIState.PopoutStarted));
Logger.Status("Panel pop out and separation in progress. Please wait......", StatusMessageType.Info);
WindowManager.CloseAllCustomPopoutPanels();
Thread.Sleep(1000); // allow time for the mouse to be stopped moving by the user
_panelSelectionManager.ShowPanelLocationOverlay(false);
ShowPanelLocationOverlay = false;
_view.ShowPanelLocationOverlay = false;
var simulatorProcess = WindowManager.GetSimulatorProcess();
if(simulatorProcess == null)
@ -190,91 +211,32 @@ namespace MSFSPopoutPanelManager.UIController
return;
}
PopoutSeparationManager popoutSeparationManager = new PopoutSeparationManager(simulatorProcess.Handle, ActiveUserPlaneProfile);
PopoutSeparationManager popoutSeparationManager = new PopoutSeparationManager(simulatorProcess.Handle, DataStore.ActiveUserProfile);
// Temporary make app go to background before pop out process
WindowManager.ApplyAlwaysOnTop(appForm.Handle, false, appForm.Bounds);
WindowManager.ApplyAlwaysOnTop(_view.Form.Handle, false, _view.Form.Bounds);
var result = popoutSeparationManager.StartPopout();
WindowManager.ApplyAlwaysOnTop(appForm.Handle, true, appForm.Bounds);
WindowManager.ApplyAlwaysOnTop(_view.Form.Handle, true, _view.Form.Bounds);
if (result)
{
PopOutCompleted();
PInvoke.SetForegroundWindow(appForm.Handle);
OnPopOutCompleted?.Invoke(this, null);
// Save data
FileManager.WriteUserProfileData(DataStore.UserProfiles.ToList());
PInvoke.SetForegroundWindow(_view.Form.Handle);
}
else
{
_panelSelectionManager.ShowPanelLocationOverlay(true);
ShowPanelLocationOverlay = true;
_view.ShowPanelLocationOverlay = true;
}
OnUIStateChanged?.Invoke(this, new EventArgs<PanelSelectionUIState>(PanelSelectionUIState.PanelSelectionCompletedValid));
}
private void LoadPlaneProfileList()
{
if (PlaneProfileList != null)
PlaneProfileList.Clear();
else
PlaneProfileList = new BindingList<UserProfileData>();
var dataList = FileManager.ReadUserProfileData().OrderBy(x => x.ProfileName);
foreach (var profile in dataList)
PlaneProfileList.Add(profile);
}
private void PanelSelectionManager_OnPanelSelectionStarted(object sender, EventArgs e)
{
PanelCoordinates.Clear();
OnUIStateChanged?.Invoke(this, new EventArgs<PanelSelectionUIState>(PanelSelectionUIState.PanelSelectionStarted));
if(_parentForm != null)
_parentForm.WindowState = FormWindowState.Minimized;
var simulatorProcess = WindowManager.GetSimulatorProcess();
if(simulatorProcess != null)
PInvoke.SetForegroundWindow(simulatorProcess.Handle);
}
private void PanelSelectionManager_OnPanelAdded(object sender, EventArgs<PanelSourceCoordinate> e)
{
PanelCoordinates.Add(e.Value);
}
private void PanelSelectionManager_OnPanelSubtracted(object sender, EventArgs e)
{
if (PanelCoordinates.Count > 0)
PanelCoordinates.RemoveAt(PanelCoordinates.Count - 1);
}
private void PanelSelectionManager_OnPanelSelectionCompleted(object sender, EventArgs e)
{
if (_parentForm != null)
_parentForm.WindowState = FormWindowState.Normal;
//if (PanelCoordinates.Count > 0)
//{
ActiveUserPlaneProfile.PanelSourceCoordinates = PanelCoordinates.ToList();
OnUIStateChanged?.Invoke(this, new EventArgs<PanelSelectionUIState>(PanelSelectionUIState.PanelSelectionCompletedValid));
//}
//else
// OnUIStateChanged?.Invoke(this, new EventArgs<PanelSelectionUIState>(PanelSelectionUIState.PanelSelectionCompletedInvalid));
ShowPanelLocationOverlay = true;
var simulatorProcess = WindowManager.GetSimulatorProcess();
if (simulatorProcess != null)
PInvoke.SetForegroundWindow(simulatorProcess.Handle);
}
private void HandleOnRestart(object sender, EventArgs e)
{
Initialize();
ProfileChanged(SelectedProfileId);
}
}
public enum PanelSelectionUIState

View file

@ -1,90 +0,0 @@

using MSFSPopoutPanelManager.Provider;
using MSFSPopoutPanelManager.Shared;
using System;
using System.Windows.Forms;
namespace MSFSPopoutPanelManager.UIController
{
public class StartUpController : BaseController
{
private const int MSFS_CONNECTION_CHECK_INTERVAL = 3000;
private Form _appForm;
private System.Timers.Timer _timer;
public StartUpController(Form form)
{
_appForm = form;
BaseController.OnPopOutCompleted += (source, e) => OnPanelConfigurationActivated?.Invoke(this, null);
BaseController.OnRestart += (source, e) => OnPanelSelectionActivated?.Invoke(this, null);
}
public event EventHandler<EventArgs<bool>> OnSimConnectionChanged;
public event EventHandler OnPanelSelectionActivated;
public event EventHandler OnPanelConfigurationActivated;
public bool IsMinimizeToTray { get; set; }
public bool IsAlwaysOnTop { get; set; }
public bool IsAutoStart { get; set; }
public bool UseAutoPanning { get; set; }
public void Initialize()
{
var appSettings = FileManager.ReadAppSettingData();
IsMinimizeToTray = appSettings.MinimizeToTray;
IsAlwaysOnTop = appSettings.AlwaysOnTop;
UseAutoPanning = appSettings.UseAutoPanning;
IsAutoStart = Autostart.CheckIsAutoStart();
OnPanelSelectionActivated?.Invoke(this, null);
CheckSimulatorStarted();
}
public void SetAutoStart(bool isSet)
{
if (isSet)
Autostart.Activate();
else
Autostart.Deactivate();
}
public void SetMinimizeToTray(bool isSet)
{
var appSettingData = FileManager.ReadAppSettingData();
appSettingData.MinimizeToTray = isSet;
FileManager.WriteAppSettingData(appSettingData);
}
public void SetAutoPanning(bool isSet)
{
var appSettingData = FileManager.ReadAppSettingData();
appSettingData.UseAutoPanning = isSet;
FileManager.WriteAppSettingData(appSettingData);
}
public void SetAlwaysOnTop(bool isSet)
{
var appSettingData = FileManager.ReadAppSettingData();
appSettingData.AlwaysOnTop = isSet;
FileManager.WriteAppSettingData(appSettingData);
WindowManager.ApplyAlwaysOnTop(_appForm.Handle, isSet, _appForm.Bounds);
}
private void CheckSimulatorStarted()
{
OnSimConnectionChanged?.Invoke(this, new EventArgs<bool>(false));
// Autoconnect to flight simulator
_timer = new System.Timers.Timer();
_timer.Interval = MSFS_CONNECTION_CHECK_INTERVAL;
_timer.Enabled = true;
_timer.Elapsed += (source, e) =>
{
var simulatorProcess = WindowManager.GetSimulatorProcess();
OnSimConnectionChanged?.Invoke(this, new EventArgs<bool>(simulatorProcess != null));
};
}
}
}

View file

@ -1,10 +1,20 @@
# Version History
<hr/>
## Version 3.1.0
* Updated UI to use menu bar to control most application settings.
* Added long awaited auto save feature. Application no longer requires user to manually save profile after each panel change. All panel adjustments are automatically save.
* Added panel lock feature to complement autosave feature. When panels are lock and are being moved or resize, their new location information will not get save. Also, for instrumentation pop out panels, when panels are locked, any accidental movement of the panels will return them to previously saved locations. For built-in panels such as ATC, VFR Map, etc, they can still be moved but their saved location will not get change.
* Added keyboard shortcuts for commonly used function. The buttons for -10px, -1px, +1px, and +10px now has keyboard shortcut of 'Ctrl -', 'Ctrl [', 'Ctrl ]', and 'Ctrl +' respectively.
* Added miminize all panels feature. This allows user to temporary see what is behind all open pop out panels. (This is an user requested feature with Github ticket #6).
* Various smaller bug fixes and usability enhancements.
## Version 3.0.1
* Added workaround for MSFS pop out panel adjustment bug so using the position data grid to adjust width and height will work as expected.
* Added workaround for MSFS pop out panel adjustment bug when using the position data grid to adjust width and height will work as expected.
- In MSFS, when changing height or width of a pop out panel (2nd time for same panel and onward), there is an MSFS bug that will unexpectedly shifted the panel by 8px to the left for each adjustment.
* Improved realtime feedback of panel's current coordiates as you move panels around or adjust the top, left, height and width of panel.
* Improved real-time feedback of panel's current coordinates as you move panels around or adjust top, left, height and width of panel.
* Fixed always on top issue when moving panel around for placement inside other overlay or bezel.
* Added support to create profile just to save locations of built-in panels only (VFR, ATC, etc).
* Added support to save locations for web panels from my other github project "MSFS Touch Panel".

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 MiB

After

Width:  |  Height:  |  Size: 7.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 MiB

After

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 MiB

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB