Esempio n. 1
0
        internal static void BindObject(Notification notification)
        {
            int flag;
            NotificationError ret = NotificationError.None;

            Notification.IndicatorStyle style = (Notification.IndicatorStyle)notification.GetStyle("Indicator");
            Interop.Notification.GetApplist(notification.Handle, out flag);

            if (string.IsNullOrEmpty(style.SubText) == false)
            {
                ret = Interop.Notification.SetText(notification.Handle, NotificationText.FirstMainText, style.SubText, null, -1);
                if (ret != NotificationError.None)
                {
                    throw NotificationErrorFactory.GetException(ret, "unable to set indicator text");
                }
                flag |= (int)NotificationDisplayApplist.Ticker;
            }

            if (string.IsNullOrEmpty(style.IconPath) == false)
            {
                ret = Interop.Notification.SetImage(notification.Handle, NotificationImage.IconForIndicator, style.IconPath);
                if (ret != NotificationError.None)
                {
                    throw NotificationErrorFactory.GetException(ret, "unable to set indicator image");
                }
                flag |= (int)NotificationDisplayApplist.Indicator;
            }
            Interop.Notification.SetApplist(notification.Handle, flag);
        }
Esempio n. 2
0
        internal static void BindSafeHandle(Notification notification)
        {
            int appList;

            Interop.Notification.GetApplist(notification.Handle, out appList);
            if ((appList & (int)NotificationDisplayApplist.Ticker) != 0 || (appList & (int)NotificationDisplayApplist.Indicator) != 0)
            {
                string path, text;
                Notification.IndicatorStyle indicator = new Notification.IndicatorStyle();
                Interop.Notification.GetImage(notification.Handle, NotificationImage.IconForIndicator, out path);
                indicator.IconPath = path;
                Interop.Notification.GetText(notification.Handle, NotificationText.FirstMainText, out text);
                indicator.SubText = text;

                notification.AddStyle(indicator);
            }
        }