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);
		}
Пример #2
0
        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);
        }
Пример #3
0
        // 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);
            }
        }
Пример #4
0
 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();
     }
 }
Пример #5
0
 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);
            }
        }
Пример #7
0
        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);
            }
        }
Пример #8
0
 public NotificationsCmd(INotificationReceiver receiver)
 {
     Receiver = receiver;
 }
 public FocusChangeListener(INotificationReceiver parent)
 {
     this.parent = parent;
 }
Пример #10
0
		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 ();
			}
		}
Пример #11
0
 public void AddNotificationReceiver(INotificationReceiver notificationReceiver, Func <Notification, Task <bool> > notificationFilter = null, int priority = 0)
 => AddEnvelopeReceiver(_notificationReceivers, () => notificationReceiver, notificationFilter, priority);
Пример #12
0
 public void Subscribe(INotificationReceiver receiver, Type notificationType)
 {
 }
Пример #13
0
 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);
 }
Пример #15
0
 public TcAdsSyncPort CreateSyncPort(int port, INotificationReceiver iNoteReceiver, bool clientCycle, bool synchronize) =>
 this.CreateSyncPort(new AmsAddress(base.address.NetId, port), iNoteReceiver, clientCycle, synchronize);
Пример #16
0
 /// <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);
 }
Пример #17
0
 /// <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();
        }
Пример #19
0
 public void Subscribe(INotificationReceiver receiver, Type notificationType)
 {
 }
Пример #20
0
 public NotificationSender(INotificationReceiver receiver)
 {
     this.receiver = receiver;
     serializer    = new XmlNotificationSerializer();
 }
Пример #21
0
 public Item(INotificationReceiver notificationReceiver)
 {
     usable = true;
     this.notificationReceiver = notificationReceiver;
 }
Пример #22
0
 void stopOperation(INotificationReceiver nRec)
 {
     nRec.Stop();
 }
Пример #23
0
 public void AddNotificationReceiver(INotificationReceiver notificationReceiver, Func <Notification, Task <bool> > notificationFilter, int priority = 0)
 {
     EnvelopeManager.AddNotificationReceiver(() => notificationReceiver, notificationFilter, priority);
 }
Пример #24
0
 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);
Пример #28
0
		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);
Пример #31
0
 public void Subscribe(INotificationReceiver receiver, Type notificationType)
 {
     lock (m_SyncLock)
     {
         m_NotificationReceivers.Add(new Tuple<INotificationReceiver, Type>(receiver, notificationType));
     }
 }
Пример #32
0
 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})");
 }
Пример #33
0
 public void Unsubscribe(INotificationReceiver receiver)
 {
 }
Пример #34
0
 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();
     //}
 }
Пример #35
0
 void StopOperation(INotificationReceiver nRec)
 {
     nRec.Stop();
     //if (useNotifications)
     //{
     //    nMan.ReleaseAudioResources();
     //    status.Text = "Released";
     //}
 }
 extern internal void RemoveNotificationReceiver(INotificationReceiver receiver);
Пример #37
0
 public static void RemoveNotificationReceiver <U>(this U output, INotificationReceiver receiver) where U : struct, IPlayableOutput
 {
     output.GetHandle().RemoveNotificationReceiver(receiver);
 }
Пример #38
0
 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);
         }
     }
 }
Пример #39
0
 public Notification(IPlatformNotificationBuilder builder, INotificationReceiver notificationReceiver, IPermission permission)
 => (this.builder, this.notificationReceiver, this.permission) = (builder, notificationReceiver, permission);