Skip to content

Commit 4065974

Browse files
committed
update: start/stop Visualization server
1 parent 7cbd20e commit 4065974

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

source/RevitDevTool/Application.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ public override void OnStartup()
1212
ExternalEventController.Register();
1313
AddButton(Application);
1414
AddDockable(Application);
15-
VisualizationServerController.Start();
1615
}
1716

1817
public override void OnShutdown()
1918
{
20-
VisualizationServerController.Stop();
19+
VisualizationController.Stop();
2120
}
2221

2322
private static void AddDockable(UIControlledApplication application)

source/RevitDevTool/ViewModel/TraceLogViewModel.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace RevitDevTool.ViewModel;
1212

13-
public partial class TraceLogViewModel : ObservableObject, IDisposable
13+
internal partial class TraceLogViewModel : ObservableObject, IDisposable
1414
{
1515
public RichTextBox LogTextBox { get; }
1616

@@ -19,14 +19,14 @@ public partial class TraceLogViewModel : ObservableObject, IDisposable
1919
private readonly ConsoleRedirector _consoleRedirector;
2020

2121
[ObservableProperty] private bool _isStarted = true;
22-
[ObservableProperty] private LogEventLevel _logLevel = LogEventLevel.Debug;
22+
[ObservableProperty] private LogEventLevel _logLevel = LogEventLevel.Information;
2323

2424
partial void OnLogLevelChanging(LogEventLevel value)
2525
{
2626
_levelSwitch.MinimumLevel = value;
2727
}
2828

29-
partial void OnIsStartedChanged(bool value)
29+
partial void OnIsStartedChanging(bool value)
3030
{
3131
TraceStatus(value);
3232
}
@@ -37,11 +37,13 @@ private void TraceStatus(bool isStarted)
3737
{
3838
Trace.Listeners.Add(_traceListener);
3939
Trace.Listeners.Add(TraceGeometry.TraceListener);
40+
VisualizationController.Start();
4041
}
4142
else
4243
{
4344
Trace.Listeners.Remove(_traceListener);
4445
Trace.Listeners.Remove(TraceGeometry.TraceListener);
46+
VisualizationController.Stop();
4547
}
4648
}
4749

@@ -54,7 +56,8 @@ public TraceLogViewModel()
5456
VerticalContentAlignment = VerticalAlignment.Top,
5557
IsReadOnly = true,
5658
};
57-
59+
60+
PresentationTraceSources.ResourceDictionarySource.Switch.Level = SourceLevels.Critical;
5861
_levelSwitch = new LoggingLevelSwitch(_logLevel);
5962

6063
var logger = new LoggerConfiguration()
@@ -74,7 +77,7 @@ [RelayCommand] private void Clear()
7477

7578
[RelayCommand] private static void ClearGeometry()
7679
{
77-
VisualizationServerController.Clear();
80+
VisualizationController.Clear();
7881
}
7982

8083
public void Dispose()

0 commit comments

Comments
 (0)