private void Init() { NoticeDelegate = new NoticeEventHandler(OnNotice); NotificationDelegate = new NotificationEventHandler(OnNotification); promotable = new NpgsqlPromotableSinglePhaseNotification(this); }
private void HandleIncoming(UdpClient UdpClient, IPEndPoint RemoteIP, UPnPHeaders Headers) { switch (Headers.Verb) { case "M-SEARCH": NotificationEventHandler h = this.OnSearch; if (!(h is null)) { try { h(this, new NotificationEventArgs(this, Headers, (IPEndPoint)UdpClient.Client.LocalEndPoint, RemoteIP)); } catch (Exception ex) { this.RaiseOnError(ex); } } break; case "NOTIFY": h = this.OnNotification; if (!(h is null)) { try { h(this, new NotificationEventArgs(this, Headers, (IPEndPoint)UdpClient.Client.LocalEndPoint, RemoteIP)); } catch (Exception ex) { this.RaiseOnError(ex); } } break; } }
/// <summary> /// Initializes a new instance of the /// <see cref="Npgsql.NpgsqlConnection">NpgsqlConnection</see> class /// and sets the <see cref="Npgsql.NpgsqlConnection.ConnectionString">ConnectionString</see>. /// </summary> /// <param name="ConnectionString">The connection used to open the PostgreSQL database.</param> public NpgsqlConnection(String ConnectionString) { NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, CLASSNAME, "NpgsqlConnection()"); NpgsqlConnectionStringBuilder builder = cache[ConnectionString]; if (builder == null) { settings = new NpgsqlConnectionStringBuilder(ConnectionString); } else { settings = builder.Clone(); } LogConnectionString(); NoticeDelegate = new NoticeEventHandler(OnNotice); NotificationDelegate = new NotificationEventHandler(OnNotification); ProvideClientCertificatesCallbackDelegate = new ProvideClientCertificatesCallback(DefaultProvideClientCertificatesCallback); // Fix authentication problems. See https://bugzilla.novell.com/show_bug.cgi?id=MONO77559 and // http://pgfoundry.org/forum/message.php?msg_id=1002377 for more info. RSACryptoServiceProvider.UseMachineKeyStore = true; promotable = new NpgsqlPromotableSinglePhaseNotification(this); }
public SubscriptionDlg() { InitializeComponent(); m_SessionNotification = new NotificationEventHandler(Session_Notification); m_SubscriptionStateChanged = new SubscriptionStateChangedEventHandler(Subscription_StateChanged); m_PublishStatusChanged = new EventHandler(Subscription_PublishStatusChanged); }
public DxfSectionReaderBase( IDxfStreamReader reader, DxfDocumentBuilder builder, NotificationEventHandler notification = null) { this._reader = reader; this._builder = builder; this._notification = notification; }
protected virtual void OnNotificationEvent(Event e) { NotificationEventHandler handler = NotificationEvent; if (handler != null) { handler(this, e); } }
public void Alarm() { NotificationEventHandler handeler = userevent; if (userevent != null) { handeler(this, new NotifyEventArgs("Welcome to the team")); } }
public void OnNotificationEvent(UnconfirmedEventNotification notification) { NotificationEventHandler handler = NotificationEvent; if (handler != null) { handler(notification); } }
public void SetupNotification(string tableName, NotificationEventHandler changeEventHandler) { Interlocked.Increment(ref _NotificationCount); bool success = SetupNotification(2, tableName, changeEventHandler); if (!success) { _Logger?.LogError(string.Format("Failed initial notification setup with dbnotify service.\nNotificationServerList: {0} \nTableName: {1}", string.Join(", ", _NotificationServers), tableName)); } }
/// <summary> /// Initializes the object with default values. /// </summary> public NotificationMessageListCtrl() { MaxMessageCount = 10; InitializeComponent(); SetColumns(m_ColumnNames); ItemsLV.Sorting = SortOrder.Descending; m_SessionNotification = new NotificationEventHandler(Session_Notification); }
/// <summary> /// Read a dxf document in a stream /// </summary> /// <param name="stream"></param> /// <param name="notification">Notification handler, sends any message or notification about the reading process.</param> /// <returns></returns> public static CadDocument Read(Stream stream, NotificationEventHandler notification = null) { CadDocument doc = null; using (DxfReader reader = new DxfReader(stream, notification)) { doc = reader.Read(); } return(doc); }
/// <summary> /// Initializes a new instance of the /// <see cref="Npgsql.NpgsqlConnection">NpgsqlConnection</see> class /// and sets the <see cref="Npgsql.NpgsqlConnection.ConnectionString">ConnectionString</see>. /// </summary> /// <param name="ConnectionString">The connection used to open the PostgreSQL database.</param> public NpgsqlConnection(String ConnectionString) { NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, CLASSNAME, "NpgsqlConnection()"); connection_string = NpgsqlConnectionString.ParseConnectionString(ConnectionString); LogConnectionString(); NoticeDelegate = new NoticeEventHandler(OnNotice); NotificationDelegate = new NotificationEventHandler(OnNotification); CertificateValidationCallbackDelegate = new CertificateValidationCallback(DefaultCertificateValidationCallback); CertificateSelectionCallbackDelegate = new CertificateSelectionCallback(DefaultCertificateSelectionCallback); PrivateKeySelectionCallbackDelegate = new PrivateKeySelectionCallback(DefaultPrivateKeySelectionCallback); }
public PrototypeDevice() { DcClient = new DeviceHive.HttpClient(Resources.GetString(Resources.StringResources.CloudUrl), DateTime.MinValue, RequestTimeout); Initializing += new ConnectEventHandler(PreInit); Connecting += new ConnectEventHandler(PreConnect); Connected += new ConnectEventHandler(PostConnect); BeforeCommand += new CommandEventHandler(PreProcessCommand); AfterCommand += new CommandEventHandler(PostProcessCommand); BeforeNotification += new NotificationEventHandler(PreProcessNotification); AfterNotification += new NotificationEventHandler(PostProcessNotification); Disconnected += new SimpleEventHandler(OnDisconnect); LastTemp = 0.0f; }
public static string GetKey(string table, NotificationEventHandler eventHandler) { string result; if (eventHandler == null) { result = string.Concat(table); } else { result = string.Concat(table, "|", eventHandler.Method.DeclaringType.AssemblyQualifiedName); } return(result); }
/// <summary> /// Starts the specified session. /// </summary> /// <param name="session">The session.</param> public void Start(Session session) { m_NotificationEventHandler = new NotificationEventHandler(Session_Notification); session.Notification += m_NotificationEventHandler; Subscription subscription = m_subscription = new Subscription(); subscription.PublishingInterval = m_samplingRate; subscription.KeepAliveCount = 10; subscription.LifetimeCount = 100; subscription.MaxNotificationsPerPublish = 50000; subscription.PublishingEnabled = false; subscription.TimestampsToReturn = TimestampsToReturn.Neither; subscription.Priority = 1; subscription.DisableMonitoredItemCache = true; session.AddSubscription(subscription); subscription.Create(); DateTime start = HiResClock.UtcNow; for (int ii = 0; ii < m_itemCount; ii++) { MonitoredItem monitoredItem = new MonitoredItem((uint)ii); monitoredItem.StartNodeId = new NodeId((uint)((1 << 24) + ii), 2); monitoredItem.AttributeId = Attributes.Value; monitoredItem.SamplingInterval = -1; monitoredItem.Filter = null; monitoredItem.QueueSize = 0; monitoredItem.DiscardOldest = true; monitoredItem.MonitoringMode = MonitoringMode.Reporting; subscription.AddItem(monitoredItem); } subscription.ApplyChanges(); DateTime end = HiResClock.UtcNow; ReportMessage("Time to add {1} items {0}ms.", (end - start).TotalMilliseconds, m_itemCount); start = HiResClock.UtcNow; subscription.SetPublishingMode(true); end = HiResClock.UtcNow; ReportMessage("Time to emable publishing {0}ms.", (end - start).TotalMilliseconds); }
private void Init() { NoticeDelegate = new NoticeEventHandler(OnNotice); NotificationDelegate = new NotificationEventHandler(OnNotification); ProvideClientCertificatesCallbackDelegate = new ProvideClientCertificatesCallback(DefaultProvideClientCertificatesCallback); CertificateValidationCallbackDelegate = new CertificateValidationCallback(DefaultCertificateValidationCallback); CertificateSelectionCallbackDelegate = new CertificateSelectionCallback(DefaultCertificateSelectionCallback); PrivateKeySelectionCallbackDelegate = new PrivateKeySelectionCallback(DefaultPrivateKeySelectionCallback); ValidateRemoteCertificateCallbackDelegate = new ValidateRemoteCertificateCallback(DefaultValidateRemoteCertificateCallback); // Fix authentication problems. See https://bugzilla.novell.com/show_bug.cgi?id=MONO77559 and // http://pgfoundry.org/forum/message.php?msg_id=1002377 for more info. RSACryptoServiceProvider.UseMachineKeyStore = true; promotable = new NpgsqlPromotableSinglePhaseNotification(this); }
/// <summary> /// Register "you" as someone he's interested in a particular topic /// </summary> /// <param name="you">the object insterested in receiving notifications</param> /// <param name="type">the topic "you" is interested in</param> /// <param name="priority">lower values mean that among all the subscribers of a particular topic, "you" will be notified first. /// Contrarly, big values means that "you" will be notified at last</param> /// <param name="action">the action to perform</param> /// <returns>the number of subscribers of the specified topic</returns> public int SubscribeFor(object you, int type, int priority, NotificationEventHandler action) { lock (this.Subscribers) { SortedList <int, SubscriptionInfo> subscriberForType = null; if (this.Subscribers.ContainsKey(type)) { subscriberForType = this.Subscribers[type]; } else { subscriberForType = new SortedList <int, SubscriptionInfo>(); this.Subscribers[type] = subscriberForType; } subscriberForType.Add(priority, new SubscriptionInfo(you, action)); return(subscriberForType.Count); } }
/// <summary> /// Initializes a new instance of the /// <see cref="Npgsql.NpgsqlConnection">NpgsqlConnection</see> class /// and sets the <see cref="Npgsql.NpgsqlConnection.ConnectionString">ConnectionString</see>. /// </summary> /// <param name="ConnectionString">The connection used to open the PostgreSQL database.</param> public NpgsqlConnection(String ConnectionString) { NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, CLASSNAME, "NpgsqlConnection()"); LoadConnectionStringBuilder(ConnectionString); NoticeDelegate = new NoticeEventHandler(OnNotice); NotificationDelegate = new NotificationEventHandler(OnNotification); ProvideClientCertificatesCallbackDelegate = new ProvideClientCertificatesCallback(DefaultProvideClientCertificatesCallback); CertificateValidationCallbackDelegate = new CertificateValidationCallback(DefaultCertificateValidationCallback); CertificateSelectionCallbackDelegate = new CertificateSelectionCallback(DefaultCertificateSelectionCallback); PrivateKeySelectionCallbackDelegate = new PrivateKeySelectionCallback(DefaultPrivateKeySelectionCallback); ValidateRemoteCertificateCallbackDelegate = new ValidateRemoteCertificateCallback(DefaultValidateRemoteCertificateCallback); // Fix authentication problems. See https://bugzilla.novell.com/show_bug.cgi?id=MONO77559 and // http://pgfoundry.org/forum/message.php?msg_id=1002377 for more info. RSACryptoServiceProvider.UseMachineKeyStore = true; promotable = new NpgsqlPromotableSinglePhaseNotification(this); }
public async Task Test_CanListenUnlisten(string channelName, bool sendSampleNotification) { using (ManualResetEvent notificationReceived = new ManualResetEvent(false)) using (NpgsqlConnection conn = await OpenDbConnectionAsync(ConnectionString)) { NotificationEventHandler neh = (s, e) => notificationReceived.Set(); Assert.IsFalse(conn.IsListening(channelName)); await conn.ListenAsync(channelName, neh); Assert.IsTrue(conn.IsListening(channelName)); if (sendSampleNotification) { using (NpgsqlConnection connSend = await OpenDbConnectionAsync(ConnectionString)) { await connSend.NotifyAsync(channelName, withinTx : null); await connSend.CloseAsync(); } conn.Wait(); notificationReceived.WaitOne(); } else { await Task.Delay(500); } await conn.UnlistenAsync(channelName, neh); Assert.IsFalse(conn.IsListening(channelName)); await conn.CloseAsync(); } }
private bool SetupNotification(int attemptsCount, string tableName, NotificationEventHandler changeEventHandler) { bool result = false; string key = NotificationClient.GetKey(tableName, changeEventHandler); NotificationClient notificationClient; while (!_NotificationClients.TryGetValue(key, out notificationClient)) { notificationClient = new NotificationClient() { TableName = tableName, EventHandler = changeEventHandler }; if (AddNotificationClient(notificationClient)) { break; } } result = SetupNotification(notificationClient, attemptsCount); if (!result) { AddNotificationToRepair(notificationClient); } return(result); }
public DwgDocumentBuilder(CadDocument document, DwgReaderFlags flags, NotificationEventHandler notification = null) : base(document, notification) { this.Flags = flags; }
protected CadReaderBase(Stream stream, NotificationEventHandler notification) : this(notification) { this._fileStream = new StreamIO(stream); }
public void SetupNotification(string tableName, NotificationEventHandler changeEventHandler) { Interlocked.Increment(ref _NotificationCount); bool success = SetupNotification(2, tableName, changeEventHandler); if (!success) _Logger?.LogError(string.Format("Failed initial notification setup with dbnotify service.\nNotificationServerList: {0} \nTableName: {1}", string.Join(", ", _NotificationServers), tableName)); }
private bool SetupNotification(int attemptsCount, string tableName, NotificationEventHandler changeEventHandler) { bool result = false; string key = NotificationClient.GetKey(tableName, changeEventHandler); NotificationClient notificationClient; while (!_NotificationClients.TryGetValue(key, out notificationClient)) { notificationClient = new NotificationClient() { TableName = tableName, EventHandler = changeEventHandler }; if (AddNotificationClient(notificationClient)) break; } result = SetupNotification(notificationClient, attemptsCount); if (!result) { AddNotificationToRepair(notificationClient); } return result; }
public DxfObjectsSectionReader(IDxfStreamReader reader, DxfDocumentBuilder builder, NotificationEventHandler notification = null) : base(reader, builder, notification) { }
/// <summary> /// Tests the session reconnect. /// </summary> private bool DoReconnectTest() { double increment = MaxProgress / 6; double position = 0; bool success = true; lock (m_messages) { m_messages.Clear(); } int currentKeepAlive = Session.KeepAliveInterval; List <Subscription> subscriptions = new List <Subscription>(); KeepAliveEventHandler keepAliveHandler = new KeepAliveEventHandler(Session_Reconnect); NotificationEventHandler notificationHandler = new NotificationEventHandler(Session_Notification); try { Session.KeepAlive += keepAliveHandler; Session.Notification += notificationHandler; for (int publishingInterval = 1000; publishingInterval <= 10000; publishingInterval += 1000) { Subscription subscription = new Subscription(); subscription.MaxMessageCount = 100; subscription.LifetimeCount = 100; subscription.KeepAliveCount = 10; subscription.PublishingEnabled = true; subscription.PublishingInterval = publishingInterval; MonitoredItem monitoredItem = new MonitoredItem(); monitoredItem.StartNodeId = VariableIds.Server_ServerStatus_CurrentTime; monitoredItem.AttributeId = Attributes.Value; monitoredItem.SamplingInterval = -1; monitoredItem.QueueSize = 0; monitoredItem.DiscardOldest = true; subscription.AddItem(monitoredItem); Session.AddSubscription(subscription); subscription.Create(); subscriptions.Add(subscription); } m_keepAliveCount = 0; Session.KeepAliveInterval = 1000; Log("Setting keep alive interval to {0}ms.", Session.KeepAliveInterval); int testDuration = 3000; for (int ii = 0; ii < 6; ii++) { Session.Reconnect(); Log("Session reconnected. KeepAlives={0}", m_keepAliveCount); if (m_errorEvent.WaitOne(testDuration, false)) { Log("Unexpected error waiting for session keep alives. {0}", m_error.ToLongString()); return(false); } position += increment; ReportProgress(position); } } finally { Session.RemoveSubscriptions(subscriptions); Session.KeepAliveInterval = currentKeepAlive; Session.KeepAlive -= keepAliveHandler; Session.Notification -= notificationHandler; } ReportProgress(MaxProgress); lock (m_messages) { foreach (KeyValuePair <uint, List <uint> > entry in m_messages) { entry.Value.Sort(); for (int ii = 0; ii < entry.Value.Count - 1; ii++) { if (entry.Value[ii + 1] - entry.Value[ii] > 1) { Log("Missing message. Subscription={0}, SequenceNumber={1}-{2}", entry.Key, entry.Value[ii] + 1, entry.Value[ii + 1] - 1); } if (entry.Value[ii + 1] == entry.Value[ii]) { // Log("Duplicate message. Subscription={0}, SequenceNumber={1}", entry.Key, entry.Value[ii]); } } } } return(success); }
/// <summary> /// Runs the test for all of the browse roots. /// </summary> public override bool Run(ServerTestCase testcase, int iteration) { try { LockServer(); if (ReadOnlyTests) { Log("WARNING: TestCase {0} skipped because client could not acquire a lock on the Server.", testcase.Name); return true; } Iteration = iteration; // need fetch nodes used for the test if not already available. if (AvailableNodes.Count == 0) { if (!GetNodesInHierarchy()) { return false; } } // get the writeable variables. if (WriteableVariables.Count == 0) { if (!GetWriteableVariablesInHierarchy()) { Log("WARNING: No writeable variables found."); Log(WriteTest.g_WriteableVariableHelpText); return true; } } // do main test. NotificationEventHandler handler = new NotificationEventHandler(Session_Notification); try { Session.Notification += handler; bool result = true; switch (testcase.Name) { case "Deadband": { if (!DoDeadbandTest(false)) { Log("WARNING: Re-doing Deadband test to check if random timing glitches were the cause of failure."); result = DoDeadbandTest(false); break; } return true; } case "ModifyDeadband": { if (!DoDeadbandTest(true)) { Log("WARNING: Re-doing ModifyDeadband test to check if random timing glitches were the cause of failure."); result = DoDeadbandTest(true); break; } return true; } case "QueueSize": { if (!DoQueueSizeTest(false)) { Log("WARNING: Re-doing QueueSize test to check if random timing glitches were the cause of failure."); result = DoQueueSizeTest(false); break; } return true; } case "ModifyQueueSize": { if (!DoQueueSizeTest(true)) { Log("WARNING: Re-doing ModifyQueueSize test to check if random timing glitches were the cause of failure."); result = DoQueueSizeTest(true); break; } return true; } case "ModifySamplingInterval": { if (!DoSamplingIntervalTest(true)) { Log("WARNING: Re-doing ModifySamplingInterval test to check if random timing glitches were the cause of failure."); result = DoSamplingIntervalTest(true); break; } return true; } default: { if (!DoSamplingIntervalTest(true)) { Log("WARNING: Re-doing SamplingInterval test to check if random timing glitches were the cause of failure."); result = DoSamplingIntervalTest(false); break; } return true; } } if (!result && m_writeDelayed) { Log("WARNING: Test skipped because the system is likely overloaded and cannot process the requests fast enough."); result = true; } return result; } finally { Session.Notification -= handler; } } finally { UnlockServer(); } }
internal SubscriptionInfo(object source, NotificationEventHandler action) { this.Source = source; this.Action = action; }
/// <summary> /// Starts the specified session. /// </summary> /// <param name="session">The session.</param> public void Start(Session session) { m_NotificationEventHandler = new NotificationEventHandler(Session_Notification); session.Notification += m_NotificationEventHandler; Subscription subscription = m_subscription = new Subscription(); subscription.PublishingInterval = m_samplingRate; subscription.KeepAliveCount = 10; subscription.LifetimeCount = 100; subscription.MaxNotificationsPerPublish = 50000; subscription.PublishingEnabled = false; subscription.TimestampsToReturn = TimestampsToReturn.Neither; subscription.Priority = 1; subscription.DisableMonitoredItemCache = true; session.AddSubscription(subscription); subscription.Create(); DateTime start = HiResClock.UtcNow; for (int ii = 0; ii < m_itemCount; ii++) { MonitoredItem monitoredItem = new MonitoredItem((uint)ii); monitoredItem.StartNodeId = new NodeId((uint)((1<<24) + ii), 2); monitoredItem.AttributeId = Attributes.Value; monitoredItem.SamplingInterval = -1; monitoredItem.Filter = null; monitoredItem.QueueSize = 0; monitoredItem.DiscardOldest = true; monitoredItem.MonitoringMode = MonitoringMode.Reporting; subscription.AddItem(monitoredItem); } subscription.ApplyChanges(); DateTime end = HiResClock.UtcNow; ReportMessage("Time to add {1} items {0}ms.", (end - start).TotalMilliseconds, m_itemCount); start = HiResClock.UtcNow; subscription.SetPublishingMode(true); end = HiResClock.UtcNow; ReportMessage("Time to emable publishing {0}ms.", (end - start).TotalMilliseconds); }
private CadReaderBase(NotificationEventHandler notification) { this.OnNotificationHandler = notification; }
public NotificationEventHandlerTests() { _sut = new NotificationEventHandler(); }
protected override void ExecuteApplicationSpecificStart() { ExWatson.Register("E12IIS"); StoreSession.UseRPCContextPool = true; UMClientCommonBase.InitializePerformanceCounters(false); OwaEventRegistry.RegisterEnum(typeof(Importance)); OwaEventRegistry.RegisterEnum(typeof(Sensitivity)); OwaEventRegistry.RegisterEnum(typeof(AddressOrigin)); OwaEventRegistry.RegisterEnum(typeof(FlagAction)); OwaEventRegistry.RegisterEnum(typeof(TaskStatus)); OwaEventRegistry.RegisterEnum(typeof(BusyType)); OwaEventRegistry.RegisterEnum(typeof(ResponseType)); OwaEventRegistry.RegisterEnum(typeof(StoreObjectType)); OwaEventRegistry.RegisterEnum(typeof(EmailAddressIndex)); OwaEventRegistry.RegisterEnum(typeof(NavigationNodeGroupSection)); OwaEventRegistry.RegisterEnum(typeof(InstantMessagingTypeOptions)); OwaEventRegistry.RegisterEnum(typeof(NavigationModule)); OwaEventRegistry.RegisterEnum(typeof(DefaultFolderType)); OwaEventRegistry.RegisterEnum(typeof(RecipientBlockType)); OwaEventRegistry.RegisterEnum(typeof(RecipientJunkEmailContextMenuType)); OwaEventRegistry.RegisterEnum(typeof(SharingLevel)); OwaEventRegistry.RegisterEnum(typeof(DenyResponseType)); OwaEventRegistry.RegisterEnum(typeof(AddressBookItemEventHandler.ItemTypeToPeople)); OwaEventRegistry.RegisterStruct(typeof(RecipientInfo)); OwaEventRegistry.RegisterStruct(typeof(DeleteItemInfo)); OwaEventRegistry.RegisterStruct(typeof(ReminderInfo)); OwaEventRegistry.RegisterHandler(typeof(ProxyEventHandler)); OwaEventRegistry.RegisterHandler(typeof(PendingRequestEventHandler)); OwaEventRegistry.RegisterHandler(typeof(ProxyToEwsEventHandler)); NotificationEventHandler.Register(); ClientCacheEventHandler.Register(); DocumentLibraryEventHandler.Register(); DocumentEventHandler.Register(); DatePickerEventHandler.Register(); ReadADOrgPersonEventHandler.Register(); ListViewEventHandler.Register(); TreeEventHandler.Register(); NavigationEventHandler.Register(); RecipientWellEventHandler.Register(); AttachmentEventHandler.Register(); ReadMessageEventHandler.Register(); ReadConversationEventHandler.Register(); ReadVoiceMessageEventHandler.Register(); OptionsEventHandler.Register(); AddressBookItemEventHandler.Register(); OwaEventRegistry.RegisterHandler(typeof(EditMessageEventHandler)); OwaEventRegistry.RegisterHandler(typeof(EditSmsEventHandler)); EditCalendarItemEventHandler.Register(); CalendarViewEventHandler.Register(); OwaEventRegistry.RegisterHandler(typeof(EditMeetingInviteEventHandler)); OwaEventRegistry.RegisterHandler(typeof(EditMeetingResponseEventHandler)); OwaEventRegistry.RegisterHandler(typeof(ErrorEventHandler)); OwaEventRegistry.RegisterHandler(typeof(FlagEventHandler)); OwaEventRegistry.RegisterHandler(typeof(CategoryEventHandler)); OwaEventRegistry.RegisterHandler(typeof(InstantMessageEventHandler)); OwaEventRegistry.RegisterHandler(typeof(MonitoringEventHandler)); OwaEventRegistry.RegisterHandler(typeof(MailTipsEventHandler)); RemindersEventHandler.Register(); EditContactItemEventHandler.Register(); EditDistributionListEventHandler.Register(); JunkEmailEventHandler.Register(); EditTaskEventHandler.Register(); ComplianceEventHandler.Register(); WebReadyFileEventHandler.Register(); EditPostEventHandler.Register(); ReadPostEventHandler.Register(); SMimeEventHandler.Register(); NavigationNodeEventHandler.Register(); MessageVirtualListViewEventHandler2.Register(); TaskVirtualListViewEventHandler.Register(); PersonalAutoAttendantOptionsEventHandler.Register(); EditPAAEventHandler.Register(); PerformanceConsoleEventHandler.Register(); DirectoryVirtualListViewEventHandler.Register(); ContactVirtualListViewEventHandler.Register(); DumpsterVirtualListViewEventHandler.Register(); SharingMessageEventHandler.Register(); DeletePolicyEventHandler.Register(); MovePolicyEventHandler.Register(); PrintCalendarEventHandler.Register(); MessageAnnotationEventHandler.Register(); }
public static string GetKey(string table, NotificationEventHandler eventHandler) { string result; if (eventHandler == null) result = string.Concat(table); else result = string.Concat(table, "|", eventHandler.Method.DeclaringType.AssemblyQualifiedName); return result; }
public DxfDocumentBuilder(CadDocument document, NotificationEventHandler notification = null) : base(document, notification) { }
public CadDocumentBuilder(CadDocument document, NotificationEventHandler notification = null) { this.DocumentToBuild = document; this.NotificationHandler = notification; }
/// <summary> /// Tests the session reconnect. /// </summary> private bool DoReconnectTest() { double increment = MaxProgress/6; double position = 0; bool success = true; lock (m_messages) { m_messages.Clear(); } int currentKeepAlive = Session.KeepAliveInterval; List<Subscription> subscriptions = new List<Subscription>(); KeepAliveEventHandler keepAliveHandler = new KeepAliveEventHandler(Session_Reconnect); NotificationEventHandler notificationHandler = new NotificationEventHandler(Session_Notification); try { Session.KeepAlive += keepAliveHandler; Session.Notification += notificationHandler; for (int publishingInterval = 1000; publishingInterval <= 10000; publishingInterval += 1000) { Subscription subscription = new Subscription(); subscription.MaxMessageCount = 100; subscription.LifetimeCount = 100; subscription.KeepAliveCount = 10; subscription.PublishingEnabled = true; subscription.PublishingInterval = publishingInterval; MonitoredItem monitoredItem = new MonitoredItem(); monitoredItem.StartNodeId = VariableIds.Server_ServerStatus_CurrentTime; monitoredItem.AttributeId = Attributes.Value; monitoredItem.SamplingInterval = -1; monitoredItem.QueueSize = 0; monitoredItem.DiscardOldest = true; subscription.AddItem(monitoredItem); Session.AddSubscription(subscription); subscription.Create(); subscriptions.Add(subscription); } m_keepAliveCount = 0; Session.KeepAliveInterval = 1000; Log("Setting keep alive interval to {0}ms.", Session.KeepAliveInterval); int testDuration = 3000; for (int ii = 0; ii < 6; ii++) { Session.Reconnect(); Log("Session reconnected. KeepAlives={0}", m_keepAliveCount); if (m_errorEvent.WaitOne(testDuration, false)) { Log("Unexpected error waiting for session keep alives. {0}", m_error.ToLongString()); return false; } position += increment; ReportProgress(position); } } finally { Session.RemoveSubscriptions(subscriptions); Session.KeepAliveInterval = currentKeepAlive; Session.KeepAlive -= keepAliveHandler; Session.Notification -= notificationHandler; } ReportProgress(MaxProgress); lock (m_messages) { foreach (KeyValuePair<uint,List<uint>> entry in m_messages) { entry.Value.Sort(); for (int ii = 0; ii < entry.Value.Count-1; ii++) { if (entry.Value[ii+1] - entry.Value[ii] > 1) { Log("Missing message. Subscription={0}, SequenceNumber={1}-{2}", entry.Key, entry.Value[ii]+1, entry.Value[ii+1]-1); } if (entry.Value[ii+1] == entry.Value[ii]) { // Log("Duplicate message. Subscription={0}, SequenceNumber={1}", entry.Key, entry.Value[ii]); } } } } return success; }
protected CadReaderBase(string filename, NotificationEventHandler notification) : this(notification) { this._fileStream = new StreamIO(filename, FileMode.Open, FileAccess.Read); }