Skip to content

Commit df9fb9c

Browse files
committed
Revert "Code Quality: Added debug logs for Omnibar (#17231)"
This reverts commit bd2f5f1.
1 parent bd2f5f1 commit df9fb9c

File tree

7 files changed

+2
-54
lines changed

7 files changed

+2
-54
lines changed

src/Files.App.Controls/Files.App.Controls.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<Platforms>x86;x64;arm64</Platforms>
1111
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
1212
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
13-
<DefineConstants>$(DefineConstants);OMNIBAR_DEBUG</DefineConstants>
1413
</PropertyGroup>
1514

1615
<ItemGroup>

src/Files.App.Controls/Omnibar/Omnibar.Events.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ private void AutoSuggestBox_GettingFocus(UIElement sender, GettingFocusEventArgs
2121
if (args.OldFocusedElement is null)
2222
return;
2323

24-
GlobalHelper.WriteDebugStringForOmnibar("The TextBox is getting the focus.");
25-
2624
_previouslyFocusedElement = new(args.OldFocusedElement as UIElement);
2725
}
2826

@@ -38,8 +36,6 @@ private void AutoSuggestBox_LosingFocus(UIElement sender, LosingFocusEventArgs a
3836

3937
private void AutoSuggestBox_GotFocus(object sender, RoutedEventArgs e)
4038
{
41-
GlobalHelper.WriteDebugStringForOmnibar("The TextBox got the focus.");
42-
4339
IsFocused = true;
4440
_textBox.SelectAll();
4541
}
@@ -50,8 +46,6 @@ private void AutoSuggestBox_LostFocus(object sender, RoutedEventArgs e)
5046
if (_textBox.ContextFlyout.IsOpen)
5147
return;
5248

53-
GlobalHelper.WriteDebugStringForOmnibar("The TextBox lost the focus.");
54-
5549
IsFocused = false;
5650
}
5751

@@ -61,16 +55,12 @@ private async void AutoSuggestBox_KeyDown(object sender, KeyRoutedEventArgs e)
6155
{
6256
e.Handled = true;
6357

64-
GlobalHelper.WriteDebugStringForOmnibar("The TextBox accepted the Enter key.");
65-
6658
SubmitQuery(_textBoxSuggestionsPopup.IsOpen && _textBoxSuggestionsListView.SelectedIndex is not -1 ? _textBoxSuggestionsListView.SelectedItem : null);
6759
}
6860
else if ((e.Key == VirtualKey.Up || e.Key == VirtualKey.Down) && _textBoxSuggestionsPopup.IsOpen)
6961
{
7062
e.Handled = true;
7163

72-
GlobalHelper.WriteDebugStringForOmnibar("The TextBox accepted the Up/Down key while the suggestions pop-up is open.");
73-
7464
var currentIndex = _textBoxSuggestionsListView.SelectedIndex;
7565
var nextIndex = currentIndex;
7666
var suggestionsCount = _textBoxSuggestionsListView.Items.Count;
@@ -99,8 +89,6 @@ private async void AutoSuggestBox_KeyDown(object sender, KeyRoutedEventArgs e)
9989
{
10090
e.Handled = true;
10191

102-
GlobalHelper.WriteDebugStringForOmnibar("The TextBox accepted the Esc key.");
103-
10492
if (_textBoxSuggestionsPopup.IsOpen)
10593
{
10694
RevertTextToUserInput();
@@ -114,8 +102,6 @@ private async void AutoSuggestBox_KeyDown(object sender, KeyRoutedEventArgs e)
114102
}
115103
else if (e.Key == VirtualKey.Tab && !InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down))
116104
{
117-
GlobalHelper.WriteDebugStringForOmnibar("The TextBox accepted the Tab key.");
118-
119105
// Focus on inactive content when pressing Tab instead of moving to the next control in the tab order
120106
e.Handled = true;
121107
IsFocused = false;
@@ -150,7 +136,6 @@ private void AutoSuggestBox_TextChanged(object sender, TextChangedEventArgs e)
150136

151137
private void AutoSuggestBoxSuggestionsPopup_GettingFocus(UIElement sender, GettingFocusEventArgs args)
152138
{
153-
// The suggestions popup is never wanted to be focused when it come to open.
154139
args.TryCancel();
155140
}
156141

src/Files.App.Controls/Omnibar/Omnibar.Properties.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ partial void OnCurrentSelectedModePropertyChanged(DependencyPropertyChangedEvent
2727
if (e.NewValue is not OmnibarMode newMode)
2828
return;
2929

30-
if (e.OldValue is OmnibarMode oldMode)
31-
GlobalHelper.WriteDebugStringForOmnibar($"The mode change from {oldMode} to {newMode} has been requested.");
32-
else
33-
GlobalHelper.WriteDebugStringForOmnibar($"The mode change to {newMode} has been requested.");
34-
3530
ChangeMode(e.OldValue as OmnibarMode, newMode);
3631
CurrentSelectedModeName = newMode.Name;
3732
}
@@ -56,8 +51,6 @@ partial void OnIsFocusedChanged(bool newValue)
5651
if (CurrentSelectedMode is null || _textBox is null)
5752
return;
5853

59-
GlobalHelper.WriteDebugStringForOmnibar($"{nameof(IsFocused)} has been changed to {IsFocused}");
60-
6154
if (newValue)
6255
{
6356
VisualStateManager.GoToState(CurrentSelectedMode, "Focused", true);

src/Files.App.Controls/Omnibar/Omnibar.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ public Omnibar()
5151

5252
Modes = [];
5353
AutoSuggestBoxPadding = new(0, 0, 0, 0);
54-
55-
GlobalHelper.WriteDebugStringForOmnibar("Omnibar has been initialized.");
5654
}
5755

5856
// Methods
@@ -88,8 +86,6 @@ protected override void OnApplyTemplate()
8886

8987
// Set the default width
9088
_textBoxSuggestionsContainerBorder.Width = ActualWidth;
91-
92-
GlobalHelper.WriteDebugStringForOmnibar("The template and the events have been initialized.");
9389
}
9490

9591
public void PopulateModes()
@@ -199,8 +195,6 @@ protected void ChangeMode(OmnibarMode? oldMode, OmnibarMode newMode)
199195
mode.Transitions.Clear();
200196
mode.UpdateLayout();
201197
}
202-
203-
GlobalHelper.WriteDebugStringForOmnibar($"Successfully changed Mode from {oldMode} to {newMode}");
204198
}
205199

206200
internal protected void FocusTextBox()
@@ -216,16 +210,11 @@ internal protected bool TryToggleIsSuggestionsPopupOpen(bool wantToOpen)
216210
if (wantToOpen && (!IsFocused || CurrentSelectedMode?.ItemsSource is null || (CurrentSelectedMode?.ItemsSource is IList collection && collection.Count is 0)))
217211
{
218212
_textBoxSuggestionsPopup.IsOpen = false;
219-
220-
GlobalHelper.WriteDebugStringForOmnibar("The suggestions pop-up closed.");
221-
222213
return false;
223214
}
224215

225216
_textBoxSuggestionsPopup.IsOpen = wantToOpen;
226217

227-
GlobalHelper.WriteDebugStringForOmnibar("The suggestions pop-up is open.");
228-
229218
return false;
230219
}
231220

src/Files.App.Controls/Omnibar/OmnibarMode.Events.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ private void ModeButton_PointerEntered(object sender, PointerRoutedEventArgs e)
1212
if (_ownerRef is null || _ownerRef.TryGetTarget(out var owner) is false || owner.CurrentSelectedMode == this)
1313
return;
1414

15-
GlobalHelper.WriteDebugStringForOmnibar($"The mouse pointer has entered the UI area of this Mode ({this})");
16-
1715
VisualStateManager.GoToState(this, "PointerOver", true);
1816
}
1917

@@ -22,8 +20,6 @@ private void ModeButton_PointerPressed(object sender, PointerRoutedEventArgs e)
2220
if (_ownerRef is null || _ownerRef.TryGetTarget(out var owner) is false || owner.CurrentSelectedMode == this)
2321
return;
2422

25-
GlobalHelper.WriteDebugStringForOmnibar($"The mouse pointer has been pressed on the UI area of this Mode ({this})");
26-
2723
VisualStateManager.GoToState(this, "PointerPressed", true);
2824
}
2925

@@ -32,8 +28,6 @@ private void ModeButton_PointerReleased(object sender, PointerRoutedEventArgs e)
3228
if (_ownerRef is null || _ownerRef.TryGetTarget(out var owner) is false || owner.CurrentSelectedMode == this)
3329
return;
3430

35-
GlobalHelper.WriteDebugStringForOmnibar($"The mouse pointer has been unpressed from the UI area of this Mode ({this})");
36-
3731
VisualStateManager.GoToState(this, "PointerOver", true);
3832

3933
owner.IsModeButtonPressed = true;
@@ -44,8 +38,6 @@ private void ModeButton_PointerReleased(object sender, PointerRoutedEventArgs e)
4438

4539
private void ModeButton_PointerExited(object sender, PointerRoutedEventArgs e)
4640
{
47-
GlobalHelper.WriteDebugStringForOmnibar($"The mouse pointer has moved away from the UI area of this Mode ({this})");
48-
4941
VisualStateManager.GoToState(this, "PointerNormal", true);
5042
}
5143
}

src/Files.App.Controls/Omnibar/OmnibarMode.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ public partial class OmnibarMode : ItemsControl
2323
public OmnibarMode()
2424
{
2525
DefaultStyleKey = typeof(OmnibarMode);
26-
27-
GlobalHelper.WriteDebugStringForOmnibar($"Omnibar Mode ({this}) has been initialized.");
2826
}
2927

3028
// Methods
@@ -41,8 +39,6 @@ protected override void OnApplyTemplate()
4139
_modeButton.PointerPressed += ModeButton_PointerPressed;
4240
_modeButton.PointerReleased += ModeButton_PointerReleased;
4341
_modeButton.PointerExited += ModeButton_PointerExited;
44-
45-
GlobalHelper.WriteDebugStringForOmnibar($"The template and the events of the Omnibar Mode ({this}) have been initialized.");
4642
}
4743

4844
protected override void OnKeyUp(KeyRoutedEventArgs args)
@@ -92,7 +88,7 @@ public void SetOwner(Omnibar owner)
9288

9389
public override string ToString()
9490
{
95-
return Name ?? string.Empty;
91+
return ModeName ?? string.Empty;
9692
}
9793
}
9894
}

src/Files.App.Controls/GlobalHelper.cs renamed to src/Files.App.Controls/Util.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Files.App.Controls
55
{
6-
public static class GlobalHelper
6+
public static class Util
77
{
88
/// <summary>
99
/// Sets cursor when hovering on a specific element.
@@ -22,11 +22,5 @@ public static void ChangeCursor(this UIElement uiElement, InputCursor cursor)
2222
[cursor]
2323
);
2424
}
25-
26-
[Conditional("OMNIBAR_DEBUG")]
27-
public static void WriteDebugStringForOmnibar(string? message)
28-
{
29-
Debug.WriteLine($"OMNIBAR DEBUG: [{message}]");
30-
}
3125
}
3226
}

0 commit comments

Comments
 (0)