blob: 6540e12b1a62ff230b3696d3a8843a7606974240 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/*
* GNU AFFERO GENERAL PUBLIC LICENSE
* Version 3, 19 November 2007
* Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*/
using System.Collections.ObjectModel;
using System.Diagnostics;
using UVtools.WPF.Structures;
namespace UVtools.WPF
{
public partial class MainWindow
{
public ObservableCollection<LogItem> Logs { get; } = new ObservableCollection<LogItem>();
private bool _isVerbose;
public bool IsVerbose
{
get => _isVerbose;
set => RaiseAndSetIfChanged(ref _isVerbose, value);
}
public void AddLog(LogItem log)
{
log.Index = Logs.Count;
Logs.Insert(0, log);
}
public void AddLog(string description, double elapsedTime = 0) =>
AddLog(new LogItem(Logs.Count, description, elapsedTime));
public void AddLogVerbose(string description, double elapsedTime = 0)
{
Debug.WriteLine($"{description} ({elapsedTime}s)");
if (!_isVerbose) return;
AddLog(description, elapsedTime);
}
}
}
|