User Tools

Site Tools


quicksnippets
c# hexdecode
public byte[] DecodeHexString(string hexdigits)
        {            
            int slen = hexdigits.Length;
            Debug.Assert(slen % 2 == 0);
            int blen = slen / 2;
            byte[] res = new byte[blen];            
            for (int i = 0; i < slen; i+=2)
            {                
                byte nb=Convert.ToByte(hexdigits.Substring(i,2), 16);
                int bidx = i / 2;
                res[bidx] = nb;
            }
            return res;
        }
    // Summary:
    //     Defines the content, associated metadata and events, and expiration time
    //     of a toast notification.
    [DualApiPartition(version = 100794368)]
    [Threading(ThreadingModel.MTA)]
    [Version(100794368)]
    public sealed class ToastNotification
    {
        // Summary:
        //     Creates and initializes a new instance of the ToastNotification.
        //
        // Parameters:
        //   content:
        //     The XML content that defines the toast notification.
        public ToastNotification(XmlDocument content);

        // Summary:
        //     Gets the XML that defines the current toast notification.
        //
        // Returns:
        //     The object that contains the XML.
        public XmlDocument Content { get; }
        //
        // Summary:
        //     Gets or sets the time after which a toast notification should not be displayed.
        //
        // Returns:
        //     The date and time after which the toast is no longer considered current or
        //     valid and should not be displayed.
        public DateTimeOffset? ExpirationTime { get; set; }

        // Summary:
        //     Occurs when user activates a toast notification through a click or touch.
        //     Apps that are running subscribe to this event.
        public event TypedEventHandler<ToastNotification, object> Activated;
        //
        // Summary:
        //     Occurs when a toast notification leaves the screen, either by expiring or
        //     being explicitly dismissed by the user. Apps that are running subscribe to
        //     this event.
        public event TypedEventHandler<ToastNotification, ToastDismissedEventArgs> Dismissed;
        //
        // Summary:
        //     Occurs when an error is caused when Windows attempts to raise a toast notification.
        //     Apps that are running subscribe to this event.
        public event TypedEventHandler<ToastNotification, ToastFailedEventArgs> Failed;
    }
    // Summary:
    //     Raises a toast notification to the specific app that the notifier is bound
    //     to. This class also lets you schedule and remove toast notifications.
    [DualApiPartition(version = 100794368)]
    [Version(100794368)]
    public sealed class ToastNotifier
    {
        // Summary:
        //     Gets a value that tells you whether there is an app, user, or system block
        //     that prevents the display of a toast notification.
        //
        // Returns:
        //     Enabled if the toast can be shown; otherwise, one or more reasons that the
        //     toast will be blocked.
        public NotificationSetting Setting { get; }

        // Summary:
        //     Adds a ScheduledToastNotification for later display by Windows.
        //
        // Parameters:
        //   scheduledToast:
        //     The scheduled toast notification, which includes its content and timing instructions.
        public void AddToSchedule(ScheduledToastNotification scheduledToast);
        //
        // Summary:
        //     Gets the collection of ScheduledToastNotification objects that this app has
        //     scheduled for display.
        //
        // Returns:
        //     The collection of scheduled toast notifications that the app bound to this
        //     notifier has scheduled for timed display.
        public IReadOnlyList<ScheduledToastNotification> GetScheduledToastNotifications();
        //
        // Summary:
        //     Removes the specified toast notification from the screen.
        //
        // Parameters:
        //   notification:
        //     The object that specifies the toast to hide.
        public void Hide(ToastNotification notification);
        //
        // Summary:
        //     Cancels the scheduled display of a specified ScheduledToastNotification.
        //
        // Parameters:
        //   scheduledToast:
        //     The notification to remove from the schedule.
        public void RemoveFromSchedule(ScheduledToastNotification scheduledToast);
        //
        // Summary:
        //     Displays the specified toast notification.
        //
        // Parameters:
        //   notification:
        //     The object that contains the content of the toast notification to display.
        public void Show(ToastNotification notification);
    }

FurtherToastStuff Toastnotficationsettings

quicksnippets.txt · Last modified: 2022/08/09 15:20 (external edit)