コード例 #1
0
        /// <summary>
        /// Sets the behavior that the toast should use when the user invokes this button. Desktop-only, supported in builds 16251 or higher. New in Fall Creators Update.
        /// </summary>
        /// <param name="afterActivationBehavior">The behavior that the toast should use when the user invokes this button.</param>
        /// <returns>The current instance of <see cref="ToastButton"/></returns>
        public ToastButton SetAfterActivationBehavior(ToastAfterActivationBehavior afterActivationBehavior)
        {
            if (ActivationOptions == null)
            {
                ActivationOptions = new ToastActivationOptions();
            }

            ActivationOptions.AfterActivationBehavior = afterActivationBehavior;

            return(this);
        }
コード例 #2
0
        /// <summary>
        /// Configures the button to launch the specified url when the button is clicked.
        /// </summary>
        /// <param name="protocol">The protocol to launch.</param>
        /// <param name="targetApplicationPfn">New in Creators Update: The target PFN, so that regardless of whether multiple apps are registered to handle the same protocol uri, your desired app will always be launched.</param>
        /// <returns>The current instance of <see cref="ToastButton"/></returns>
        public ToastButton SetProtocolActivation(Uri protocol, string targetApplicationPfn)
        {
            if (_arguments.Count > 0)
            {
                throw new InvalidOperationException("SetProtocolActivation cannot be used in conjunction with AddArgument");
            }

            Arguments      = protocol.ToString();
            ActivationType = ToastActivationType.Protocol;

            if (targetApplicationPfn != null)
            {
                if (ActivationOptions == null)
                {
                    ActivationOptions = new ToastActivationOptions();
                }

                ActivationOptions.ProtocolActivationTargetApplicationPfn = targetApplicationPfn;
            }

            return(this);
        }