Esempio n. 1
0
 /// <summary>
 /// Creates a new Notification and returns it.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='newItem'>
 /// Definition of how the Notification will be created.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <NotificationModel> CreateAsync(this INotifications operations, NewNotificationModel newItem, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateWithHttpMessagesAsync(newItem, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Esempio n. 2
0
        private async Task CheckForFirstStartup(Settings settings)
        {
            await Task.Delay(1000);

            var list = await settings.GetAll();

            INotifications service = DependencyService.Get <INotifications>();

            if (list.Count == 0)
            {
                settings.IntervalHours = 3;
                settings.ScraperActive = true;
                await settings.Save();
            }
            else
            {
                settings = list[0];
            }
            if (settings.ScraperActive)
            {
                service.SaveSetting(settings.IntervalHours);
            }
            else
            {
                try
                {
                    service.StopNotifications();
                }
                catch (Exception) { }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Returns the SubscriptionId property for the Notification with the Id
 /// provided.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// Id of the Notification whose SubscriptionId property is to be returned.
 /// Must be double URL encoded.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <string> RetrieveSubscriptionIdAsync(this INotifications operations, string id, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.RetrieveSubscriptionIdWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
        public void SendEmail(INotifications notifications, EmailSettingsModel settings, AlertModel alert)
        {
            string subject = PutObjectInTemplate(alert, settings.Template.Subject);
            string body    = PutObjectInTemplate(alert, settings.Template.Body);

            notifications.SendEmail(settings.Sender, settings.Recipient, subject, body);
        }
Esempio n. 5
0
 /// <summary>
 /// Returns all Notification which fit the filter criteria supplied. All
 /// filter parameters are optional. Notification will be ordered and paged as
 /// requested.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// Return only Notification with this SubscriptionId value.
 /// </param>
 /// <param name='orderBy'>
 /// Notification will be returned in this order.  CreatedOnAscending by
 /// default. Possible values include: 'CreatedOnAscending',
 /// 'CreatedOnDescending'
 /// </param>
 /// <param name='take'>
 /// Number of Notification that should be returned.  200 by default.
 /// </param>
 /// <param name='skip'>
 /// Number of Notification that should be skipped before items are returned.
 /// 0 by default.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <NotificationModel> > RetrieveAsync(this INotifications operations, string subscriptionId = default(string), string orderBy = default(string), int?take = default(int?), int?skip = default(int?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.RetrieveWithHttpMessagesAsync(subscriptionId, orderBy, take, skip, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Esempio n. 6
0
 public WebSocketMiddleware(ILogger <WebSocketMiddleware> logger, ISubscriptions subscriptions, INotifications notifications, IWebsocketConnections connections)
 {
     this.subscriptions = subscriptions;
     this.notifications = notifications;
     this.logger        = logger;
     this.connections   = connections;
 }
Esempio n. 7
0
 /// <summary>
 /// Deletes the Notification with the Id provided.  All NotificationItems will
 /// also be deleted.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// Id of the Notification to be deleted.  Must be double URL encoded.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <object> DeleteAsync(this INotifications operations, string id, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.DeleteWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 public AccountController(INotifications notifications,
                          IUnitOfWork unitOfWork, CreateAccountCommand command,
                          IUsersRepository usersRepository) : base(notifications, unitOfWork)
 {
     _command         = command;
     _usersRepository = usersRepository;
 }
        public NotificationManager(IWindowMonitor windowMonitor, INotifications notifications)
        {
            _windowMonitor = windowMonitor ?? throw new ArgumentNullException(nameof(windowMonitor));
            _notifications = notifications ?? throw new ArgumentNullException(nameof(notifications));

            Subscribe();
        }
Esempio n. 10
0
        public void TriggerAlerts(INotifications notifications, SettingsModel settings, AlertModel alert)
        {
            if (settings.Sound.IsEnabled)
            {
                PlaySound(settings.Sound.FilePath);
            }

            AlertModel alertCopy = alert.Clone() as AlertModel;

            alertCopy.Price = Math.Round(alertCopy.Price, settings.Alerts.MaxPriceDecimalPlacesNumber);

            if (!alertCopy.Time.Offset.Equals(settings.Alerts.TimeZone.BaseUtcOffset))
            {
                alertCopy.Time = alert.Time.ToOffset(settings.Alerts.TimeZone.BaseUtcOffset);
            }

            if (settings.Email.IsEnabled)
            {
                SendEmail(notifications, settings.Email, alertCopy);
            }

            if (settings.Telegram.IsEnabled)
            {
                SendTelegramMessage(settings.Telegram, alertCopy);
            }
        }
 public ShoppingCartController(IShoppingCarts shoppingCarts, CachedProductCatalog catalog, INotifications notifications, ICartIdProvider cartIdProvider, ILogger logger) : base(logger)
 {
     this.shoppingCarts = shoppingCarts;
     this.catalog = catalog;
     this.notifications = notifications;
     this.cartIdProvider = cartIdProvider;
     this.logger = logger;
 }
 void SetActivationStage(INotifications notifs, ActivationStage newStage)
 {
     if (activationStage != newStage)
     {
         activationStage = newStage;
         OnActivationStageChanged(notifs);
     }
 }
Esempio n. 13
0
        public NotificationClient(LocalServiceFactory serviceFactory)
        {
            notifications = new Notifications(
                serviceFactory.EventAggregator,
                serviceFactory.NotificationFactory);

            windowManager = serviceFactory.NotificationWindowManager;
        }
Esempio n. 14
0
 public HubController(ILogger <HubController> logger, IBackgroundJobClient backgroundJobClient, ISubscriptions subscriptions, INotifications <HttpResponseMessage> notifications, IContexts contexts)
 {
     this.backgroundJobClient = backgroundJobClient ?? throw new ArgumentNullException(nameof(backgroundJobClient));
     this.logger        = logger ?? throw new ArgumentNullException(nameof(logger));
     this.subscriptions = subscriptions ?? throw new ArgumentNullException(nameof(subscriptions));
     this.notifications = notifications ?? throw new ArgumentNullException(nameof(notifications));
     this.contexts      = contexts ?? throw new ArgumentNullException(nameof(contexts));
 }
Esempio n. 15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.NotesPage);
            notifications  = new NotificationsAndroid(Assets, ApplicationContext);
            databaseHelper = new SQLiteAndroid(Assets);

            using (Button show = FindViewById <Button>(Resource.Id.button1))
            {
                show.Click += Show_Click;
            }

            List <Room>   rooms     = databaseHelper.ReadRoomsOnFloor(3);
            List <int>    roomsID   = new List <int>();
            List <string> roomsName = new List <string>();

            foreach (var item in rooms)
            {
                roomsName.Add(item.Name);
                roomsID.Add(item.ID);
            }
            rooms.Clear();

            using (Spinner spinner = FindViewById <Spinner>(Resource.Id.spinner1))
            {
                using (var ada = new ArrayAdapter(this, Resource.Layout.TextViewItem, roomsName.ToArray()))
                {
                    spinner.Adapter = ada;
                }
                spinner.ItemSelected += SpinnerRoom_ItemSelected;
            }
            using (Spinner spinner = FindViewById <Spinner>(Resource.Id.spinnerRoomID))
            {
                using (var ada = new ArrayAdapter(this, Resource.Layout.TextViewItem, roomsID.ToArray()))
                {
                    spinner.Adapter = ada;
                }
            }
            roomsID.Clear();
            roomsName.Clear();

            using (Button button = FindViewById <Button>(Resource.Id.button2))
            {
                button.Click += ButtonAdd_Click;
            }

            using (EditText timeOfNote = FindViewById <EditText>(Resource.Id.editTextTime))
            {
                timeOfNote.Text = DateTime.Now.ToString("HH:mm:ss");
            }
            using (EditText dateOfNote = FindViewById <EditText>(Resource.Id.editTextDate))
            {
                dateOfNote.Text = DateTime.Now.ToString("dd-MM-yyyy");
            }

            MakeList();
            SetFontSize();
        }
Esempio n. 16
0
        public Notifications()
        {
            if (!Bus.Session.NameHasOwner(busName))
            {
                Bus.Session.StartServiceByName(busName, 0);
            }

            proxy = Bus.Session.GetObject <INotifications> (busName, new ObjectPath(objectPath));
        }
Esempio n. 17
0
        public Notification()
        {
            nf = Global.DBusObject;

            nf.NotificationClosed += OnClosed;
            nf.ActionInvoked      += OnActionInvoked;

            this.app_name = Assembly.GetCallingAssembly().GetName().Name;
        }
 public AccountController(IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder, SignInManager <User> signInManager,
                          IEventPublisher publisher, INotifications platformNotificationApi, IOptions <StorefrontOptions> options)
     : base(workContextAccessor, urlBuilder)
 {
     _signInManager           = signInManager;
     _publisher               = publisher;
     _options                 = options.Value;
     _platformNotificationApi = platformNotificationApi;
 }
Esempio n. 19
0
 public ScoreQueue(IScoreFeed feed, Interpreter interpreter, INotifications notifications)
 {
     this.feed = feed;
     this.interpreter = interpreter;
     this.notifications = notifications;
     Tweets = new List<ScoreInfo>();
     Playlist = new List<ScoreInfo>();
     feed.Received += ScoreReceived;
 }
 protected void RaisePropertyChanged(INotifications notifs, string propertyName)
 {
     notifs.Notify(() =>
     {
         if (PropertyChanged != null)
         {
             PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
         }
     });
 }
        protected void ChangeAndNotifyProperty(INotifications notifs, string propertyName, object value)
        {
            var property = GetType().GetProperty(propertyName);

            if (value != property.GetValue(this))
            {
                SetPropertyValue(propertyName, value);
                RaisePropertyChanged(notifs, propertyName);
            }
        }
 protected void RaiseUpdated(INotifications notifs)
 {
     notifs.Notify(() =>
     {
         if (Updated != null)
         {
             Updated(this, EventArgs.Empty);
         }
     });
 }
Esempio n. 23
0
        public NotesPage()
        {
            notifications  = new NotificationsWindows();
            databaseHelper = new SQLiteWindows();
            this.InitializeComponent();

            this.navigationHelper            = new NavigationHelper(this);
            this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
            this.navigationHelper.SaveState += this.NavigationHelper_SaveState;
        }
Esempio n. 24
0
        public static void SetupNotification(string title, string message, DateTime executeTime, long requestId)
        {
            Debug.WriteLine("DHB:PlatformSpecificCalls setupNotification");
            INotifications ins = DependencyService.Get <INotifications>();

            if (ins != null)
            {
                ins.SetupNotification(title, message, executeTime, requestId);
                Debug.WriteLine("DHB:PlatformSpecificCalls setupNotification sent.");
            }
        }
Esempio n. 25
0
        public Notification()
        {
            nf = Global.DBusObject;

            nf.NotificationClosed += OnClosed;
            nf.ActionInvoked      += OnActionInvoked;

            var app_asm = Assembly.GetEntryAssembly() ?? Assembly.GetCallingAssembly();

            app_name = app_asm.GetName().Name;
        }
        /// <summary>
        ///   Send all SerializedNotification derived classes through this extension method
        /// </summary>
        public static Task ReceiveNotification(this INotifications receiver, SerializedNotification notification)
        {
            // TODO: unify with the startup code
            var serialized =
                JsonSerializer.Serialize(notification, new JsonSerializerOptions()
            {
                Converters = { Converter }
            });

            return(receiver.ReceiveNotificationJSON(serialized));
        }
 public NotificationsImpl()
 {
     if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0))
     {
         this.impl = new UNNotificationsImpl();
     }
     else
     {
         this.impl = new UILocalNotificationsImpl();
     }
 }
Esempio n. 28
0
 public ApiAccountController(IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder, UserManager <User> userManager, SignInManager <User> signInManager, IAuthorizationService authorizationService,
                             IMemberService memberService, IEventPublisher publisher, INotifications platformNotificationApi)
     : base(workContextAccessor, urlBuilder)
 {
     _userManager             = userManager;
     _memberService           = memberService;
     _publisher               = publisher;
     _platformNotificationApi = platformNotificationApi;
     _authorizationService    = authorizationService;
     _signInManager           = signInManager;
 }
        public TestViewModel(INotifications notifications, IApiService service)
        {
            _notifications = notifications;
            _service = service;

            _notifications.Registered += Registered;
            _notifications.Unregistered += UnRegistered;

            RegistrationId = _notifications.RegistrationId;
            if (!string.IsNullOrEmpty(RegistrationId))
                _service.TellApiAboutRegistrationAsync(RegistrationId);
        }
Esempio n. 30
0
        public DiagramExplorerViewModel(INotifications notifications, IDiagramIOService diagramIO,
                                        Func <Diagram, PreviewDiagramViewModel> previewDiagramFactory, ISettings settings, TaskScheduler uiScheduler)
            : this()
        {
            _notifications         = notifications;
            _diagramIO             = diagramIO;
            _previewDiagramFactory = previewDiagramFactory;
            _settings    = settings;
            _uiScheduler = uiScheduler;

            _diagramIO.DiagramFileDeleted += diagramIO_DiagramFileDeleted;
            _diagramIO.DiagramFileAdded   += diagramIO_DiagramFileAdded;
        }
        public TestViewModel(INotifications notifications, IApiService service)
        {
            _notifications = notifications;
            _service       = service;

            _notifications.Registered   += Registered;
            _notifications.Unregistered += UnRegistered;

            RegistrationId = _notifications.RegistrationId;
            if (!string.IsNullOrEmpty(RegistrationId))
            {
                _service.TellApiAboutRegistrationAsync(RegistrationId);
            }
        }
Esempio n. 32
0
        public HubController(ILogger <HubController> logger, IBackgroundJobClient backgroundJobClient, ISubscriptions subscriptions, INotifications notifications, IConfiguration config)
        {
            this.backgroundJobClient = backgroundJobClient;
            this.logger        = logger;
            this.subscriptions = subscriptions;
            this.notifications = notifications;
            this.settings      = config;
#if DEBUG
            this.connectionString = settings.GetConnectionString("Development");
#else
            this.connectionString = settings.GetConnectionString("Default");
#endif
            this.logger.LogInformation($"Using database connection string: {this.connectionString}");
        }
        public static void ShowPopup(this INotifications notifications, string timeFrame, string symbol, string type, string triggeredBy, double price, string comment, DateTimeOffset time)
        {
            AlertModel alert = new AlertModel
            {
                TimeFrame   = timeFrame,
                Symbol      = symbol,
                Price       = price,
                TriggeredBy = triggeredBy,
                Type        = type,
                Comment     = comment,
                Time        = time
            };

            ShowPopup(notifications, alert);
        }
Esempio n. 34
0
 public Configuration(IIntervals intervals, IThresholds thresholds, INotifications notifications)
 {
     Intervals = intervals;
     Thresholds = thresholds;
     Notifications = notifications;
 }
Esempio n. 35
0
        public Notification()
        {
            nf = Global.DBusObject;

            nf.NotificationClosed += OnClosed;
            nf.ActionInvoked += OnActionInvoked;

            this.app_name = Assembly.GetCallingAssembly().GetName().Name;
        }
Esempio n. 36
0
 public NotificationTask(IGeofenceManager geofences, INotifications notifications)
 {
     this.geofences = geofences;
     this.notifications = notifications;
 }
Esempio n. 37
0
        public Notifications()
        {
            if (!Bus.Session.NameHasOwner (busName))
                Bus.Session.StartServiceByName (busName, 0);

            proxy =  Bus.Session.GetObject<INotifications> (busName, new ObjectPath (objectPath));
        }
Esempio n. 38
0
		internal AutoPagedNotifications(INotifications trelloNotifications, int pageSize)
			: base(pageSize)
		{
			_trelloNotifications = trelloNotifications;			
		}
 public AuditableNotificatins(INotifications notifications)
 {
     this.notifications = notifications;
 }
Esempio n. 40
0
		public Notification () {
			nf = Global.DBusObject;

			nf.NotificationClosed += OnClosed;
			nf.ActionInvoked += OnActionInvoked;

			Assembly app_asm = Assembly.GetEntryAssembly ();

			if (app_asm == null) {
				app_asm = Assembly.GetCallingAssembly ();
			}

			this.app_name = app_asm.GetName ().Name;
		}
 public DefaultUsersService(INotifications notifications)
 {
     this.notifications = notifications;
 }