コード例 #1
0
        public override void OnRegisterNotification(ISymbol symbol, SymbolNotificationType type, INotificationSettings settings)
        {
            if (symbol == null)
            {
                throw new ArgumentNullException("symbol");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            NotificationSettings settings2 = null;

            if (!this._notificationTable.TryGetRegisteredNotificationSettings(symbol, out settings2))
            {
                this.RegisterNotification(symbol, type, (NotificationSettings)settings);
            }
            else if (settings2.CompareTo(settings) >= 0)
            {
                this.RegisterNotification(symbol, type, settings2);
            }
            else
            {
                this.UnregisterNotification(symbol, type);
                this.RegisterNotification(symbol, type, (NotificationSettings)settings);
            }
        }
コード例 #2
0
ファイル: Creator.cs プロジェクト: Mortens4444/VirtualWork
        public bool CheckExistence(NotificationSettings notificationSettings = NotificationSettings.ShowMessages)
        {
            try
            {
                if (repository.HasAny())
                {
                    if (notificationSettings == NotificationSettings.ShowMessages)
                    {
                        InfoBox.Show(ConnectionSuccessfulInfoTitle, ConnectionSuccessfulInfoMessage);
                    }
                }
                else
                {
                    do
                    {
#if DEBUG
                        CreateDefaultEntity();
#else
                        InfoBox.Show(CreateInfoTitle, CreateInfoMessage);
                        window.ShowDialog();
#endif
                    }while (!repository.HasAny());
                }
                return(true);
            }
            catch (Exception ex)
            {
                var details = new ExceptionDetails(ex).Details;
                ErrorBox.Show(CreationErrorTitle, String.Concat(CreationErrorMessage, Environment.NewLine, details));
            }
            return(false);
        }
コード例 #3
0
        public async Task <NotificationSettings> Add(NotificationSettings notificationSettings)
        {
            _context.NotificationSettings.Add(notificationSettings);
            await _context.SaveChangesAsync();

            return(await GetByUserId(notificationSettings.UserId));
        }
コード例 #4
0
        static void Main(string[] args)
        {
            Console.WriteLine(@"
This a very simple demo of how the NonHttpRunTimeRazorSupport library 
might be used to send emails outside of the context of a running
web application.

This app is configured to drop .eml files in the C:\temp folder (see 
app.config). These files can be viewed in an email client, or on a
web site like http://www.encryptomatic.com/viewer/Default.aspx");
            var settings = new NotificationSettings(new Uri("http://www.facepack.com/"));
            var service  = new EmailNotificationService(settings);

            do
            {
                var from  = new MailAddress("*****@*****.**");
                var to    = new MailAddress("*****@*****.**");
                var model = new WelcomeModel
                {
                    Name = "Dave"
                };
                service.Send(from, to, model);
                Console.WriteLine("Message sent. Press a key to resend, or q to exit");
            } while (Console.ReadKey().KeyChar != 'q');
        }
コード例 #5
0
        private static async Task <bool> SendGETUrl(NotificationSettings settings)
        {
            string response = await GetAsync(settings.GetURL);

            //Write some check
            return(true);
        }
コード例 #6
0
 public async Task <bool> UpdateNotificationSettings(int userId, NotificationSettings newSettings)
 {
     using (var db = _dbService.GetConnection())
     {
         return(await UpdateNotificationSettings(userId, newSettings, db));
     }
 }
コード例 #7
0
        /// <summary>
        /// Performs the sending of the mail
        /// </summary>
        /// <param name="settings">Settings object to use when sending</param>
        /// <param name="subject">Subject of the message</param>
        /// <param name="body">Body of the message</param>
        /// <returns>True if no exceptions thrown, otherwise false</returns>
        /// <remarks>
        /// NotificationSettings object is required to support
        /// alternative settings from Tools -> Options. Use
        /// Settings.Notifications unless using an alternative
        /// configuration.
        /// </remarks>
        private static void SendMail(NotificationSettings settings, string subject, string body)
        {
            // Trace something to the logs so we can identify the time the message was sent
            EveMonClient.Trace($"(Subject - {subject}; Server - {settings.EmailSmtpServerAddress}:{settings.EmailPortNumber})");

            string sender = string.IsNullOrEmpty(settings.EmailFromAddress)
                ? "*****@*****.**"
                : settings.EmailFromAddress;

            List <string> toAddresses = settings.EmailToAddress.Split(
                new[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();

            try
            {
                // Set up message
                s_mailMessage = new MailMessage();
                toAddresses.ForEach(address => s_mailMessage.To.Add(address.Trim()));
                s_mailMessage.From    = new MailAddress(sender);
                s_mailMessage.Subject = subject;
                s_mailMessage.Body    = body;

                // Set up client
                s_smtpClient = GetClient(settings);

                // Send message
                s_smtpClient.SendAsync(s_mailMessage, null);
            }
            catch (Exception e)
            {
                ExceptionHandler.LogException(e, true);
                MessageBox.Show(@"The message failed to send.", @"EVEMon Emailer Failure", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
            }
        }
コード例 #8
0
        public IHttpActionResult SetNotificationSettings(string id, string userId, NotificationSettings settings)
        {
            var project = GetModel(id, false);

            if (project == null)
            {
                return(NotFound());
            }

            if (!Request.IsGlobalAdmin() && !String.Equals(ExceptionlessUser.Id, userId))
            {
                return(NotFound());
            }

            if (settings == null)
            {
                project.NotificationSettings.Remove(userId);
            }
            else
            {
                project.NotificationSettings[userId] = settings;
            }

            _repository.Save(project, true);

            return(Ok());
        }
コード例 #9
0
        public static async Task <bool> SendNotification()
        {
            try
            {
                NotificationSettings settings = NotificationSettingsHelper.GetSettings();
                //Default is set to telegram for now
                switch (settings.NotificationMode)
                {
                case NotificationMode.Default:
                    return(await SendTelegram(settings));

                case NotificationMode.Telegram:
                    return(await SendTelegram(settings));

                case NotificationMode.GET:
                    return(await SendGETUrl(settings));
                }
            }
            catch (Exception ex)
            {
                Log.Write(LogType.Error, "Notification sending error", ex);
            }

            return(false);
        }
コード例 #10
0
        /// <summary>
        /// Gets the client.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <returns></returns>
        private static SmtpClient GetClient(NotificationSettings settings)
        {
            SmtpClient client = new SmtpClient
            {
                DeliveryMethod = SmtpDeliveryMethod.Network,
                Timeout        = (int)TimeSpan.FromSeconds(Settings.Updates.HttpTimeout).TotalMilliseconds,

                // Host and port
                Host = settings.EmailSmtpServerAddress,
                Port = settings.EmailPortNumber,

                // SSL
                EnableSsl = settings.EmailServerRequiresSsl
            };

            ServicePointManager.ServerCertificateValidationCallback = (s, certificate, chain, sslPolicyErrors) => true;

            client.SendCompleted += SendCompleted;

            if (!settings.EmailAuthenticationRequired)
            {
                return(client);
            }

            // Credentials
            client.UseDefaultCredentials = false;
            client.Credentials           = new NetworkCredential(settings.EmailAuthenticationUserName,
                                                                 Util.Decrypt(settings.EmailAuthenticationPassword,
                                                                              settings.EmailAuthenticationUserName));

            return(client);
        }
コード例 #11
0
        public async Task <bool> Update(NotificationSettings entity)
        {
            _context.NotificationSettings.Attach(entity);
            var changes = await _context.SaveChangesAsync();

            return(changes > 0);
        }
コード例 #12
0
        public void SavedValuesAreAppliedDuringConstruction()
        {
            // Arrange
            var notifi = new NotificationConfig
            {
                PopupEnabled  = true,
                SoundEnabled  = true,
                ToastsEnabled = true
            };

            var cfg = new Mock <IConfig>();

            cfg.SetupGet(c => c.Notifications).Returns(notifi);

            // Act
            var vm = new NotificationSettings(cfg.Object);

            // Assert
            var toast = vm.EnabledNotifications.OfType <ToastNotificationSettings>().SingleOrDefault();

            Assert.IsNotNull(toast);

            var sound = vm.EnabledNotifications.OfType <SoundNotificationSettings>().SingleOrDefault();

            Assert.IsNotNull(sound);

            var popup = vm.EnabledNotifications.OfType <PopupNotificationSettings>().SingleOrDefault();

            Assert.IsNotNull(popup);
        }
コード例 #13
0
ファイル: MailSending.cs プロジェクト: RedRevenge94/szh
 private void LoadConfiguration()
 {
     mailAddresFrom = NotificationSettings.GetSenderEmailAddress();
     password       = NotificationSettings.GetSenderEmailPassword();
     hostAddres     = NotificationSettings.GetSenderEmailHost();
     Int32.TryParse(NotificationSettings.GetSenderEmailHostPort(), out hostPort);
 }
コード例 #14
0
        public async Task <int> Create(NotificationSettings entity)
        {
            _context.NotificationSettings.Add(entity);
            await _context.SaveChangesAsync();

            return(entity.Id);
        }
コード例 #15
0
        public SumAddNotifications(IAdsConnection connection, uint[] variableHandles, int[] lengths, NotificationSettings settings, AdsStream stream) : base(connection, TwinCAT.Ads.SumCommand.SumCommand.SumCommandMode.AddDeviceNotification, TwinCAT.Ads.SumCommand.SumCommand.SumAccessMode.ValueByHandle)
        {
            if (connection == null)
            {
                throw new ArgumentNullException("connection");
            }
            if (variableHandles == null)
            {
                throw new ArgumentNullException("variableHandles");
            }
            if (lengths == null)
            {
                throw new ArgumentNullException("lengths");
            }
            if (variableHandles.Length != lengths.Length)
            {
                throw new ArgumentException("Handles/lenghts mismatch!");
            }
            int num = Enumerable.Max(lengths);

            if (stream.Length < num)
            {
                throw new ArgumentException("Notification Buffer/Stream is to small");
            }
            this._connection      = connection;
            this._variableHandles = variableHandles;
            this._variableLengths = lengths;
            this._settings        = settings;
            base.sumEntities      = this.CreateSumEntityInfos();
        }
コード例 #16
0
        public ActionResult Save(NotificationSettings model)
        {
            // get the notification settings back from the form and do something with them

            // return a thank you message
            return(this.View("~/Views/Home/NotificationSettingsTy.cshtml"));
        }
コード例 #17
0
        public ActionResult Notifications()
        {
            // read in the notification settings

            var model = new NotificationSettings()
            {
                ProjectFollows = new System.Collections.Generic.Dictionary <int, ProjectFollows>()
                {
                    { 21, new ProjectFollows()
                      {
                          Follows = true, ProjectName = "Revive West Pond"
                      } },
                    { 273, new ProjectFollows()
                      {
                          Follows = false, ProjectName = "Improve Hammersmith"
                      } },
                    { 374, new ProjectFollows()
                      {
                          Follows = true, ProjectName = "Help Newbury!"
                      } },
                },
                NotificationsAboutProjectsICreate = true,
                Newsletter = true,
                UpdatesFromMovementsImFollowing = false,
                UpdatesFromProjectsIlike        = false
            };

            return(this.View("~/Views/Home/NotificationSettings.cshtml", model));
        }
コード例 #18
0
 public NotificationHostedService(ILogger <NotificationHostedService> logger, IServiceScopeFactory scopeFactory,
                                  IOptions <NotificationSettings> notificationSettings)
 {
     _logger       = logger;
     _scopeFactory = scopeFactory;
     _settings     = notificationSettings.Value;
 }
コード例 #19
0
    // Use this for initialization
    void Start()
    {
        Pushwoosh.ApplicationCode  = "7559E-DE020";
        Pushwoosh.GcmProjectNumber = "747084596472";
        Pushwoosh.Instance.OnRegisteredForPushNotifications         += OnRegisteredForPushNotifications;
        Pushwoosh.Instance.OnFailedToRegisteredForPushNotifications += OnFailedToRegisteredForPushNotifications;
        Pushwoosh.Instance.OnPushNotificationsReceived += OnPushNotificationsReceived;
        Pushwoosh.Instance.OnPushNotificationsOpened   += OnPushNotificationsOpened;

        Pushwoosh.Instance.SetStringTag("UserName", "Alex");
        Pushwoosh.Instance.SetIntTag("Age", 42);
        Pushwoosh.Instance.SetListTag("Hobbies", new List <object> (new[] { "Football", "Tennis", "Fishing" }));

        Pushwoosh.Instance.SetBadgeNumber(0);

        Pushwoosh.Instance.SendPurchase("com.pushwoosh.Developer", 49.95, "USD");
        NotificationSettings notificationSettings = Pushwoosh.Instance.GetRemoteNotificationStatus();

        Debug.Log("Notification status enabled: " + notificationSettings.enabled
#if UNITY_IPHONE && !UNITY_EDITOR
                  + " alert: " + notificationSettings.pushAlert
                  + " badge: " + notificationSettings.pushBadge
                  + " sound: " + notificationSettings.pushSound
#endif
                  );

#if !UNITY_EDITOR
#if UNITY_IOS || UNITY_ANDROID
        Pushwoosh.Instance.SetUserId("%userId%");

        Dictionary <string, object> attributes = new Dictionary <string, object>()
        {
            { "attribute", "value" },
        };

        Pushwoosh.Instance.PostEvent("applicationOpened", attributes);

        AndroidSpecific.SetActive(true);
        string launchNotification = Pushwoosh.Instance.GetLaunchNotification();
        if (launchNotification == null)
        {
            launchNotificationString = "No launch notification";
        }
        else
        {
            launchNotificationString = launchNotification;
        }
#endif

#if UNITY_ANDROID
        Dictionary <string, string> parameters = new Dictionary <string, string>()
        {
            { "l", "https://www.pushwoosh.com/" },
            { "u", "custom data" }
        };

        Pushwoosh.Instance.ScheduleLocalNotification("Hello, Android!", 5, parameters);
#endif
#endif
    }
コード例 #20
0
        public async Task <IActionResult> ConfirmEmail([FromBody] ConfirmEmailRequest confirmEmailRequest, [FromServices] IEmailConfirmationService emailConfirmationService)
        {
            using (var repository = new Repository <User>(_provider)) {
                var user = await repository.Get(x => x.Id == confirmEmailRequest.UserId).SingleAsync();

                if (user.Confirmed.HasValue)
                {
                    return(Json(ApiResponse.Failed(ApiErrorCode.ValidationError, "Данная регистрация была подтверждена ранее")));
                }
                var result = emailConfirmationService.ValidateConfirmationCode(user, confirmEmailRequest.Code);
                if (result)
                {
                    var notificationSettingsRep = new Repository <NotificationSettings>(repository);
                    var notificationSettings    = new NotificationSettings {
                        DocumentReceived = true,
                        DocumentRejected = true,
                        DocumentRetired  = true,
                        DocumentSend     = true,
                        InviteSend       = true,
                        ProfileAdd       = true,
                        ProfileRemove    = true,
                        DocumentSign     = true,
                        User             = user
                    };
                    await notificationSettingsRep.InsertAsync(notificationSettings);

                    user.Confirmed = DateTime.Now;
                    repository.Update(user);
                    repository.Commit();
                }
                return(Json(ApiResponse.Success(result)));
            }
        }
コード例 #21
0
ファイル: MainController.cs プロジェクト: rzemcog/Uzhik
        public async Task <IActionResult> MonitorProduct(string id, NotificationSettings notificationSettings, string name, string page)
        {
            var user = await GetUser();

            var product = await _products.GetDocument(id);

            var monitoredProduct = user.MonitoredProducts.FirstOrDefault(m => m.ProductId == id);

            if (monitoredProduct == null)
            {
                user.MonitoredProducts.Add(new MonitoredProduct()
                {
                    ProductId = id, NotificationSettings = notificationSettings
                });
                product.Subscribers.Add(user.Id);
            }
            else
            {
                monitoredProduct.NotificationSettings = notificationSettings;
            }
            await _users.Update(user);

            await _products.Update(product);

            return(RedirectToAction("ShowProduct", new { name = name, page = page }));
        }
コード例 #22
0
        /// <summary>
        /// Inserts the specified notifications.
        /// </summary>
        /// <param name="users">The users.</param>
        /// <param name="userTriggerEvent">The user trigger event.</param>
        /// <param name="type">The type.</param>
        /// <param name="targetUrl">The target URL.</param>
        /// <param name="parameters">The parameters.</param>
        /// <param name="defaultFromName">The default from name.</param>
        /// <param name="defaultSubject">The default subject.</param>
        /// <param name="defaultMessage">The default message.</param>
        /// <returns>
        /// the task
        /// </returns>
        public async Task NewNotification(IList <User> users, User userTriggerEvent, NotificationType type, string targetUrl, IList <NotificationParameter> parameters, string defaultFromName, string defaultSubject, string defaultMessage)
        {
            Notification notification = null;

            if (type != NotificationType.Manual)
            {
                var notificationId = Convert.ToInt32(type);
                notification = this.GetCachedNotifications()
                               .FirstOrDefault(n => n.Id == notificationId);
            }

            var settings = new NotificationSettings()
            {
                BaseHtml        = this.generalSettings.BodyBaseHtml,
                DefaultFromName = defaultFromName,
                DefaultMessage  = defaultMessage,
                DefaultSubject  = defaultSubject,
                IsManual        = type == NotificationType.Manual,
                SiteUrl         = this.generalSettings.SiteUrl
            };

            await this.coreNotificationService.NewEmailNotification <EmailNotification>(
                users.Select(c => (IUserEntity)c).ToList(),
                userTriggerEvent,
                notification,
                targetUrl,
                parameters,
                settings);
        }
コード例 #23
0
 internal NotificationSymbolInfo(ISymbol symbol, int handle, SymbolNotificationType notificationType, NotificationSettings settings)
 {
     this.Symbol           = symbol;
     this.NotificationType = notificationType;
     this.Handle           = handle;
     this.Settings         = settings;
 }
コード例 #24
0
ファイル: MainController.cs プロジェクト: rzemcog/Uzhik
        public async Task <IActionResult> ShowProduct(string name, string page = "1")
        {
            var products = (await _products.GetFilteredCollection(new BsonDocument())).Where(p => (p.Name.ToLower()).Contains(name.ToLower())).ToArray();
            var user     = await GetUser();

            int pageInt = Convert.ToInt32(page);

            for (int index = (pageInt - 1) * 10; index < pageInt * 10 && index < products.Length; index++)
            {
                NotificationSettings notificationSettings = null;
                var monitoredProduct = user.MonitoredProducts.FirstOrDefault(p => p.ProductId == products[index].Id);
                if (monitoredProduct != null)
                {
                    notificationSettings = monitoredProduct.NotificationSettings;
                }
                notificationModel.Add(new NotificationSettingsModel()
                {
                    Product = products[index], NotificationSettings = notificationSettings
                });
            }
            ViewBag.Products    = notificationModel;
            ViewBag.RequestName = name;
            ViewBag.PagesCount  = Math.Ceiling(products.Count() / 10d);
            ViewBag.CurrentPage = pageInt;
            return(View("Index"));
        }
コード例 #25
0
ファイル: SettingsForm.cs プロジェクト: zhy1/evemu_crucible
        /// <summary>
        /// Populates the notifications from controls.
        /// </summary>
        /// <param name="notificationSettings">The notification settings.</param>
        private void PopulateNotificationsFromControls(out NotificationSettings notificationSettings)
        {
            notificationSettings = notificationsControl.Settings;
            notificationSettings.PlaySoundOnSkillCompletion = cbPlaySoundOnSkillComplete.Checked;

            notificationSettings.EmailToAddress   = tbToAddress.Text;
            notificationSettings.EmailFromAddress = tbFromAddress.Text;
            notificationSettings.EmailSmtpServer  = tbMailServer.Text;

            // Try and get a usable number out of the text box
            int emailPortNumber = notificationSettings.EmailPortNumber;

            if (Int32.TryParse(emailPortTextBox.Text, out emailPortNumber))
            {
                notificationSettings.EmailPortNumber = emailPortNumber;
            }
            // Failing that just set to the IANA assigned port for SMTP
            else
            {
                notificationSettings.EmailPortNumber = 25;
            }

            notificationSettings.EmailServerRequiresSSL      = cbEmailServerRequireSsl.Checked;
            notificationSettings.EmailAuthenticationRequired = cbEmailAuthRequired.Checked;
            notificationSettings.EmailAuthenticationUserName = tbEmailUsername.Text;
            notificationSettings.EmailAuthenticationPassword = tbEmailPassword.Text;
            notificationSettings.UseEmailShortFormat         = cbEmailUseShortFormat.Checked;
            notificationSettings.SendMailAlert = mailNotificationCheckBox.Checked;
        }
コード例 #26
0
 public FillStateService(IOptions <NotificationSettings> notificationSettings,
                         IDocumentStorageService documentStorageService, IEnumerable <INotificationStrategy> notificationStrategies)
 {
     _notificationSettings   = notificationSettings.Value;
     _documentStorageService = documentStorageService;
     _notificationStrategies = notificationStrategies;
 }
コード例 #27
0
        public async Task <bool> UpdateNotificationSettings(int userId, NotificationSettings newSettings)
        {
            using (var db = _dbService.GetConnection())
            {
                return((await db.ExecuteAsync(@"
Update Users
Set    NextNotificationUrgentStrings = Case When @NotifyUrgentStrings > 0 Then @now End,
       NextNotificationSuggestionsAwaitingApproval = Case When @NotifySuggestionsAwaitingApproval > 0 Then @now End,
       NextNotificationSuggestionsAwaitingReview = Case When @NotifySuggestionsAwaitingReview > 0 Then @now End,
       NextNotificationStringsPushedToTransifex = Case When @NotifyStringsPushedToTransifex > 0 Then @now End,
       NextNotificationSuggestionsApproved = Case When @NotifySuggestionsApproved > 0 Then @now End,
       NextNotificationSuggestionsRejected = Case When @NotifySuggestionsRejected > 0 Then @now End,
       NextNotificationSuggestionsReviewed = Case When @NotifySuggestionsReviewed > 0 Then @now End,
       NextNotificationSuggestionsOverriden = Case When @NotifySuggestionsOverriden > 0 Then @now End,
       NotificationsIntervalId = @NotificationsInterval,
       NotificationsIntervalValue = @NotificationsIntervalValue
Where  Id = @userId", new
                {
                    newSettings.NotifyUrgentStrings,
                    newSettings.NotifySuggestionsAwaitingApproval,
                    newSettings.NotifySuggestionsAwaitingReview,
                    newSettings.NotifyStringsPushedToTransifex,
                    newSettings.NotifySuggestionsApproved,
                    newSettings.NotifySuggestionsRejected,
                    newSettings.NotifySuggestionsReviewed,
                    newSettings.NotifySuggestionsOverriden,
                    newSettings.NotificationsInterval,
                    newSettings.NotificationsIntervalValue,
                    now = DateTime.UtcNow,
                    userId
                })) == 1);
            }
        }
コード例 #28
0
        public async Task <NotificationSettingResponse> UpdateUserNotificationSettingsAsync(NotificationSettingRequest notificationSettingRequest)
        {
            Ensure.That(notificationSettingRequest).IsNotNull();

            var member = await _memberService.GetMemberBySaasUserIdAsync(notificationSettingRequest.SaasUserId);

            if (member == null)
            {
                throw new NetKitChatNotFoundException("Requested member does not exist.");
            }

            var existingNotificationSettings = await UnitOfWork.NotificationSettingRepository.GetSettingsByMemberIdAsync(member.Id);

            if (existingNotificationSettings != null)
            {
                existingNotificationSettings = FillNotificationSettings(notificationSettingRequest.Key, notificationSettingRequest.Value, existingNotificationSettings);
                await UnitOfWork.NotificationSettingRepository.UpdateSettingsAsync(existingNotificationSettings);
            }
            else
            {
                var notificationSettings = new NotificationSettings
                {
                    Id       = Guid.NewGuid(),
                    MemberId = member.Id
                };

                notificationSettings = FillNotificationSettings(notificationSettingRequest.Key, notificationSettingRequest.Value, notificationSettings);
                await UnitOfWork.NotificationSettingRepository.AddSettingsAsync(notificationSettings);
            }

            var userNotificationSettings = await UnitOfWork.NotificationSettingRepository.GetSettingsByMemberIdAsync(member.Id);

            return(DomainModelsMapper.MapToNotificationSettingsResponse(userNotificationSettings));
        }
コード例 #29
0
        public string GetSoundPath(string status)
        {
            var prop = NotificationSettings.GetType().GetProperty(status + "SoundPath");
            var res  = (string)prop.GetValue(NotificationSettings, null);

            return(res);
        }
コード例 #30
0
        public void SetSoundPath(string status, string path)
        {
            PropertyInfo prop = NotificationSettings.GetType().GetProperty(status + "SoundPath");

            prop.SetValue(NotificationSettings, path, null);

            SaveConfiguration();
        }
コード例 #31
0
ファイル: NotificationProducer.cs プロジェクト: DM-TOR/nhin-d
 public NotificationProducer(NotificationSettings settings)
 {
     if (settings == null)
     {
         throw new ArgumentNullException("settings");
     }
     
     m_settings = settings;
 }
コード例 #32
0
ファイル: Extensions.cs プロジェクト: DM-TOR/nhin-d
 /// <summary>
 /// TimelyAndReliable option set and message is not requesting timely and reliable then false.
 /// Always option will return true.
 /// Not other options exist.
 /// </summary>
 /// <param name="message"></param>
 /// <param name="settings"></param>
 /// <returns></returns>
 /// <remarks>
 /// Remember TimelyAndReliable option is the default if not configured.  This means a edge 
 /// client must request timely and reliable delivery.
 /// </remarks>
 public static bool ShouldDeliverFailedStatus(this MessageEnvelope message, NotificationSettings settings)
 {
     if (settings.AutoDsnFailureOption == NotificationSettings.AutoDsnOption.TimelyAndReliable
            && !message.Message.IsTimelyAndReliable())
     {
         return false;
     }
     return true;
 }
コード例 #33
0
ファイル: Announcer.cs プロジェクト: TheByte/sones
        /// <summary>
        /// the constructor, you can have as much Announcers as you need to announce all the services you have
        /// </summary>
        public Announcer(String _ServiceGlobalUniqueName, Uri _ServiceUri, DiscoverableServiceType _ServiceType)
        {
            Debug.WriteLine("[Announcer] Service Announcer is starting up for Service "+_ServiceGlobalUniqueName+" !");

            _internalServiceGlobalUniqueName = _ServiceGlobalUniqueName;
            ServiceUri = _ServiceUri;
            ServiceType = _ServiceType;

            NotificationSettings NotificationSettings = new NotificationSettings();
            NotificationSettings.StartBrigde = true;
            _NotificationDispatcher = new NotificationDispatcher(new UUID("ServiceDiscovery_Announcement"), NotificationSettings);

            //// Start the Housekeeper Thread which gets rid of timeouted known services
            Thread Announcer_Thread = new Thread(new ThreadStart(AnnouncerThread));
            Announcer_Thread.Name = "Announcer.AnnouncerThread()";
            Announcer_Thread.Start();
            Debug.WriteLine("[Announcer] Service Announcer is up and running for Service " + _ServiceGlobalUniqueName + " !");
        }
コード例 #34
0
ファイル: Discovery.cs プロジェクト: TheByte/sones
        /// <summary>
        /// This is the constructor of the discovery class. Use the AddDiscoverableService method to
        /// add Services which shall be discovered.
        /// </summary>
        public Discovery()
        {
            Debug.WriteLine("[Discovery] Service Discovery is starting up!");
            KnownServices = new Dictionary<string, DiscoveredService>();

            NotificationSettings NotificationSettings = new NotificationSettings();
            NotificationSettings.StartBrigde = true;

            _NotificationDispatcher = new NotificationDispatcher(new UUID("ServiceDiscovery_Discovery"), NotificationSettings);

            // Start the Housekeeper Thread which gets rid of timeouted known services
            Thread Housekeeper_Thread = new Thread(new ThreadStart(HousekeeperThread));
            Housekeeper_Thread.IsBackground = true;
            Housekeeper_Thread.SetApartmentState(ApartmentState.STA);
            Housekeeper_Thread.Start();

            //_NotificationDispatcher.RegisterRecipient(new NSD(), this);
            Debug.WriteLine("[Discovery] Service Discovery is up and running!");
        }