You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.1 KiB

using Microsoft.Practices.Prism.Events;
using Microsoft.Practices.Prism.PubSubEvents;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GummingCommon
{
public class NotifyEventParameter
{
public CallbackType NotifyType { get; set; }
public object NotifyContent { get; set; }
}
public class NotifyChangedEvent : CompositePresentationEvent<NotifyEventParameter>
{
}
public class CaptureEventParameter
{
public CaptureType NotifyType { get; set; }
public object NotifyContent { get; set; }
}
public class CaptureChangedEvent : CompositePresentationEvent<CaptureEventParameter>
{
}
public class AppEventAggregator
{
private static EventAggregator appEventAggregator = null;
private static readonly object syncLock = new object();
private AppEventAggregator() { }
public static EventAggregator GetEventAggregator()
{
lock (syncLock)
{
if (appEventAggregator == null)
{
appEventAggregator = new EventAggregator();
}
return appEventAggregator;
}
}
public static void SendMessage(CallbackType calltype, object content)
{
AppEventAggregator.GetEventAggregator().GetEvent<NotifyChangedEvent>().Publish(new NotifyEventParameter() { NotifyType = calltype, NotifyContent = content });
}
}
public class KeyEventParameter
{
public KeyType KeyType { get; set; }
public FromType FromType { get; set; }
public object KeyContent { get; set; }
}
public class KeyChangedEvent : CompositePresentationEvent<KeyEventParameter>
{
}
public class FormulaChangedEvent : CompositePresentationEvent<NotifyEventParameter>
{
}
public class EtherCATChangedEvent : CompositePresentationEvent<NotifyEventParameter>
{
}
public class RobotChangedEvent : CompositePresentationEvent<NotifyEventParameter>
{
}
}