/// <summary>
 /// Creates a new monitor.
 /// </summary>
 /// <param name="input">Input features and labels.</param>
 /// <param name="convergenceDelta">Criteria of convergence. When two subsequent cost function values
 /// don't differ by more than the given delta, we can say that the Gradient Descent has converged.</param>
 /// <param name="mode">Monitor mode - defines how the monitor would notify about cost function problems.</param>
 public CostFunctionMonitor(Input input, double convergenceDelta = 0.000001, NotificationMode mode = NotificationMode.Throw)
 {
     _input = input;
     _convergenceDelta = convergenceDelta;
     _mode = mode;
     _iterationCounter = 0;
 }
Exemple #2
0
 public Event(int id, string name, DateTime?startTime, DateTime?endTime, string notes, Status status, User user, Contact contact, RepeatMode repeatMode, NotificationMode notificationMode) : base(id, name, endTime, notes, status, user)
 {
     StartTime        = startTime;
     Contact          = contact;
     RepeatMode       = repeatMode;
     NotificationMode = notificationMode;
 }
        public Notification(NotificationMode mode, string HelpLink, string Topic, string Information)
        {
            InitializeComponent();
            switch (mode)
            {
            case NotificationMode.BlueMode:
                BackColor = Color.DeepSkyBlue;
                break;

            case NotificationMode.OrangeMode:
                BackColor = Color.Orange;
                break;

            case NotificationMode.GreenMode:
                BackColor = Color.LimeGreen;
                break;
            }

            HelpLinking = HelpLink;

            label1.Text = Topic.ToString();
            label2.Text = Information.ToString();

            int possiblex = Screen.PrimaryScreen.WorkingArea.Width;
            int possibley = Screen.PrimaryScreen.WorkingArea.Height;

            possiblex = possiblex - (Width + 10);
            possibley = possibley - (Height + 10);

            Location = new Point(possiblex, possibley);
        }
Exemple #4
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value != null)
     {
         NotificationMode mode = (NotificationMode)value;
         if (mode == NotificationMode.DoNotNotify)
         {
             return("Не напоминать");
         }
         else if (mode == NotificationMode.NotifyDayBefore)
         {
             return("За день");
         }
         else if (mode == NotificationMode.NotifyHourBefore)
         {
             return("за час");
         }
         else if (mode == NotificationMode.NotifyThreeDaysBefore)
         {
             return("За три дня");
         }
         else if (mode == NotificationMode.NotifyThreeHoursBefore)
         {
             return("За три часа");
         }
         else
         {
             return(null);
         }
     }
     else
     {
         return(null);
     }
 }
        public void AddNotification(string message, NotificationMode mode)
        {
            _notifications.Add(new NotificationItemViewModel(this)
            {
                Message = message
            });
            switch (mode)
            {
            case NotificationMode.Normal:
                _notifications.Last().Mode = MaterialDesignThemes.Wpf.ColorZoneMode.PrimaryMid;
                break;

            case NotificationMode.Success:
                _notifications.Last().Mode = MaterialDesignThemes.Wpf.ColorZoneMode.Accent;
                break;

            case NotificationMode.Error:
                _notifications.Last().Mode = MaterialDesignThemes.Wpf.ColorZoneMode.Inverted;
                break;
            }
            if (_autoRemove == null)
            {
                _autoRemove = Task.Run(AutoRemove);
            }
        }
 /// <summary>
 /// Creates a new monitor.
 /// </summary>
 /// <param name="input">Input features and labels.</param>
 /// <param name="convergenceDelta">Criteria of convergence. When two subsequent cost function values
 /// don't differ by more than the given delta, we can say that the Gradient Descent has converged.</param>
 /// <param name="mode">Monitor mode - defines how the monitor would notify about cost function problems.</param>
 public CostFunctionMonitor(Input input, double convergenceDelta = 0.000001, NotificationMode mode = NotificationMode.Throw)
 {
     _input            = input;
     _convergenceDelta = convergenceDelta;
     _mode             = mode;
     _iterationCounter = 0;
 }
        private bool UseNotificationMode(bool generic)
        {
            var flag = generic
                ? NotificationCollectionMode.GenericCollectionInterfaceUseNotificationValue
                : NotificationCollectionMode.CollectionIntefaceUseNotificationValue;

            if (!NotificationMode.HasFlagEx(flag))
            {
                return(false);
            }
            return(!NotificationMode.HasFlagEx(NotificationCollectionMode.OnlyOnUiThread) || ThreadManager.IsUiThread);
        }
Exemple #8
0
        /// <summary>
        /// Sends a NotificationPackage to all clients.
        /// </summary>
        /// <param name="mode">The Mode.</param>
        /// <param name="connections">The ConnectionParams.</param>
        private void SendNotificationPackage(NotificationMode mode, IConnection[] connections)
        {
            var notificationPackage = new NotificationPackage(connections, mode);

            for (int i = 0; i <= _connections.Count - 1; i++)
            {
                NetworkStream networkStream = _connections[i].Client.GetStream();
                PackageSerializer.Serialize(notificationPackage, networkStream);
                //May not be neccessary
                networkStream.Flush();
            }
        }
Exemple #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyStrategy"/> class.
        /// </summary>
        /// <param name="definition">The property definition.</param>
        /// <param name="mode">Explicit/implicit mode.</param>
        /// <param name="defaultStyle">The notification style that will be used if none is specified.</param>
        /// <param name="target">Notificaiton target method.</param>
        public PropertyStrategy(PropertyDefinition definition, NotificationMode mode,
                                NotificationStyle defaultStyle, MethodReference target)
        {
            this.Property     = definition;
            this.NotifyValues = GetNotifyPropertyNames(definition, mode).ToArray();
            this.IsIgnored    = !NotifyValues.Any() || Property.SetMethod == null;

            if (!this.IsIgnored)
            {
                this.NotifyTarget           = target;
                this.NotifyTargetDefinition = target.Resolve();
                this.NotificationStyle      = GetNotificationStyle(definition) ?? defaultStyle;
                this.ImplementationStyle    = this.NotificationStyle == NotificationStyle.OnChange || IsComplex(definition) ? ImplementationStyle.Wrapped : ImplementationStyle.Inline;
            }
        }
 /// <summary>
 /// Generates and sends a report and fill the message body
 /// depending on the notification mode chosen
 /// </summary>
 public void SendReport(NotificationMode notificationMode, string surveyTitle, string emailFrom, string emailTo, string emailSubject)
 {
     IEmailing emailing = EmailingFactory.Create();
     EmailingMessage mail = new EmailingMessage();
     mail.FromEmail = emailFrom;
     if ((notificationMode == NotificationMode.EntryReport) || (notificationMode == NotificationMode.OnlyAnswersReport))
     {
         mail.Body = this.GenerateTextReport(notificationMode == NotificationMode.OnlyAnswersReport);
     }
     else
     {
         mail.Body = ResourceManager.GetString("ShortNotificationMessage");
     }
     mail.Subject = (emailSubject == null) ? string.Format(ResourceManager.GetString("NotificationSubject"), surveyTitle) : emailSubject;
     mail.ToEmail = emailTo;
     emailing.SendEmail(mail);
 }
Exemple #11
0
        /// <summary>
        /// Generates and sends a report and fill the message body
        /// depending on the notification mode chosen
        /// </summary>
        public void SendReport(NotificationMode notificationMode, string surveyTitle, string emailFrom, string emailTo, string emailSubject)
        {
            IEmailing       emailing = EmailingFactory.Create();
            EmailingMessage mail     = new EmailingMessage();

            mail.FromEmail = emailFrom;
            if ((notificationMode == NotificationMode.EntryReport) || (notificationMode == NotificationMode.OnlyAnswersReport))
            {
                mail.Body = this.GenerateTextReport(notificationMode == NotificationMode.OnlyAnswersReport);
            }
            else
            {
                mail.Body = ResourceManager.GetString("ShortNotificationMessage");
            }
            mail.Subject = (emailSubject == null) ? string.Format(ResourceManager.GetString("NotificationSubject"), surveyTitle) : emailSubject;
            mail.ToEmail = emailTo;
            emailing.SendEmail(mail);
        }
    public void ShowMessage(string message,
                            float duration = 3.0f,
                            float delay    = 0,
                            NotificationMode notificationMode = NotificationMode.FadeInOut,
                            System.Action onComplete          = null)
    {
        ShowGUI();
        onMessageFinished = onComplete;

        notificationText.gameObject.SetActive(true);
        notificationText.text    = message;
        notificationRestDuration = duration;
        this.notificationMode    = notificationMode;

        if (notificationTween != null)
        {
            notificationTween.destroy();
            notificationTween = null;
        }

        if (notificationMode == NotificationMode.FadeOut)
        {
            notification       = 1;
            notificationStatus = NotificationStatus.Showing;
            OnMessageMovedIn();
        }
        else
        {
            notification      = 0;
            notificationTween = Go.to(this, kMessageInDuration, new GoTweenConfig()
                                      .floatProp("notification", 1)
                                      .setDelay(delay)
                                      .onComplete(t => { OnMessageMovedIn(); notificationTween = null; }));
            notificationStatus = NotificationStatus.MovingIn;
        }
    }
 protected Notification(NotificationMode mode)
 {
     Mode = mode;
 }
 private void removeNotificationMode(NotificationMode mode)
 {
     removeNotificationMode(new[] { mode });
 }
Exemple #15
0
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param>
 /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param>
 /// <param name="formatProvider">not used by this TypeConverter.</param>
 /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param>
 /// <returns>
 /// an instance of <see cref="NotificationMode" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => NotificationMode.CreateFrom(sourceValue);
Exemple #16
0
 /// <summary>
 /// Sends a NotificationPackage to all clients.
 /// </summary>
 /// <param name="mode">The Mode.</param>
 /// <param name="connections">The ConnectionParams.</param>
 private void SendNotificationPackage(NotificationMode mode, IConnection[] connections)
 {
     var notificationPackage = new NotificationPackage(connections, mode);
     for (int i = 0; i <= _connections.Count - 1; i++)
     {
         NetworkStream networkStream = _connections[i].Client.GetStream();
         PackageSerializer.Serialize(notificationPackage, networkStream);
         //May not be neccessary
         networkStream.Flush();
     }
 }
Exemple #17
0
        /// <summary>
        /// Sends a NotificationPackage to all clients.
        /// </summary>
        /// <param name="mode">The Mode.</param>
        /// <param name="connections">The ConnectionParams.</param>
        private void SendNotificationPackage(NotificationMode mode, IConnection[] connections)
        {
            var notificationPackage = new NotificationPackage(connections, mode);

            Send(notificationPackage);
        }
Exemple #18
0
 /// <summary>
 /// Sends a NotificationPackage to all clients.
 /// </summary>
 /// <param name="mode">The Mode.</param>
 /// <param name="connections">The ConnectionParams.</param>
 private void SendNotificationPackage(NotificationMode mode, IConnection[] connections)
 {
     var notificationPackage = new NotificationPackage(connections, mode);
     Send(notificationPackage);
 }
 /// <summary>
 /// Initializes a new NotificationPackage class.
 /// </summary>
 /// <param name="connection">The Connection.</param>
 /// <param name="mode">The NotificationMode.</param>
 public NotificationPackage(IConnection[] connection, NotificationMode mode)
 {
     Connection = connection;
     Mode = mode;
 }
 /// <summary>
 /// Initializes a new NotificationPackage class.
 /// </summary>
 /// <param name="connection">The Connection.</param>
 /// <param name="mode">The NotificationMode.</param>
 public NotificationPackage(IConnection[] connection, NotificationMode mode)
 {
     Connection = connection;
     Mode       = mode;
 }
 /// <summary>
 /// Retrieve all survey data from the db
 /// </summary>
 protected virtual void GetSurveyData()
 {
     SurveyData surveyById = new Surveys().GetSurveyById(this.SurveyId, this.LanguageCode);
     this._surveyRow = surveyById.Surveys[0];
     this._surveyTitle = this._surveyRow.Title;
     this._redirectionURL = this._surveyRow.RedirectionURL;
     this._unAuthentifiedUserAction = (UnAuthentifiedUserAction)this._surveyRow.UnAuthentifiedUserActionID;
     this._enableNavigation = this._surveyRow.NavigationEnabled;
     this._progressMode = (ProgressDisplayMode)this._surveyRow.ProgressDisplayModeID;
     this._notificationMode = (NotificationMode)this._surveyRow.NotificationModeID;
     this._resumeMode = (ResumeMode)this._surveyRow.ResumeModeID;
     this._emailFrom = this._surveyRow.EmailFrom;
     this._emailTo = this._surveyRow.EmailTo;
     this._emailSubject = this._surveyRow.EmailSubject;
     this._isScored = this._surveyRow.Scored;
     this._showQuestionNumbers = !this._surveyRow.QuestionNumberingDisabled;
     this._multiLanguageMode = (MultiLanguageMode)this._surveyRow.MultiLanguageModeId;
     this._languageVariable = this._surveyRow.MultiLanguageVariable;
     this.TotalPageNumber = this._surveyRow.TotalPageNumber;
     if ((this._surveyRow.ThankYouMessage != null) && (this._surveyRow.ThankYouMessage.Length != 0))
     {
         this._thankYouMessage = this._surveyRow.ThankYouMessage;
     }
     else
     {
         this._thankYouMessage = ResourceManager.GetString("ThankYouMessage", this.LanguageCode);
     }
 }
Exemple #22
0
    public void ShowMessage(	string message,
											float duration = 3.0f,
											float delay = 0,
	                        				NotificationMode notificationMode = NotificationMode.FadeInOut,
											System.Action onComplete = null )
    {
        ShowGUI ();
        onMessageFinished = onComplete;

        notificationText.gameObject.SetActive( true );
        notificationText.text = message;
        notificationRestDuration = duration;
        this.notificationMode = notificationMode;

        if ( notificationTween != null )
        {
            notificationTween.destroy ();
            notificationTween = null;
        }

        if ( notificationMode == NotificationMode.FadeOut )
        {
            notification = 1;
            notificationStatus = NotificationStatus.Showing;
            OnMessageMovedIn();
        }
        else
        {
            notification = 0;
            notificationTween = Go.to ( this, kMessageInDuration, new GoTweenConfig()
                                            .floatProp("notification", 1)
                                            .setDelay (delay)
                                            .onComplete( t => { OnMessageMovedIn(); notificationTween = null; } ));
            notificationStatus = NotificationStatus.MovingIn;
        }
    }
Exemple #23
0
        /// <summary>
        /// Gets the property names that should be passed to the notification target method when the property value is changed.
        /// </summary>
        /// <param name="property">The property definition.</param>
        /// <returns>IEnumerable&lt;System.String&gt;.</returns>
        static IEnumerable <string> GetNotifyPropertyNames(PropertyDefinition property, NotificationMode mode)
        {
            //Check for Supression
            var suppress = property.GetAttribute(typeof(SuppressNotifyAttribute));

            if (suppress == null)
            {
                var notify = property.GetAttribute(typeof(NotifyAttribute));

                if (notify == null && mode == NotificationMode.Implicit)
                {
                    yield return(property.Name);
                }
                else if (notify != null)
                {
                    //Return property names supplied by the constructor, if none are specified return the property name itself.
                    if (notify.HasConstructorArguments)
                    {
                        var args = notify.ConstructorArguments.FirstOrDefault(a => a.Type.FullName == typeof(string[]).FullName).Value as CustomAttributeArgument[];

                        if (args == null)
                        {
                            yield return(null);
                        }
                        else if (args.Length == 0)
                        {
                            yield return(property.Name);
                        }
                        else
                        {
                            foreach (var arg in args)
                            {
                                yield return((string)arg.Value);
                            }
                        }
                    }
                }
            }
        }
Exemple #24
0
 public NotifierAttribute(NotificationMode mode = NotificationMode.Explicit, NotificationStyle defaultStyle = NotificationStyle.OnSet)
 {
     this.NotificationMode = mode;
     this.DefaultStyle     = defaultStyle;
 }
Exemple #25
0
 public PropertyProcessor(MethodReference target, NotificationMode mode, NotificationStyle style)
 {
     this.notifyTarget = target;
     this.defaultMode  = mode;
     this.defaultStyle = style;
 }