예제 #1
0
        public HResult AddItem(INiNotificationItem item, out int cookie)
        {
            cookie = 0;

            try
            {
                if (item == null)
                    throw new ArgumentNullException("item");

                cookie = _nextCookie++;

                var wrapper = new NotificationItem(cookie);
                wrapper.Update(item);

                _itemMap.Add(cookie, wrapper);
                _items.Add(wrapper);

                UpdateButton();

                if (_window != null)
                    _window.RedrawItems(_items);

                return HResult.OK;
            }
            catch (Exception ex)
            {
                return ErrorUtil.GetHResult(ex);
            }
        }
예제 #2
0
        public HResult AddItem(INiNotificationItem item, out int cookie)
        {
            cookie = 0;

            try
            {
                if (item == null)
                {
                    throw new ArgumentNullException("item");
                }

                cookie = _nextCookie++;

                var wrapper = new NotificationItem(cookie);
                wrapper.Update(item);

                _itemMap.Add(cookie, wrapper);
                _items.Add(wrapper);

                UpdateButton();

                if (_window != null)
                {
                    _window.RedrawItems(_items);
                }

                return(HResult.OK);
            }
            catch (Exception ex)
            {
                return(ErrorUtil.GetHResult(ex));
            }
        }