示例#1
0
        public void In(NotifierMessage message)
        {
            CreateNotifyerArea();

            _notifierArea.SetTheme(EnumMapper.GetThemeByName(Theme));

            _notifierArea.SetIcon(EnumMapper.GetIconByName(Icon));

            _notifierArea.SetText(message);

            AnimateIn(EnumMapper.GetAnimationByName(Animation));
        }
示例#2
0
        public void SetText(NotifierMessage message)
        {
            this.lblText.Text = message.Text;
            this.lblText.Font = new Font(lblText.Font, FontStyle.Bold);
            this.Height       = this.lblText.Height + this.lblText.Location.Y * 2;


            if (!string.IsNullOrEmpty(message.TextAdditional))
            {
                this.lblTextAdditional.Text = message.TextAdditional;

                this.Height = this.lblTextAdditional.Location.Y + this.lblTextAdditional.Height + this.lblText.Location.Y;
            }

            if (message.WarningItems.Any())
            {
                int y     = lblText.Location.Y * 2 + lblText.Height;
                int index = 0;
                if (!String.IsNullOrEmpty(message.TextAdditional))
                {
                    y = lblTextAdditional.Location.Y + lblTextAdditional.Height * 2;
                }
                foreach (var warningItem in message.WarningItems)
                {
                    y += (index++) * lblText.Height;

                    var tempLabelSeparator = new System.Windows.Forms.Label {
                        Location = new Point(lblText.Location.X, y), Text = "-", AutoSize = true
                    };
                    var tempLabelText = new Label {
                        Location = new Point(lblText.Location.X + 12, y), Text = warningItem.Text, AutoSize = true
                    };

                    if (warningItem.DependentControl != null)
                    {
                        var item = warningItem;
                        tempLabelText.Cursor = Cursors.Hand;
                        tempLabelText.Click += (o, k) => { HideNotifyerPanel();
                                                           item.DependentControl.Focus(); };
                    }

                    this.Controls.Add(tempLabelSeparator);
                    this.Controls.Add(tempLabelText);
                }
                this.Height = y + this.lblText.Height + this.lblText.Location.Y;
            }
        }