//
// MaaWpfGui - A part of the MaaCoreArknights project
// Copyright (C) 2021 MistEO and Contributors
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License v3.0 only as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY
//
using System;
using MaaWpfGui.Constants;
using MaaWpfGui.Helper;
using Stylet;
namespace MaaWpfGui.ViewModels
{
///
/// The view model of log item.
///
public class LogItemViewModel : PropertyChangedBase
{
///
/// Initializes a new instance of the class.
///
/// The content.
/// The font color.
/// The font weight.
/// The Date format string
public LogItemViewModel(string content, string color = UiLogColor.Message, string weight = "Regular", string dateFormat = "MM'-'dd' 'HH':'mm':'ss", bool showTime = true)
{
if (Instances.SettingsViewModel.UseLogItemDateFormat)
{
dateFormat = Instances.SettingsViewModel.LogItemDateFormatString;
}
Time = DateTime.Now.ToString(dateFormat);
Content = content;
Color = color;
Weight = weight;
ShowTime = showTime;
}
private string _time;
///
/// Gets or sets the time.
///
public string Time
{
get => _time;
set => SetAndNotify(ref _time, value);
}
private bool _showTime = true;
public bool ShowTime
{
get => _showTime;
set => SetAndNotify(ref _showTime, value);
}
private string _content;
///
/// Gets or sets the content.
///
public string Content
{
get => _content;
set => SetAndNotify(ref _content, value);
}
private string _color;
///
/// Gets or sets the font color.
///
public string Color
{
get => _color;
set => SetAndNotify(ref _color, value);
}
private string _weight;
///
/// Gets or sets the font weight.
///
public string Weight
{
get => _weight;
set => SetAndNotify(ref _weight, value);
}
}
}