Skip to content

Commit

Permalink
Add setting to force display of overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanabaker committed Nov 11, 2023
1 parent d1438f3 commit df0b617
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion F1T Installer/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<!--https://wixtoolset.org/documentation/manual/v3/howtos/files_and_registry/create_start_menu_shortcut.html-->
<!--https://stackoverflow.com/questions/11868499/create-shortcut-to-desktop-using-wix-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="F1T_Installer" Language="1033" Version="23.0.0.0" Manufacturer="F1T" UpgradeCode="a46a6d50-c65d-4477-b347-e56bf3a90b49">
<Product Id="*" Name="F1T_Installer" Language="1033" Version="23.0.1.0" Manufacturer="F1T" UpgradeCode="a46a6d50-c65d-4477-b347-e56bf3a90b49">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
Expand Down
7 changes: 6 additions & 1 deletion F1T/Core/FocusMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public class FocusMonitor
// Prevent from being garbage collected
private Timer timer;

private SettingsViewModel settings;

/// <summary>
/// Statically set FocusMonitors ViewModel and OverlayWindow instances
/// </summary>
Expand All @@ -44,7 +46,7 @@ public static void SetModelsAndViews(Dictionary<BaseModuleViewModel, Window> Vie
/// Initializes a new instance of <see cref="FocusMonitor"/> with the ViewModels and UserControls we might want to display
/// </summary>
/// <param name="ViewModelAndOverlayUserControl"></param>
public FocusMonitor(Dictionary<BaseModuleViewModel, UserControl> ViewModelAndOverlayUserControl)
public FocusMonitor(Dictionary<BaseModuleViewModel, UserControl> ViewModelAndOverlayUserControl, SettingsViewModel SettingsModel)
{
// We are taking our ViewModels and UserControls
// And assigning all the UserControls to a "OverlayWindow"
Expand All @@ -64,6 +66,8 @@ public FocusMonitor(Dictionary<BaseModuleViewModel, UserControl> ViewModelAndOve
// TIMER BASED
// Check to see if a Window of interest is open on a timer
timer = new Timer(CheckActiveWindow, null, 0, 1000);

settings = SettingsModel;
}

/// <summary>
Expand Down Expand Up @@ -190,6 +194,7 @@ private void HideOverlays()
/// <returns></returns>
private bool IsF1Focussed(string currWindowName)
{
if (settings.Settings.ForceDisplayOverlay) return true;
if (currWindowName == null) return false;
return (currWindowName.StartsWith("F1 2021") || currWindowName.StartsWith("F1_2021") || currWindowName.StartsWith("F1T") || currWindowName.StartsWith("F1 22") || currWindowName.StartsWith("F1_22") || currWindowName.StartsWith("F1 23") || currWindowName.StartsWith("F1_23"));
}
Expand Down
2 changes: 1 addition & 1 deletion F1T/MVVM/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private MainViewModel()

// INIT Static Classes
// Create FocusMonitor to monitor application for when to display overlays
FocusMonitor FocusMonitor = new FocusMonitor(ViewModelAndOverlayView);
FocusMonitor FocusMonitor = new FocusMonitor(ViewModelAndOverlayView, SettingsModel);
// Create and start UDP Connection to game on port 21777
UDPConnection UDPConnection = UDPConnection.GetInstance();
}
Expand Down
3 changes: 3 additions & 0 deletions F1T/MVVM/Views/Settings/SettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
FontSize="11"
HorizontalAlignment="Center"
Background="Transparent"></Label>

<themes:SettingLabel LabelContent="ALWAYS DISPLAY OVERLAY" TooltipContent="Will force the overlay to always be displayed"></themes:SettingLabel>
<themes:ToggleButton Toggled="{Binding Settings.ForceDisplayOverlay, Mode=TwoWay}"></themes:ToggleButton>
</StackPanel>

</UserControl>
2 changes: 1 addition & 1 deletion F1T/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<Grid HorizontalAlignment="Stretch">
<Label Grid.Row="0" Grid.Column="0"
VerticalAlignment="Center" HorizontalAlignment="Left"
Content="F1T V23.0.0" Foreground="DarkGray" FontSize="12" FontFamily="/Fonts/#Poppins"
Content="F1T V23.0.1" Foreground="DarkGray" FontSize="12" FontFamily="/Fonts/#Poppins"
Margin="10,0,0,0"></Label>

<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Margin="0,3,0,0">
Expand Down
8 changes: 8 additions & 0 deletions F1T/Settings/SettingsSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public SettingsSettings() : base()
SaveFinalClassification = false;
FinalClassificationSaveLocation = FilesPath;
MotionDataSaveLocation = FilesPath;
ForceDisplayOverlay = false;
}


Expand Down Expand Up @@ -48,5 +49,12 @@ public string MotionDataSaveLocation
set { SetField(ref _motionDataSaveLocation, value, "MotionDataSaveLocation"); }
}

private bool _forceDisplayOverlay;
public bool ForceDisplayOverlay
{
get { return _forceDisplayOverlay; }
set { SetField(ref _forceDisplayOverlay, value, "ForceDisplayOverlay"); }
}

}
}

0 comments on commit df0b617

Please sign in to comment.