public NormalNotificatorViewModel(
            Color background, TwitterUser user, string header, string description)
        {
            _background  = background;
            _user        = user;
            _header      = header;
            _description = description;
            // acquire slot
            lock (Slots)
            {
                _slotIndex = 0;
                while (_slotIndex < Slots.Count)
                {
                    if (!Slots[_slotIndex])
                    {
                        break;
                    }
                    _slotIndex++;
                }
                if (_slotIndex < Slots.Count)
                {
                    Slots[_slotIndex] = true;
                }
                else
                {
                    Slots.Add(true);
                }
            }
            var screen = NotificationUtil.GetNotifyTargetScreen();

            if (screen == null)
            {
                return;
            }
            var bound = screen.WorkingArea;
            // size of notificator
            const int wh = 80;
            const int ww = 300;

            // items per one (vertical) line
            var ipl = (int)Math.Ceiling(bound.Height / wh);

            if (ipl == 0)
            {
                // can not place any dialog
                return;
            }

            bound.Width  *= 96.0 / screen.DpiX;
            bound.Height *= 96.0 / screen.DpiY;
            _left         = (int)((bound.Width - ww * (_slotIndex / ipl + 1)) + bound.Left);
            _top          = (int)((bound.Height - wh * (_slotIndex % ipl + 1)) + bound.Top);
            System.Diagnostics.Debug.WriteLine("#N - " + _slotIndex + " / " + _left + ", " + _top);
        }
示例#2
0
        public NormalNotificatorViewModel(
            Color background, TwitterUser user, string header, string description)
        {
            this._background  = background;
            this._user        = user;
            this._header      = header;
            this._description = description;
            // acquire slot
            lock (_slots)
            {
                _slotIndex = 0;
                while (_slotIndex < _slots.Count)
                {
                    if (!_slots[_slotIndex])
                    {
                        break;
                    }
                    _slotIndex++;
                }
                if (_slotIndex < _slots.Count)
                {
                    _slots[_slotIndex] = true;
                }
                else
                {
                    _slots.Add(true);
                }
            }
            var screen = NotificationUtil.GetNotifyTargetScreen();

            if (screen == null)
            {
                return;
            }
            var bound = screen.WorkingArea;
            var wh    = 80;
            var ww    = 300;
            var ipl   = (int)Math.Ceiling(bound.Height / wh);

            if (ipl == 0)
            {
                return;
            }
            _left = (int)((bound.Width - ww * (this._slotIndex / ipl + 1)) + bound.Left);
            _top  = (int)((bound.Height - wh * (this._slotIndex % ipl + 1)) + bound.Top);
            System.Diagnostics.Debug.WriteLine("#N - " + _slotIndex + " / " + _left + ", " + _top);
        }
示例#3
0
        private SlimNotificatorViewModel(NotificationData data)
        {
            this._data = data;
            var screen = NotificationUtil.GetNotifyTargetScreen();

            if (screen == null)
            {
                return;
            }
            var bound = screen.WorkingArea;

            if (bound == Rect.Empty)
            {
                return;                      // empty data
            }
            _width = (int)(bound.Width * 0.7);
            _left  = (int)((bound.Width - this._width) / 2.0 + bound.Left);
            _top   = (int)(bound.Height - 24 + bound.Top);
        }
示例#4
0
        private SlimNotificatorViewModel(NotificationData data)
        {
            _data = data;
            var screen = NotificationUtil.GetNotifyTargetScreen();

            if (screen == null)
            {
                return;
            }
            var bound = screen.WorkingArea;

            if (bound == Rect.Empty)
            {
                return;                      // empty data
            }
            bound.Width  *= 96.0 / screen.DpiX;
            bound.Height *= 96.0 / screen.DpiY;
            _width        = (int)(bound.Width * 0.7);
            _left         = (int)(bound.Left + (bound.Width - _width) / 2.0);
            _top          = (int)(bound.Bottom - 24);
        }