Messages and Errors display is supported, transition messages are displayed now

This commit is contained in:
Milan Hanajik
2015-01-12 04:53:50 +01:00
parent 222887f97d
commit 0829655880
6 changed files with 1612 additions and 1549 deletions
@@ -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;
}
}
}
+14 -2
View File
@@ -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>