Exemplo n.º 1
0
        /// <summary>
        /// Method that is passed as the Expired action when asking the environment to show toast messages. Will be called by
        /// the environment when a toast expires.
        /// </summary>
        private void Expired(SmartClientToastData smartClientToastData)
        {
            //Add callback info to _infoTextBox
            _infoTextBox.Text += $"{DateTime.Now.ToLongTimeString()} : Toast '{_activeToasts.Single(x => x == smartClientToastData).ToDisplayText()}' expired." + Environment.NewLine;
            _infoTextBox.ScrollToEnd();

            //Remove the toast from the active toasts collection
            _activeToasts.Remove(_activeToasts.Single(x => x == smartClientToastData));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Method that is passed as the Activated action when asking the environment to show toast messages. Will be called by
        /// the environment when the user activated a toast.
        /// </summary>
        /// <param name="smartClientToastData">The toast data associated with the toast that was activated.</param>
        private void Activated(SmartClientToastData smartClientToastData)
        {
            //Add callback info to _infoTextBox
            _infoTextBox.Text += $"{DateTime.Now.ToLongTimeString()} : Toast '{_activeToasts.Single(x => x == smartClientToastData).ToDisplayText()}' activated." + Environment.NewLine;
            _infoTextBox.ScrollToEnd();

            //if remove on activation is enabled then remove the toast from the active toasts collection and signal to the environment that the toast should be removed
            if (_removeOnActivationCheckBox.IsChecked.GetValueOrDefault(false))
            {
                _activeToasts.Remove(_activeToasts.Single(x => x == smartClientToastData));
                EnvironmentManager.Instance.PostMessage(new Message(MessageId.SmartClient.ToastHideCommand, smartClientToastData.Id));
            }
        }
Exemplo n.º 3
0
 public static string ToDisplayText(this SmartClientToastData smartClientToastData)
 {
     return((smartClientToastData as SmartClientTextToastData)?.PrimaryText ?? smartClientToastData.Id.ToString());
 }