public Boolean RequestAudioResources (INotificationReceiver parent) { listener = new FocusChangeListener (parent); var ret = audioManager.RequestAudioFocus (listener, Stream.Music, AudioFocus.Gain); if (ret == AudioFocusRequest.Granted) { return (true); } else if (ret == AudioFocusRequest.Failed) { return (false); } return (false); }
public Boolean RequestAudioResources(INotificationReceiver parent) { listener = new FocusChangeListener(parent); var ret = audioManager.RequestAudioFocus(listener, Stream.Music, AudioFocus.Gain); if (ret == AudioFocusRequest.Granted) { return(true); } else if (ret == AudioFocusRequest.Failed) { return(false); } return(false); }
// potentially use autofac to configure the correct notify/story providers static void Main() { _notificationReceiver = new GrowlNotification(); // extract configuration logic and validate var diffbottoken = ConfigurationManager.AppSettings["diffbottoken"]; //var proxy = ConfigurationManager.AppSettings["proxy"]; //var port = int.Parse(ConfigurationManager.AppSettings["port"]); //_storyProvider = new DiffbotStoryProvider(proxy, port, diffbottoken) { NumberOfStories = 10 }; _storyProvider = new DiffbotStoryProvider(diffbottoken) { NumberOfStories = 10 }; CheckStories(); var updateTime = DateTime.Now.AddMinutes(Interval); while(true) { if (DateTime.Now <= updateTime) continue; CheckStories(); updateTime = DateTime.Now.AddMinutes(Interval); } }
void startOperation(INotificationReceiver nRec) { if (useNotifications) { bool haveFocus = nMan.RequestAudioResources(nRec); if (haveFocus) { status.Text = "Granted"; nRec.Start(); } else { status.Text = "Denied"; } } else { nRec.Start(); } }
private async Task StartOperationAsync(INotificationReceiver nRec) { if (UseNotifications) { bool haveFocus = nMan.RequestAudioResources(nRec); if (haveFocus) { // status.Text = "Granted"; await nRec.StartAsync(); } else { //status.Text = "Denied"; } } else { await nRec.StartAsync(); } }
private bool IsPlayServicesAvailable(INotificationReceiver receiver) { int resultCode = GoogleApiAvailability.Instance.IsGooglePlayServicesAvailable(this); if (resultCode != ConnectionResult.Success) { if (GoogleApiAvailability.Instance.IsUserResolvableError(resultCode)) { receiver.RaiseErrorReceived(GoogleApiAvailability.Instance.GetErrorString(resultCode)); } else { receiver.RaiseErrorReceived("This device is not supported"); Finish(); } return(false); } else { receiver.RaiseNotificationReceived("Google Play Services is available."); return(true); } }
public TcAdsSyncPort CreateSyncPort(AmsAddress addr, INotificationReceiver iNoteReceiver, bool clientCycle, bool synchronize) { object obj2 = s_instLock; lock (obj2) { TcAdsSyncPort target = !this._routerPort ? new TcAdsSyncPort(addr, this, iNoteReceiver, clientCycle, synchronize) : new TcAdsSyncPortRouter(addr, this, iNoteReceiver, clientCycle, synchronize); target.Connect(); WeakReference reference = new WeakReference(target, false); this._syncPortDict.Add(target.Id, reference); object[] args = new object[] { target.Id }; Module.Trace.TraceVerbose("SyncPort {0} added!", args); this.AddRef(); if (!this._routerNotificationsRegistered && (this._routerNotificationTimer == null)) { this._routerNotificationTimer = new ThreadTimer(); this._routerNotificationTimer.Interval = 50; this._routerNotificationTimer.Tick += new EventHandler(this._routerNotificationTimer_Tick); this._routerNotificationTimer.Enabled = true; } return(target); } }
public NotificationsCmd(INotificationReceiver receiver) { Receiver = receiver; }
public FocusChangeListener(INotificationReceiver parent) { this.parent = parent; }
async Task startOperationAsync (INotificationReceiver nRec) { if (useNotifications) { bool haveFocus = nMan.RequestAudioResources (nRec); if (haveFocus) { status.Text = "Granted"; await nRec.StartAsync (); } else { status.Text = "Denied"; } } else { await nRec.StartAsync (); } }
public void AddNotificationReceiver(INotificationReceiver notificationReceiver, Func <Notification, Task <bool> > notificationFilter = null, int priority = 0) => AddEnvelopeReceiver(_notificationReceivers, () => notificationReceiver, notificationFilter, priority);
public void Subscribe(INotificationReceiver receiver, Type notificationType) { }
async Task startOperationAsync(INotificationReceiver nRec) { await nRec.StartAsync(); }
public void AddNotificationReceiver(INotificationReceiver notificationReceiver, Func <Notification, Task <bool> > notificationFilter, int priority = 0) { Listener.AddNotificationReceiver(notificationReceiver, notificationFilter, priority); }
public TcAdsSyncPort CreateSyncPort(int port, INotificationReceiver iNoteReceiver, bool clientCycle, bool synchronize) => this.CreateSyncPort(new AmsAddress(base.address.NetId, port), iNoteReceiver, clientCycle, synchronize);
/// <summary> /// Add a notification receiver for messages that satisfy the given filter criteria /// </summary> /// <param name="listener">The listener to add the receivers to</param> /// <param name="notificationReceiver">The notification receiver that will be invoked when a notification that satisfy the given criteria is received</param> /// <param name="notificationFilter">The criteria to filter the notifications</param> public static void AddNotificationReceiver(this IMessagingHubListener listener, INotificationReceiver notificationReceiver, Func <Notification, Task <bool> > notificationFilter) { listener.AddNotificationReceiver(notificationReceiver, notificationFilter); }
/// <summary> /// Add a notification receiver for the given event type /// </summary> /// <param name="listener">The listener to add the receivers to</param> /// <param name="notificationReceiver">The notification receiver that will be invoked when a notification of the given event type is received</param> /// <param name="forEventType">The event type used to filter the received notifications</param> public static void AddNotificationReceiver(this IMessagingHubListener listener, INotificationReceiver notificationReceiver, Event?forEventType = null) { listener.AddNotificationReceiver(notificationReceiver, n => Task.FromResult(forEventType == null || n.Event == forEventType)); }
public async Task NotifyAsync(INotificationReceiver receiver, NotificationContent content) { await Task.FromResult(0); throw new NotImplementedException(); }
public NotificationSender(INotificationReceiver receiver) { this.receiver = receiver; serializer = new XmlNotificationSerializer(); }
public Item(INotificationReceiver notificationReceiver) { usable = true; this.notificationReceiver = notificationReceiver; }
void stopOperation(INotificationReceiver nRec) { nRec.Stop(); }
public void AddNotificationReceiver(INotificationReceiver notificationReceiver, Func <Notification, Task <bool> > notificationFilter, int priority = 0) { EnvelopeManager.AddNotificationReceiver(() => notificationReceiver, notificationFilter, priority); }
public void Unsubscribe(INotificationReceiver receiver) { }
internal void RemoveNotificationReceiver(INotificationReceiver receiver) { PlayableOutputHandle.RemoveNotificationReceiver_Injected(ref this, receiver); }
public static void Notify(INotificationChannel channel, INotificationReceiver receiver, NotificationContent content) { channel.Notify(receiver, content); }
private static extern void RemoveNotificationReceiver_Injected(ref PlayableOutputHandle _unity_self, INotificationReceiver receiver);
void stopOperation (INotificationReceiver nRec) { nRec.Stop (); if (useNotifications) { nMan.ReleaseAudioResources (); status.Text = "Released"; } }
public FocusChangeListener (INotificationReceiver parent) { this.parent = parent; }
extern internal void AddNotificationReceiver(INotificationReceiver receiver);
public void Subscribe(INotificationReceiver receiver, Type notificationType) { lock (m_SyncLock) { m_NotificationReceivers.Add(new Tuple<INotificationReceiver, Type>(receiver, notificationType)); } }
public TcAdsSyncPortRouter(AmsAddress addr, TcLocalSystem localSystem, INotificationReceiver iNoteReceiver, bool clientCycle, bool synchronize) : base(addr, localSystem, iNoteReceiver, clientCycle, synchronize) { Module.Trace.TraceVerbose($"ID: ({base.Id:d})"); }
async Task StartOperationAsync(INotificationReceiver nRec) { //if (useNotifications) //{ // bool haveFocus = nMan.RequestAudioResources(nRec); // if (haveFocus) // { // status.Text = "Granted"; // await nRec.StartAsync(); // } // else // { // status.Text = "Denied"; // } //} //else //{ await nRec.StartAsync(); //} }
void StopOperation(INotificationReceiver nRec) { nRec.Stop(); //if (useNotifications) //{ // nMan.ReleaseAudioResources(); // status.Text = "Released"; //} }
extern internal void RemoveNotificationReceiver(INotificationReceiver receiver);
public static void RemoveNotificationReceiver <U>(this U output, INotificationReceiver receiver) where U : struct, IPlayableOutput { output.GetHandle().RemoveNotificationReceiver(receiver); }
public void Unsubscribe(INotificationReceiver receiver) { lock (m_SyncLock) { for (int i = m_NotificationReceivers.Count - 1; i >= 0; i--) { if (object.Equals(m_NotificationReceivers[i].Item1, receiver)) m_NotificationReceivers.RemoveAt(i); } } }
public Notification(IPlatformNotificationBuilder builder, INotificationReceiver notificationReceiver, IPermission permission) => (this.builder, this.notificationReceiver, this.permission) = (builder, notificationReceiver, permission);