mirror of
https://github.com/SabreTools/MPF.git
synced 2026-02-04 05:35:52 +00:00
* Progress report updates log * Logging additions * Minor update * Set halfway point only if nothing can be found * Better population metrics * QOL improvements * More tiny logging updates * Autoscroll * Be consistent * Update packages, use submodules * Use NuGet * Not 100% sure why I did it that way... * Update README.md * Make copy protect scan prompt an option * Enhanced-CD might be Win/Mac * Add unconfirmed formats * Enhance!
107 lines
2.8 KiB
C#
107 lines
2.8 KiB
C#
using System;
|
|
using System.Windows.Media;
|
|
|
|
namespace DICUI.UI
|
|
{
|
|
public class OptionsViewModel
|
|
{
|
|
private Options _options;
|
|
|
|
public OptionsViewModel(Options options)
|
|
{
|
|
this._options = options;
|
|
}
|
|
|
|
public bool QuietMode
|
|
{
|
|
get { return _options.QuietMode; }
|
|
set { _options.QuietMode = value; }
|
|
}
|
|
|
|
public bool ParanoidMode
|
|
{
|
|
get { return _options.ParanoidMode; }
|
|
set { _options.ParanoidMode = value; }
|
|
}
|
|
|
|
public bool ScanForProtection
|
|
{
|
|
get { return _options.ScanForProtection; }
|
|
set { _options.ScanForProtection = value; }
|
|
}
|
|
|
|
public bool SkipMediaTypeDetection
|
|
{
|
|
get { return _options.SkipMediaTypeDetection; }
|
|
set { _options.SkipMediaTypeDetection = value; }
|
|
}
|
|
|
|
public string RereadAmountForC2
|
|
{
|
|
get { return Convert.ToString(_options.RereadAmountForC2); }
|
|
set
|
|
{
|
|
if (Int32.TryParse(value, out int result))
|
|
_options.RereadAmountForC2 = result;
|
|
}
|
|
}
|
|
|
|
public bool VerboseLogging
|
|
{
|
|
get { return _options.VerboseLogging; }
|
|
set
|
|
{
|
|
_options.VerboseLogging = value;
|
|
_options.Save();
|
|
}
|
|
}
|
|
|
|
public bool OpenLogWindowAtStartup
|
|
{
|
|
get { return _options.OpenLogWindowAtStartup; }
|
|
set
|
|
{
|
|
_options.OpenLogWindowAtStartup = value;
|
|
_options.Save();
|
|
}
|
|
}
|
|
}
|
|
|
|
public class LoggerViewModel
|
|
{
|
|
private LogWindow _logWindow;
|
|
|
|
public void SetWindow(LogWindow logWindow) => _logWindow = logWindow;
|
|
|
|
public bool WindowVisible
|
|
{
|
|
get => _logWindow != null ? _logWindow.IsVisible : false;
|
|
set
|
|
{
|
|
if (value)
|
|
{
|
|
_logWindow.AdjustPositionToMainWindow();
|
|
_logWindow.Show();
|
|
}
|
|
else
|
|
_logWindow.Hide();
|
|
}
|
|
}
|
|
|
|
public void VerboseLog(string text)
|
|
{
|
|
if (ViewModels.OptionsViewModel.VerboseLogging)
|
|
_logWindow.AppendToTextBox(text, Brushes.Yellow);
|
|
}
|
|
|
|
public void VerboseLog(string format, params object[] args) => VerboseLog(string.Format(format, args));
|
|
public void VerboseLogLn(string format, params object[] args) => VerboseLog(string.Format(format, args) + "\n");
|
|
}
|
|
|
|
public static class ViewModels
|
|
{
|
|
public static OptionsViewModel OptionsViewModel { get; set; }
|
|
public static LoggerViewModel LoggerViewModel { get; set; } = new LoggerViewModel();
|
|
}
|
|
}
|