/// <summary> /// This function queries the user for notification settings by displaying a dialog box showing options that are valid for the current hardware platform. /// </summary> /// <param name="hWnd">Handle to the parent window for the notification settings dialog box.</param> /// <returns>A UserNotification structure containing the user's notification settings.</returns> public static UserNotification GetUserNotificationPreferences(IntPtr hWnd) { UserNotification template = new UserNotification(); return(GetUserNotificationPreferences(hWnd, template)); }
/// <summary> /// Creates a new user notification. /// </summary> /// <param name="application">String that specifies the name of the application that owns this notification.</param> /// <param name="time">The time when the notification should occur.</param> /// <param name="notify">Notification object that describes the events that are to occur when the notification time is reached.</param> /// <returns>The handle to the notification indicates success.</returns> public static int SetUserNotification(string application, System.DateTime time, UserNotification notify) { return(SetUserNotification(0, application, time, notify)); }
/// <summary> /// Edit an existing user notification. /// </summary> /// <param name="handle">Handle to the notification to overwrite.</param> /// <param name="application">String that specifies the name of the application that owns this notification.</param> /// <param name="time">The time when the notification should occur.</param> /// <param name="notify">Notification object that describes the events that are to occur when the notification time is reached.</param> /// <returns>The handle to the notification indicates success.</returns> public static int SetUserNotification(int handle, string application, System.DateTime time, UserNotification notify) { //call api function int outhandle = CeSetUserNotification(handle, application, SystemTime.FromDateTime(time).ToByteArray(), notify.ToByteArray()); //if invalid handle throw exception if (outhandle == 0) { throw new Win32Exception(Marshal.GetLastWin32Error(), "Error setting UserNotification"); } return(outhandle); }
/// <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); }
/// <summary> /// Returns a UserNotification object from a specified memory location. /// </summary> /// <param name="data">Pointer to UserNotification in unmanaged memory.</param> /// <returns>A new UserNotification object.</returns> /// <remarks>This method is used internally and should not be required in normal use.</remarks> public static UserNotification FromPtr(IntPtr data) { //create new notification instance UserNotification newnotification = new UserNotification(); Marshal.Copy(data, newnotification.data, 0, Size); return newnotification; }
/// <summary> /// Creates a new user notification. /// </summary> /// <param name="application">String that specifies the name of the application that owns this notification.</param> /// <param name="time">The time when the notification should occur.</param> /// <param name="notify">Notification object that describes the events that are to occur when the notification time is reached.</param> /// <returns>The handle to the notification indicates success.</returns> public static int SetUserNotification(string application, System.DateTime time, UserNotification notify) { return SetUserNotification(0, application, time, notify); }
/// <summary> /// This function queries the user for notification settings by displaying a dialog box showing options that are valid for the current hardware platform. /// </summary> /// <param name="hWnd">Handle to the parent window for the notification settings dialog box.</param> /// <param name="template">UserNotification structure used to populate the default settings.</param> /// <returns>A UserNotification structure containing the user's notification settings.</returns> public static UserNotification GetUserNotificationPreferences(IntPtr hWnd, UserNotification template) { template.Sound = new string('\0', 255); if(!CeGetUserNotificationPreferences(hWnd, template.ToByteArray())) { throw new Win32Exception(Marshal.GetLastWin32Error(), "Could not get user preferences"); } return template; }
/// <summary> /// This function queries the user for notification settings by displaying a dialog box showing options that are valid for the current hardware platform. /// </summary> /// <param name="hWnd">Handle to the parent window for the notification settings dialog box.</param> /// <returns>A UserNotification structure containing the user's notification settings.</returns> public static UserNotification GetUserNotificationPreferences(IntPtr hWnd) { UserNotification template = new UserNotification(); return GetUserNotificationPreferences(hWnd, template); }
/// <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; }
/// <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; }
/// <summary> /// Edit an existing user notification. /// </summary> /// <param name="handle">Handle to the notification to overwrite.</param> /// <param name="application">String that specifies the name of the application that owns this notification.</param> /// <param name="time">The time when the notification should occur.</param> /// <param name="notify">Notification object that describes the events that are to occur when the notification time is reached.</param> /// <returns>The handle to the notification indicates success.</returns> public static int SetUserNotification(int handle, string application, System.DateTime time, UserNotification notify) { //call api function int outhandle = CeSetUserNotification(handle, application, SystemTime.FromDateTime(time).ToByteArray(), notify.ToByteArray()); //if invalid handle throw exception if(outhandle==0) { throw new Win32Exception(Marshal.GetLastWin32Error(),"Error setting UserNotification"); } return outhandle; }