Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 64 additions & 3 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -847,18 +847,79 @@

<!-- Debug Mode Indicator -->
<Border Grid.Row="0"
Margin="0,0,0,0"
Margin="0,4,0,0"
Background="#CC0000"
CornerRadius="4"
Padding="10,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Visibility="{Binding DebugModeVisibility}">
RenderTransformOrigin="1,0">
<Border.RenderTransform>
<ScaleTransform ScaleX="1" ScaleY="1"/>
</Border.RenderTransform>
<Border.Style>
<Style TargetType="Border">
<Setter Property="Opacity" Value="0"/>
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding DebugModeActive}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.2">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" From="0.9" Duration="0:0:0.2">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" From="0.9" Duration="0:0:0.2">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.15">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseIn"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="0.9" Duration="0:0:0.15">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseIn"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="0.9" Duration="0:0:0.15">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseIn"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0.15" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<StackPanel Orientation="Horizontal">
<TextBlock Text="⚠"
FontSize="14"
Foreground="White"
Margin="0,0,8,0"
Margin="0,-2,8,0"
VerticalAlignment="Center"/>
<TextBlock Text="{Binding DebugModeText}"
FontWeight="Bold"
Expand Down
28 changes: 22 additions & 6 deletions Presentation/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class MainWindowViewModel : INotifyPropertyChanged
private bool _debugModeActive;
private int _debugStateId;
private string? _debugPointId;
private string _debugModeTextCache = string.Empty;
private int _selectedSimulatorIndex; // 0 = MSFS 2020, 1 = MSFS 2024
private string? _msfsNeedsRestartSim;

Expand Down Expand Up @@ -118,7 +119,7 @@ public bool OnGround

public string OnGroundText => OnGround ? "On Ground" : "Airborne";
public string SimulatorName { get => _simulatorName; set { if (value != _simulatorName) { _simulatorName = value; OnPropertyChanged(); } } }
public bool SimulatorConnected { get => _simConnected; set { if (value != _simConnected) { _simConnected = value; if (!value) _msfsNeedsRestartSim = null; OnPropertyChanged(); OnPropertyChanged(nameof(SimulatorConnectionText)); OnPropertyChanged(nameof(SimulatorStatusColor)); OnPropertyChanged(nameof(MsfsNeedsRestartVisibility)); OnPropertyChanged(nameof(MsfsNeedsRestartText)); } } }
public bool SimulatorConnected { get => _simConnected; set { if (value != _simConnected) { _simConnected = value; if (!value) { _msfsNeedsRestartSim = null; if (_debugModeActive) DebugModeActive = false; } OnPropertyChanged(); OnPropertyChanged(nameof(SimulatorConnectionText)); OnPropertyChanged(nameof(SimulatorStatusColor)); OnPropertyChanged(nameof(MsfsNeedsRestartVisibility)); OnPropertyChanged(nameof(MsfsNeedsRestartText)); } } }
public string SimulatorConnectionText => SimulatorConnected ? "Connected" : "Disconnected";
public string SimulatorStatusColor => SimulatorConnected ? "LimeGreen" : "Gray";
public bool ServerConnected
Expand Down Expand Up @@ -164,7 +165,14 @@ private set
{
_debugModeActive = value;
OnPropertyChanged();
OnPropertyChanged(nameof(DebugModeText));

if (value)
{
// Immediately update text when turning on
UpdateDebugModeText();
}
// Text clears on next enable, not on disable (prevents text vanishing mid-animation)

OnPropertyChanged(nameof(DebugModeVisibility));
}
}
Expand All @@ -182,17 +190,24 @@ private set
{
_debugStateId = value;
OnPropertyChanged();
OnPropertyChanged(nameof(DebugModeText));
UpdateDebugModeText();
}
}
}

/// <summary>
/// Text to display when debug mode is active.
/// </summary>
public string DebugModeText => _debugModeActive
? $"DEBUG MODE - State: {_debugStateId} (Press Ctrl+Shift+D to disable)"
: string.Empty;
public string DebugModeText => _debugModeTextCache;

private void UpdateDebugModeText()
{
// Only update when active to prevent text flash during fade-out
if (!_debugModeActive) return;

_debugModeTextCache = $"Debug Mode — State: {_debugStateId}";
OnPropertyChanged(nameof(DebugModeText));
}

/// <summary>
/// Visibility of the debug mode indicator.
Expand Down Expand Up @@ -932,6 +947,7 @@ private static string NormalizeDisconnectDetail(string? reason)
/// </summary>
public void ToggleDebugMode()
{
if (!SimulatorConnected) return;
_pointController?.ToggleDebugMode();
}

Expand Down