Messages and Errors display is supported, transition messages are displayed now
This commit is contained in:
@@ -4,11 +4,19 @@ namespace TBF.UiBridge
|
||||
{
|
||||
public class ActivityEventArgs : EventArgs
|
||||
{
|
||||
public string Activity;
|
||||
public enum Update { All, Activity, Message };
|
||||
|
||||
public ActivityEventArgs(string activity)
|
||||
public Update Cmd; /// specifies what should be updated, makes it possible to update just one field
|
||||
public string Activity; /// activity text
|
||||
public string Message; /// message text
|
||||
public bool ErrorMsg; /// true = use red color to print the message
|
||||
|
||||
public ActivityEventArgs(Update cmd, string activity, string message, bool errorMsg)
|
||||
{
|
||||
Activity = activity;
|
||||
this.Cmd = cmd;
|
||||
this.Activity = activity;
|
||||
this.Message = message;
|
||||
this.ErrorMsg = errorMsg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,10 +156,22 @@ namespace TBF.UiBridge
|
||||
public static void OnActivity(object sender, string activity)
|
||||
{
|
||||
if (ActivityHandler == null) return;
|
||||
try { ActivityHandler(sender, new ActivityEventArgs(activity)); }
|
||||
try { ActivityHandler(sender, new ActivityEventArgs(ActivityEventArgs.Update.Activity, activity, null, false)); }
|
||||
catch (Exception e) { log.Error("ActivityHandler(...) failed", e); }
|
||||
}
|
||||
public static event EventHandler<ActivityEventArgs> ActivityHandler;
|
||||
public static void OnMessage(object sender, string message)
|
||||
{
|
||||
if (ActivityHandler == null) return;
|
||||
try { ActivityHandler(sender, new ActivityEventArgs(ActivityEventArgs.Update.Message, null, message, false)); }
|
||||
catch (Exception e) { log.Error("ActivityHandler(...) failed", e); }
|
||||
}
|
||||
public static void OnError(object sender, string message)
|
||||
{
|
||||
if (ActivityHandler == null) return;
|
||||
try { ActivityHandler(sender, new ActivityEventArgs(ActivityEventArgs.Update.Message, null, message, true)); }
|
||||
catch (Exception e) { log.Error("ActivityHandler(...) failed", e); }
|
||||
}
|
||||
public static event EventHandler<ActivityEventArgs> ActivityHandler;
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user