Files
UnrealEngineUWP/Engine/Source/Programs/nDisplayLauncher/AppLog/AppLogger.cs
Jack Porter 2792c7c559 Merging //UE4/Dev-Main to Dev-Mobile (//UE4/Dev-Mobile)
#jira 0
#rb None

[CL 4161603 by Jack Porter in Dev-Mobile branch]
2018-06-26 08:42:47 -04:00

70 lines
1.3 KiB
C#

// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
using System;
using System.ComponentModel;
namespace nDisplayLauncher
{
public class AppLogger : INotifyPropertyChanged
{
private AppLogger()
{
}
//Implementation of INotifyPropertyChanged method for TwoWay binding
public event PropertyChangedEventHandler PropertyChanged;
protected void OnNotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
//Set property with OnNotifyPropertyChanged call
protected void Set<T>(ref T field, T newValue, string propertyName)
{
field = newValue;
OnNotifyPropertyChanged(propertyName);
}
private static AppLogger _Instance;
public static AppLogger Instance
{
get
{
if (_Instance == null)
{
_Instance = new AppLogger();
}
return _Instance;
}
}
private string _Log;
public string Log
{
get
{
if (_Log == null)
{
_Log = string.Empty;
}
return _Log;
}
set { Set(ref _Log, value, "Log"); }
}
public static void CleanLog()
{
Instance.Log = DateTime.Now.ToString() + System.Environment.NewLine;
}
public static void Add(string text)
{
Instance.Log = Instance.Log + DateTime.Now.ToString() + ": " + text + System.Environment.NewLine;
}
}
}