public SPApiWrapper() { hNVSPapi = LoadLibrary(@"C:/Program Files (x86)/NVIDIA Corporation/ShadowPlay/nvspapi.dll"); IntPtr hCreateShadowPlayApiInterface = GetProcAddress(hNVSPapi, "CreateShadowPlayApiInterface"); CreateShadowPlayApiInterface createShadowPlayApiInterface = (CreateShadowPlayApiInterface)Marshal.GetDelegateForFunctionPointer(hCreateShadowPlayApiInterface, typeof(CreateShadowPlayApiInterface)); CShadowPlayApiProxyInterface ppvInterface = new CShadowPlayApiProxyInterface { api = Marshal.AllocHGlobal(4) }; CreateShadowPlayApiParams createShadowPlayApiParams = new CreateShadowPlayApiParams { api_version = 0x10010, interface_ver = 0x10004, client = 0, ppvInterface = ppvInterface }; int result = createShadowPlayApiInterface(ref createShadowPlayApiParams); hProxyInterface = Marshal.ReadIntPtr(ppvInterface.api); api = Marshal.PtrToStructure <CShadowPlayApi>(Marshal.ReadIntPtr(hProxyInterface)); hotkeyCB += (IntPtr unk01, IntPtr unk02) => { if ((bool)Application.Current.Properties["IsHotkeysEnabled"]) { byte hotkeyId = Marshal.ReadByte(unk02 + 20); byte state = Marshal.ReadByte(unk02 + 21); switch (hotkeyId) { case (byte)HotKeys.SAVE_IR: ExecuteCaptureCommand(IRAction.SaveInstantReplay); break; case (byte)HotKeys.TOGGLE_RECORD: this.ToggleManualRecord(); break; } } return(0); }; notificationCB += (IntPtr unk01) => { IntPtr obj = Marshal.ReadIntPtr(unk01 + 28); int msgId = Marshal.ReadInt32(obj); if (msgId == 0x00010218) { if (OnFileSaved != null) { string filename = Marshal.PtrToStringAuto(obj + 16); Application.Current.Dispatcher.Invoke(() => { OnFileSaved(this, filename); }); } } return(0); }; RegisterCallback(1, hotkeyCB); RegisterCallback(2, notificationCB); }
public NotificationListener() { _callback = (int type) => { this.ProcessNotification(type); }; _notificationListener = InteropEmu.RegisterNotificationCallback(_callback); }
public NotificationListener() { _callback = (int type, IntPtr parameter) => { this.ProcessNotification(type, parameter); }; _notificationListener = EmuApi.RegisterNotificationCallback(_callback); }
public DefaultViewModel(IMessenger messenger, IMonsterDatabase dbConnexion) { _alreadyAttachedBehavior = new List <Grid>(); _messenger = messenger; _notificationMessageCallback = MediaPlayerPlaybackCallback; _dbConn = dbConnexion; _showedCollection = new ObservableCollection <Cast>(); _messenger.Register <NotificationMessage>(this, MessengerAction); _messenger.Register <NotificationMessage>(this, ViewBuiltNotificationAction); _messenger.Register <GenericMessage <Cast> >(this, Message.REQUEST_VIEW_UPDATE_PLAYBACK_BADGE, UpdateViewPlaybackBadgeRequestAction); _messenger.Register <NotificationMessage>(this, Message.MEDIAPLAYER_PLAYBACK_STATE_PLAYING, PlaybackStatePlayingAction); _messenger.Register <NotificationMessage>(this, Message.MEDIAPLAYER_PLAYBACK_STATE_PAUSED, PlaybackStatePausedAction); _scrollerBarValueChangedCommand = new RelayCommand <RangeBaseValueChangedEventArgs>(ScrollerBarValueChangedAction); _castItemPointerEnteredCommand = new RelayCommand <PointerRoutedEventArgs>(CastItemPointerEnteredAction); _castItemPointerExitedCommand = new RelayCommand <PointerRoutedEventArgs>(CastItemPointerExitedAction); _playCommand = new RelayCommand(PlayRelayCommand); _loveCommand = new RelayCommand(LoveRelayCommand); _playbackPlayCommand = new RelayCommand(PlaybackPlayRelayCommand); _playbackLoveCommand = new RelayCommand(PlaybackLoveRelayCommand); }
public void RegisterCallback(NotificationCallback<T> callback) { if (IsCompleted) return; if (TryGetCallbackId(callback, out _)) return; var id = Interlocked.Increment(ref _callbackNo); _callbacks.TryAdd(id, callback); }
public void RemoveCallback(NotificationCallback<T> callback) { if (IsCompleted) return; if (TryGetCallbackId(callback, out int id)) { _callbacks.TryRemove(id, out _); } }
public void AddToQueue(Notification notification, NotificationCallback callback) { mQueue.Enqueue(new NotificationData() { Notification = notification, Callback = callback }); }
public void AddNotificationListener(ObjectName name, NotificationCallback callback, NotificationFilterCallback filterCallback, object handback) { name = GetNameWithDomain(name); IDynamicMBean bean; INotificationEmitter emitter = GetEmitterMBean(name, out bean); TestPermissions(bean.GetMBeanInfo().ClassName, null, name, MBeanPermissionAction.AddNotificationListener); emitter.AddNotificationListener(callback, filterCallback, handback); }
public void RemoveCallback(NotificationCallback <T> callback) { if (IsCompleted) { return; } _callbacks.TryRemove(callback.GetHashCode(), out _); }
public IntPtr AddNotificationCallback(IntPtr managedResultsHandle, NotificationCallback callback) { NativeException nativeException; var result = NativeMethods.add_notification_callback(this, managedResultsHandle, callback, out nativeException); nativeException.ThrowIfNecessary(); return(result); }
public PullSubscriptionListener(IPullSubscriptionClient <TargetedNotificationType> client, NotificationCallback callback, NotificationFilterCallback filterCallback, object handback) { _token = new CallbackThreadPoolPullSubscriptionClient <TargetedNotificationType>( HandleEvent, client, true); _filterCallback = filterCallback; _handback = handback; _callback = callback; }
public void RemoveNotificationListener(ObjectName name, NotificationCallback callback) { name = GetNameWithDomain(name); IDynamicMBean bean; INotificationEmitter emitter = GetEmitterMBean(name, out bean); TestPermissions(bean.GetMBeanInfo().ClassName, null, name, MBeanPermissionAction.RemoveNotificationListener); emitter.RemoveNotificationListener(callback); }
public PullSubscriptionListener(IPullSubscriptionClient<TargetedNotificationType> client, NotificationCallback callback, NotificationFilterCallback filterCallback, object handback) { _token = new CallbackThreadPoolPullSubscriptionClient<TargetedNotificationType>( HandleEvent, client, true); _filterCallback = filterCallback; _handback = handback; _callback = callback; }
internal void RemoveCallback(NotificationCallback callback) { _callbacks.Remove(callback); if (_callbacks.Count == 0) { UnsubscribeFromNotifications(); } }
public void RegisterCallback(NotificationCallback <T> callback) { if (IsCompleted) { return; } var id = callback.GetHashCode(); _callbacks.TryAdd(id, callback); }
/// <summary> /// Register a callback to be invoked each time this <see cref="RealmResults{T}"/> changes. /// </summary> /// <remarks> /// <para> /// The callback will be asynchronously invoked with the initial <see cref="RealmResults{T}" />, and then called again after each write transaction /// which changes either any of the objects in the collection, or which objects are in the collection. /// The <c>changes</c> parameter will be <c>null</c> the first time the callback is invoked with the initial results. /// For each call after that, it will contain information about which rows in the results were added, removed or modified. /// </para> /// <para> /// If a write transaction did not modify any objects in this <see cref="RealmResults{T}" />, the callback is not invoked at all. /// If an error occurs the callback will be invoked with <c>null</c> for the <c>sender</c> parameter and a non-<c>null</c> <c>error</c>. /// Currently the only errors that can occur are when opening the <see cref="Realms.Realm" /> on the background worker thread. /// </para> /// <para> /// At the time when the block is called, the <see cref="RealmResults{T}" /> object will be fully evaluated and up-to-date, and as long as you do not perform a write transaction on the same thread /// or explicitly call <see cref="Realm.Refresh" />, accessing it will never perform blocking work. /// </para> /// <para> /// Notifications are delivered via the standard event loop, and so can't be delivered while the event loop is blocked by other activity. /// When notifications can't be delivered instantly, multiple notifications may be coalesced into a single notification. /// This can include the notification with the initial collection. /// </para> /// </remarks> /// <param name="callback">The callback to be invoked with the updated <see cref="RealmResults{T}" />.</param> /// <returns> /// A subscription token. It must be kept alive for as long as you want to receive change notifications. /// To stop receiving notifications, call <see cref="IDisposable.Dispose" />. /// </returns> public IDisposable SubscribeForNotifications(NotificationCallback callback) { if (_callbacks.Count == 0) { SubscribeForNotifications(); } _callbacks.Add(callback); return(new NotificationToken(this, callback)); }
public void AddNotificationListener(ObjectName name, NotificationCallback callback, NotificationFilterCallback filterCallback, object handback) { var key = new NotificationSubscriptionKey(name, callback, filterCallback, handback); if (_subscriptions.ContainsKey(key)) { throw new InvalidOperationException("Subscription already exists."); } var pullDeliverySubscription = _eventingClient.SubscribeUsingPullDelivery<TargetedNotificationType>(new Filter(Schema.NotificationDialect, null), new Mandatory(name.CreateSelectorSetHeader())); var listener = new PullSubscriptionListener(pullDeliverySubscription, callback, filterCallback, handback); _subscriptions.Add(key, listener); }
public void RemoveNotificationListener(NotificationCallback callback, NotificationFilterCallback filterCallback, object handback) { if (callback == null) { throw new ArgumentNullException("callback"); } NotificationSubscription subscr = new NotificationSubscription(callback, filterCallback, handback); if (!_subscriptions.Remove(subscr)) { throw new ListenerNotFoundException(_objectName); } }
public void RemoveNotificationListener(ObjectName name, ObjectName listener, NotificationFilterCallback filterCallback, object handback) { name = GetNameWithDomain(name); listener = GetNameWithDomain(listener); IDynamicMBean bean; INotificationEmitter emitter = GetEmitterMBean(name, out bean); TestPermissions(bean.GetMBeanInfo().ClassName, null, name, MBeanPermissionAction.RemoveNotificationListener); INotificationListener listenerBean = GetListenerMBean(name, out bean); NotificationCallback callback = new NotificationCallback(listenerBean.HandleNotification); emitter.RemoveNotificationListener(callback, filterCallback, handback); }
public void AddNotificationListener(ObjectName name, NotificationCallback callback, NotificationFilterCallback filterCallback, object handback) { var key = new NotificationSubscriptionKey(name, callback, filterCallback, handback); if (_subscriptions.ContainsKey(key)) { throw new InvalidOperationException("Subscription already exists."); } var pullDeliverySubscription = _eventingClient.SubscribeUsingPullDelivery <TargetedNotificationType>(new Filter(Schema.NotificationDialect, null), new Mandatory(name.CreateSelectorSetHeader())); var listener = new PullSubscriptionListener(pullDeliverySubscription, callback, filterCallback, handback); _subscriptions.Add(key, listener); }
public HcsNotificationWatcher(IntPtr handle, RegisterHcsNotificationCallback register, UnregisterHcsNotificationCallback unregister, HCS_NOTIFICATIONS[] notificationList) { _unreg = unregister; foreach (var notificationType in notificationList) { var entry = new TaskCompletionSource <NotificationResult>(); _n.Add(notificationType, entry); } _callbackFunc = (uint nType, IntPtr ctx, int nStatus, string nData) => { var key = (HCS_NOTIFICATIONS)nType; if (key == HCS_NOTIFICATIONS.HcsNotificationServiceDisconnect) { // Service disconnect should fail all outstanding notifications. foreach (var entry in _n.Values) { entry.TrySetException(new HcsException(HcsException.E_ABORT, null)); } return; } if (key == HCS_NOTIFICATIONS.HcsNotificationSystemExited && _n.ContainsKey(HCS_NOTIFICATIONS.HcsNotificationSystemStartCompleted)) { // Special handling for exit received while waiting for start. _n[HCS_NOTIFICATIONS.HcsNotificationSystemStartCompleted].TrySetException(new HcsException(HcsException.UNEXPECTED_EXIT, null)); } if (_n.ContainsKey(key)) { var result = new NotificationResult() { Status = nStatus, Data = nData }; if (HcsException.Failed(result.Status)) { _n[key].SetException(new HcsException(result.Status, result.Data)); } else { _n[key].SetResult(result); } } }; HcsFunctions.ProcessHcsCall(register(handle, _callbackFunc, IntPtr.Zero, out _h), null); }
public void SetCallback(NotificationCallback callback) { if (notificationCallback != null) { throw new NotImplementedException("Safeguard against the application being designed in a more difficult way than easiest case"); } CheckConfig(); Task.Factory.StartNew(() => { // wait for callback using (var ctx = new ZContext()) using (var subscriber = new ZSocket(ctx, ZSocketType.SUB)) { subscriber.Connect("tcp://127.0.0.1:5556"); subscriber.Subscribe("notificationCallback"); while (true) { using (var replyFrame = subscriber.ReceiveFrame()) { string json = replyFrame.ReadString(); PalResponse deserialised = JsonConvert.DeserializeObject <PalResponse>(json, jsonSettings); if (deserialised is NotificationResponse msg1) { notificationCallback(msg1.Bitmap); } else { throw new NotImplementedException("Bad notificationCallback"); } } } } }); // tell the far side that a callback delegate has been set. Don't actually pass the delegate, since that would be meaningless. var msg = new SetCallbackMessage(); Send(msg); // keep a reference to the delegate, such that when we receive callbacks, by whatever means, this is the method we call. notificationCallback = callback; #warning Only supports a single caller to this method. This might not be adequate, depending on application design. Test. }
public NotificationSubscriptionKey(ObjectName name, NotificationCallback callback, NotificationFilterCallback filterCallback, object handback) { if (name == null) { throw new ArgumentNullException("name"); } if (callback == null) { throw new ArgumentNullException("callback"); } _name = name; _callback = callback; _filterCallback = filterCallback; _handback = handback; }
private void OnApplicationPause(bool isPause) { try { if (isPause) { int num = UnityEngine.Random.Range(1, 5); string textByKey = LocalizationService.Instance.GetTextByKey("localNotification_0" + num + "_title"); string textByKey2 = LocalizationService.Instance.GetTextByKey("localNotification_0" + num + "_body"); NotificationParams notificationParams = new NotificationParams { Id = NotificationIdHandler.GetNotificationId(), Delay = TimeSpan.FromHours(24.0), Title = textByKey, Message = textByKey2, Ticker = textByKey, Sound = true, Vibrate = true, Light = true, SmallIcon = NotificationIcon.Bell, SmallIconColor = new Color(0.63f, 0.63f, 0.63f), LargeIcon = "app_icon", ExecuteMode = NotificationExecuteMode.Inexact, Importance = NotificationImportance.Max, Repeat = true, RepeatInterval = TimeSpan.FromHours(24.0), ChannelId = "coloring.local", ChannelName = "Miscellaneous" }; NotificationManager.SendCustom(notificationParams); } else { NotificationCallback notificationCallback = NotificationManager.GetNotificationCallback(); if (notificationCallback != null && notificationCallback.Id != this.lastNotifId) { this.lastNotifId = notificationCallback.Id; AppState.LocalNotificationLaunch = true; FMLogger.vCore("local notif app resume"); } NotificationManager.CancelAll(); } } catch (Exception ex) { FMLogger.vCore("NotificationManager resume handler ex. " + ex.Message); } }
private void SetNotificationCallbackListener(Action <string> onNotificationLoadComplete, Action onNotificationLoadFail) { #if UNITY_ANDROID if (Application.platform == RuntimePlatform.Android) { NotificationCallback notificationCallback = new NotificationCallback(); notificationCallback.onNotificationLoadComplete = onNotificationLoadComplete; notificationCallback.onNotificationLoadFail = onNotificationLoadFail; jo.CallStatic("setNotificationCallbackListener", notificationCallback); } else { AUP.Utils.Message(TAG, "warning: must run in actual android device"); } #endif }
private bool TryGetCallbackId(NotificationCallback<T> callback, out int id) { using (var en = _callbacks.GetEnumerator()) { while (en.MoveNext()) { if (ReferenceEquals(en.Current.Value, callback)) { id = en.Current.Key; return true; } } } id = -1; return false; }
public MainViewModel(IMessenger messenger) { _messenger = messenger; _notificationMessageCallback = this.MediaPlayerPlaybackCallback; _messenger.Register <NotificationMessage <Type> >(this, ViewBuiltNotificationAction); _messenger.Register <GenericMessage <Type> >(this, Message.REQUEST_VIEW_NAVIGATION, NavigationViewRequestAction); _messenger.Register <GenericMessage <Cast> >(this, Message.REQUEST_VIEW_UPDATE_PLAYBACK_BADGE, UpdateViewPlaybackBadgeRequestAction); _messenger.Register <NotificationMessage <Cast> >(this, Message.REQUEST_SET_NAVIGATIONVIEW_CONTENTOVERLAY, SetNavigationViewContentOverlay); _messenger.Register <NotificationMessage <TimeSpan> >(this, Message.MEDIAPLAYER_MEDIA_OPENED, MediaOpenedAction); _messenger.Register <NotificationMessage>(this, Message.MEDIAPLAYER_MEDIA_ENDED, MediaEndedAction); _messenger.Register <NotificationMessage>(this, Message.MEDIAPLAYER_MEDIA_FAILED, MediaFailedAction); _messenger.Register <NotificationMessage>(this, Message.MEDIAPLAYER_MEDIA_BUFFERING_STARTED, MediaBufferingStartedAction); _messenger.Register <NotificationMessage>(this, Message.MEDIAPLAYER_MEDIA_BUFFERING_ENDED, MediaBufferingEndedAction); _messenger.Register <NotificationMessage>(this, Message.MEDIAPLAYER_SOURCE_CHANGED, MediaSourceChangedAction); _messenger.Register <NotificationMessage>(this, Message.MEDIAPLAYER_PLAYBACK_STATE_OPENING, PlaybackStateOpeningAction); _messenger.Register <NotificationMessage <TimeSpan> >(this, Message.MEDIAPLAYER_PLAYBACK_STATE_BUFFERING, PlaybackStateBufferingAction); _messenger.Register <NotificationMessage>(this, Message.MEDIAPLAYER_PLAYBACK_STATE_PLAYING, PlaybackStatePlayingAction); _messenger.Register <NotificationMessage>(this, Message.MEDIAPLAYER_PLAYBACK_STATE_PAUSED, PlaybackStatePausedAction); _messenger.Register <NotificationMessage <TimeSpan> >(this, Message.MEDIAPLAYER_PLAYBACK_POSITION_CHANGED, PlaybackPositionChangedAction); _messenger.Send(new GenericMessage <double>(_volume), Message.REQUEST_MEDIAPLAYER_UPDATE_VOLUME); _invokedMenuItemCommand = new RelayCommand <Microsoft.UI.Xaml.Controls.NavigationViewItemInvokedEventArgs>(InvokedMenuItemRelayCommand); _optionalMenuItemCommand = new RelayCommand <ItemClickEventArgs>(OptionalRelayCommandHandler); _thumbDragStartedCommand = new RelayCommand <DragStartedEventArgs>(ThumbDragStartedRelayCommand); _thumbDragDeltaCommand = new RelayCommand <DragDeltaEventArgs>(ThumbDragDeltaRelayCommand); _thumbDragCompleteCommand = new RelayCommand <DragCompletedEventArgs>(ThumbDragCompleteRelayCommand); _backButtonCommand = new RelayCommand <Microsoft.UI.Xaml.Controls.NavigationViewBackRequestedEventArgs>(BackButtonRelayCommand); _hostedFrameNavigatedCommand = new RelayCommand <NavigationEventArgs>(HostedFrameNavigatedRelayCommand); _soundFontIconTappedCommand = new RelayCommand <TappedRoutedEventArgs>(SoundFontIconTappedRelayCommand); _playFontIconTappedCommand = new RelayCommand <TappedRoutedEventArgs>(PlayFontIconTappedRelayCommand); _loopFontIconTappedCommand = new RelayCommand <TappedRoutedEventArgs>(LoopFontIconTappedRelayCommandAsync); _playbackBadgeClickCommand = new RelayCommand(PlaybackBadgeRelayCommandAsync); _playbackBadgeLoveFontIconTappedCommand = new RelayCommand(PlaybackBadgeLoveRelayCommandAsync); _playbackBadgeInfoFontIconTappedCommand = new RelayCommand(PlaybackBadgeInfoRelayCommandAsync); }
public void AddNotificationListener(ObjectName name, NotificationCallback callback, NotificationFilterCallback filterCallback, object handback) { int listenerId = _connection.AddNotificationListener(_token, name, filterCallback); NotificationSubscription subscr = new NotificationSubscription(callback, filterCallback, handback); _listenerProxys[subscr] = listenerId; _reverseListenerProxys[listenerId] = subscr; List<int> listenerGroup; if (_listenerGroupProxys.TryGetValue(callback, out listenerGroup)) { listenerGroup.Add(listenerId); } else { listenerGroup = new List<int>(); listenerGroup.Add(listenerId); _listenerGroupProxys[callback] = listenerGroup; } }
private void Awake() { try { NotificationCallback notificationCallback = NotificationManager.GetNotificationCallback(); if (notificationCallback != null && notificationCallback.Id != this.lastNotifId) { this.lastNotifId = notificationCallback.Id; AppState.LocalNotificationLaunch = true; FMLogger.vCore("local notif app launch"); } NotificationManager.CancelAll(); } catch (Exception ex) { FMLogger.vCore("NotificationManager check and cancel ex " + ex.Message); } }
/// <summary> /// We are going to handle our custom callback for notifications we receive /// If the notification tells us about tradeoffers, handle tradeoffers /// </summary> /// <param name="_callback"></param> private async void OnNotifications(NotificationCallback _callback) { if (_callback?.m_Notification == null || _callback.m_Notification.Count == 0) { return; } foreach (ENotification notification in _callback.m_Notification) { switch (notification) { case ENotification.TRADING: await m_tradeOfferHelper.CheckTradeOffers(m_steamFriendsHelper, m_steamClient.SteamID).ConfigureAwait(false); break; } } }
public void RemoveNotificationListener(ObjectName name, NotificationCallback callback) { if (name == null) { throw new ArgumentNullException("name"); } if (callback == null) { throw new ArgumentNullException("callback"); } var toRemove = _subscriptions.Keys.Where(x => callback.Equals(x.Callback) && name.Equals(x.ObjectName)).ToList(); foreach (var key in toRemove) { var listener = _subscriptions[key]; listener.Dispose(); _subscriptions.Remove(key); } }
public void AddNotificationListener(NotificationCallback callback, NotificationFilterCallback filterCallback, object handback) { if (callback == null) { throw new ArgumentNullException("callback"); } NotificationSubscription subscr = new NotificationSubscription(callback, filterCallback, handback); List<NotificationSubscription> subscrList; if (_subscriptions.TryGetValue(subscr, out subscrList)) { subscrList.Add(subscr); } else { subscrList = new List<NotificationSubscription>(); subscrList.Add(subscr); _subscriptions.Add(subscr, subscrList); } }
public void AddNotificationListener(NotificationCallback callback, NotificationFilterCallback filterCallback, object handback) { if (callback == null) { throw new ArgumentNullException("callback"); } NotificationSubscription subscr = new NotificationSubscription(callback, filterCallback, handback); List <NotificationSubscription> subscrList; if (_subscriptions.TryGetValue(subscr, out subscrList)) { subscrList.Add(subscr); } else { subscrList = new List <NotificationSubscription>(); subscrList.Add(subscr); _subscriptions.Add(subscr, subscrList); } }
public void AddNotificationListener(ObjectName name, NotificationCallback callback, NotificationFilterCallback filterCallback, object handback) { int listenerId = _connection.AddNotificationListener(_token, name, filterCallback); NotificationSubscription subscr = new NotificationSubscription(callback, filterCallback, handback); _listenerProxys[subscr] = listenerId; _reverseListenerProxys[listenerId] = subscr; List <int> listenerGroup; if (_listenerGroupProxys.TryGetValue(callback, out listenerGroup)) { listenerGroup.Add(listenerId); } else { listenerGroup = new List <int>(); listenerGroup.Add(listenerId); _listenerGroupProxys[callback] = listenerGroup; } }
public void RemoveNotificationListener(ObjectName name, NotificationCallback callback, NotificationFilterCallback filterCallback, object handback) { if (name == null) { throw new ArgumentNullException("name"); } if (callback == null) { throw new ArgumentNullException("callback"); } var key = new NotificationSubscriptionKey(name, callback, filterCallback, handback); PullSubscriptionListener listener; if (_subscriptions.TryGetValue(key, out listener)) { _subscriptions.Remove(key); listener.Dispose(); } }
public void RemoveNotificationListener(NotificationCallback callback) { if (callback == null) { throw new ArgumentNullException("callback"); } List<NotificationSubscription> toRemove = new List<NotificationSubscription>(); foreach (NotificationSubscription subscr in _subscriptions.Keys) { if (subscr.Callback.Equals(callback)) { toRemove.Add(subscr); } } if (toRemove.Count == 0) { throw new ListenerNotFoundException(_objectName); } foreach (NotificationSubscription subscr in toRemove) { _subscriptions.Remove(subscr); } }
public CallbackContext( NotificationCallback in_callback, HttpContext in_context ) { m_callback = in_callback; m_context = in_context; }
public NotificationSubscription(NotificationCallback callback, NotificationFilterCallback filterCallback, object handback) { _callback = callback; _filterCallback = filterCallback; _handback = handback; }
public void RemoveNotificationListener(ObjectName name, NotificationCallback callback, NotificationFilterCallback filterCallback, object handback) { throw new InvalidOperationException("This operation is not supported by ServiceModel connector."); }
public static void SetCallback(NotificationCallback callback) { }
public void RemoveNotificationListener(ObjectName name, NotificationCallback callback, NotificationFilterCallback filterCallback, object handback) { int listenerId; NotificationSubscription key = new NotificationSubscription(callback, filterCallback, handback); if (_listenerProxys.TryGetValue(key, out listenerId)) { _connection.RemoveNotificationListener(_token, name, listenerId); _reverseListenerProxys.Remove(listenerId); _listenerProxys.Remove(key); List<int> listenerGroup = _listenerGroupProxys[callback]; listenerGroup.Remove(listenerId); if (listenerGroup.Count == 0) { _listenerGroupProxys.Remove(callback); } } else { throw new ListenerNotFoundException(name.ToString()); } }
public void RemoveNotificationListener(ObjectName name, ObjectName listener) { name = GetNameWithDomain(name); listener = GetNameWithDomain(listener); IDynamicMBean bean; INotificationEmitter emitter = GetEmitterMBean(name, out bean); TestPermissions(bean.GetMBeanInfo().ClassName, null, name, MBeanPermissionAction.RemoveNotificationListener); INotificationListener listenerBean = GetListenerMBean(listener, out bean); NotificationCallback callback = new NotificationCallback(listenerBean.HandleNotification); emitter.RemoveNotificationListener(callback); }
/// <summary> /// This method is called by <see cref="SendNotification(Notification)"/> for each listener in order to send the notification to that /// listener. It can be overridden in subclasses to change the behavior of notification delivery, for /// instance to deliver the notification in a separate thread. /// </summary> /// <remarks> /// It is not guaranteed that this method is called by the same thread as the one that called /// <see cref="SendNotification(Notification)"/>. /// The default implementation of this method is equivalent to <code>callback(notification, handback);</code> /// </remarks> /// <param name="callback"></param> /// <param name="notification"></param> /// <param name="handback"></param> protected virtual void HandleNotification(NotificationCallback callback, Notification notification, object handback) { callback((Notification) notification.Clone(), handback); }
public void RequestTileUpdate(Uri channelUri, int count, NotificationCallback response) { BindLiveTile(); WebClient wc = new WebClient(); string uri = "http://winmilk.julianapena.com/send_push.php?device_url=" + Uri.EscapeUriString(channelUri.ToString()) + "&count=" + count; wc.DownloadStringCompleted += (s, e) => { if (e.Error != null) { SmartDispatcher.BeginInvoke(() => response("Error with push")); } else { SmartDispatcher.BeginInvoke(() => response(e.Result)); } }; wc.DownloadStringAsync(new Uri(uri)); }
public void RequestTileUpdate(Uri channelUri, NotificationCallback response) { int count = List.Count; RequestTileUpdate(channelUri, count, response); }
public void AddNotificationListener(NotificationCallback callback, NotificationFilterCallback filterCallback, object handback) { _notifEmitter.AddNotificationListener(callback, filterCallback, handback); }
public void RemoveNotificationListener(NotificationCallback callback) { _notifEmitter.RemoveNotificationListener(callback); }
public void RemoveNotificationListener(ObjectName name, NotificationCallback callback) { List<int> listenerGroup; if (_listenerGroupProxys.TryGetValue(callback, out listenerGroup)) { foreach (int listenerId in listenerGroup) { _connection.RemoveNotificationListener(_token, name, listenerId); NotificationSubscription key = _reverseListenerProxys[listenerId]; _reverseListenerProxys.Remove(listenerId); _listenerProxys.Remove(key); } _listenerGroupProxys.Remove(callback); } else { throw new ListenerNotFoundException(name.ToString()); } }
public static extern void SetCallback(NotificationCallback callback);