Debugger symbol for ConsoleApp
This commit is contained in:
@@ -25,5 +25,6 @@ public interface IRootViewModel
|
|||||||
IItemPreviewService ItemPreviewService { get; }
|
IItemPreviewService ItemPreviewService { get; }
|
||||||
IClipboardService ClipboardService { get; }
|
IClipboardService ClipboardService { get; }
|
||||||
IAdminElevationManager AdminElevationManager { get; }
|
IAdminElevationManager AdminElevationManager { get; }
|
||||||
|
IDeclarativeProperty<bool> IsDebuggerAttached { get; }
|
||||||
event Action<IInputElement>? FocusReadInputElement;
|
event Action<IInputElement>? FocusReadInputElement;
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Globalization;
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
using FileTime.App.Core.Models.Enums;
|
using FileTime.App.Core.Models.Enums;
|
||||||
using FileTime.App.Core.ViewModels;
|
using FileTime.App.Core.ViewModels;
|
||||||
using FileTime.ConsoleUI.App.Configuration;
|
using FileTime.ConsoleUI.App.Configuration;
|
||||||
@@ -172,6 +173,15 @@ public class MainWindow
|
|||||||
}.Setup(t => t.Bind(
|
}.Setup(t => t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc!.ClipboardService.Content.Count > 1,
|
dc => dc!.ClipboardService.Content.Count > 1,
|
||||||
|
tb => tb.IsVisible)),
|
||||||
|
new TextBlock<IRootViewModel>
|
||||||
|
{
|
||||||
|
Text = /*_consoleApplicationConfiguration.Value.ClipboardMultipleIcon ??*/
|
||||||
|
(_consoleApplicationConfiguration.Value.DisableUtf8 ? "DB " : "\udb80\udce4"),
|
||||||
|
AsciiOnly = false
|
||||||
|
}.Setup(t => t.Bind(
|
||||||
|
t,
|
||||||
|
dc => dc.IsDebuggerAttached.Value,
|
||||||
tb => tb.IsVisible))
|
tb => tb.IsVisible))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using DeclarativeProperty;
|
using System.Diagnostics;
|
||||||
|
using DeclarativeProperty;
|
||||||
using FileTime.App.CommandPalette.ViewModels;
|
using FileTime.App.CommandPalette.ViewModels;
|
||||||
using FileTime.App.Core.Services;
|
using FileTime.App.Core.Services;
|
||||||
using FileTime.App.Core.ViewModels;
|
using FileTime.App.Core.ViewModels;
|
||||||
@@ -8,11 +9,13 @@ using FileTime.ConsoleUI.App.Services;
|
|||||||
using FileTime.Core.Interactions;
|
using FileTime.Core.Interactions;
|
||||||
using FileTime.Core.Models;
|
using FileTime.Core.Models;
|
||||||
using FileTime.Providers.LocalAdmin;
|
using FileTime.Providers.LocalAdmin;
|
||||||
|
using TerminalUI.Traits;
|
||||||
|
|
||||||
namespace FileTime.ConsoleUI.App;
|
namespace FileTime.ConsoleUI.App;
|
||||||
|
|
||||||
public partial class RootViewModel : IRootViewModel
|
public partial class RootViewModel : IRootViewModel, IBeforeRender
|
||||||
{
|
{
|
||||||
|
private readonly DeclarativeProperty<bool> _isDebuggerAttached = new(Debugger.IsAttached);
|
||||||
public string UserName => Environment.UserName;
|
public string UserName => Environment.UserName;
|
||||||
public string MachineName => Environment.MachineName;
|
public string MachineName => Environment.MachineName;
|
||||||
public IPossibleCommandsViewModel PossibleCommands { get; }
|
public IPossibleCommandsViewModel PossibleCommands { get; }
|
||||||
@@ -25,6 +28,7 @@ public partial class RootViewModel : IRootViewModel
|
|||||||
public IDialogService DialogService { get; }
|
public IDialogService DialogService { get; }
|
||||||
public ITimelineViewModel TimelineViewModel { get; }
|
public ITimelineViewModel TimelineViewModel { get; }
|
||||||
public IDeclarativeProperty<VolumeSizeInfo?> VolumeSizeInfo { get; }
|
public IDeclarativeProperty<VolumeSizeInfo?> VolumeSizeInfo { get; }
|
||||||
|
public IDeclarativeProperty<bool> IsDebuggerAttached => _isDebuggerAttached;
|
||||||
|
|
||||||
public event Action<IInputElement>? FocusReadInputElement;
|
public event Action<IInputElement>? FocusReadInputElement;
|
||||||
|
|
||||||
@@ -73,4 +77,6 @@ public partial class RootViewModel : IRootViewModel
|
|||||||
.Switch()
|
.Switch()
|
||||||
.Map(async l => l is null ? null : await l.Provider.GetVolumeSizeInfoAsync(l.FullName!));
|
.Map(async l => l is null ? null : await l.Provider.GetVolumeSizeInfoAsync(l.FullName!));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void BeforeRender() => _isDebuggerAttached.SetValue(Debugger.IsAttached);
|
||||||
}
|
}
|
||||||
@@ -209,6 +209,10 @@ public class RenderEngine : IRenderEngine
|
|||||||
{
|
{
|
||||||
view.Attached = true;
|
view.Attached = true;
|
||||||
view.GetRequestedSize();
|
view.GetRequestedSize();
|
||||||
|
if (view.DataContext is IBeforeRender beforeRenderHandler)
|
||||||
|
{
|
||||||
|
beforeRenderHandler.BeforeRender();
|
||||||
|
}
|
||||||
view.Render(renderContext, position, size);
|
view.Render(renderContext, position, size);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
6
src/Library/TerminalUI/Traits/IBeforeRender.cs
Normal file
6
src/Library/TerminalUI/Traits/IBeforeRender.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace TerminalUI.Traits;
|
||||||
|
|
||||||
|
public interface IBeforeRender
|
||||||
|
{
|
||||||
|
void BeforeRender();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user