Пример #1
0
        /// <summary>
        /// This function modifies an existing user notification.
        /// </summary>
        /// <param name="handle">Handle of the Notification to be modified</param>
        /// <param name="trigger">A UserNotificationTrigger that defines what event activates a notification.</param>
        /// <param name="notification">A UserNotification that defines how the system should respond when a notification occurs.</param>
        /// <returns>Handle to the notification event if successful.</returns>
        public static int SetUserNotification(int handle, UserNotificationTrigger trigger, UserNotification notification)
        {
            int outhandle = CeSetUserNotificationEx(handle, trigger.ToByteArray(), notification.ToByteArray());

            //throw on invalid handle
            if (outhandle == 0)
            {
                throw new Win32Exception(Marshal.GetLastWin32Error(), "Error setting UserNotification");
            }
            return(outhandle);
        }
Пример #2
0
        /// <summary>
        /// This function creates a new user notification.
        /// </summary>
        /// <param name="trigger">A UserNotificationTrigger that defines what event activates a notification.</param>
        /// <param name="notification">A UserNotification that defines how the system should respond when a notification occurs.</param>
        /// <returns>Handle to the notification event if successful.</returns>
        public static int SetUserNotification(UserNotificationTrigger trigger, UserNotification notification)
        {
            byte[] notifybytes = null;
            if (notification != null)
            {
                notifybytes = notification.ToByteArray();
            }

            int outhandle = CeSetUserNotificationEx(0, trigger.ToByteArray(), notifybytes);

            //throw on invalid handle
            if (outhandle == 0)
            {
                throw new Win32Exception(Marshal.GetLastWin32Error(), "Error setting UserNotification");
            }
            return(outhandle);
        }
Пример #3
0
		/// <summary>
		/// This function modifies an existing user notification.
		/// </summary>
		/// <param name="handle">Handle of the Notification to be modified</param>
		/// <param name="trigger">A UserNotificationTrigger that defines what event activates a notification.</param>
		/// <param name="notification">A UserNotification that defines how the system should respond when a notification occurs.</param>
		/// <returns>Handle to the notification event if successful.</returns>
		public static int SetUserNotification(int handle, UserNotificationTrigger trigger, UserNotification notification)
		{
			int outhandle = CeSetUserNotificationEx(handle, trigger.ToByteArray(), notification.ToByteArray());
			
			//throw on invalid handle
			if(outhandle==0)
			{
				throw new Win32Exception(Marshal.GetLastWin32Error(), "Error setting UserNotification");
			}
			return outhandle;
		}
Пример #4
0
		/// <summary>
		/// This function creates a new user notification.
		/// </summary>
		/// <param name="trigger">A UserNotificationTrigger that defines what event activates a notification.</param>
		/// <param name="notification">A UserNotification that defines how the system should respond when a notification occurs.</param>
		/// <returns>Handle to the notification event if successful.</returns>
		public static int SetUserNotification(UserNotificationTrigger trigger, UserNotification notification)
		{
			byte[] notifybytes = null;
			if(notification!=null)
			{
				notifybytes = notification.ToByteArray();
			}

			int outhandle = CeSetUserNotificationEx(0, trigger.ToByteArray(), notifybytes);
			
			//throw on invalid handle
			if(outhandle==0)
			{
				throw new Win32Exception(Marshal.GetLastWin32Error(),"Error setting UserNotification");
			}
			return outhandle;
		}