コード例 #1
0
 public void RemoveSettings(ToastAdornerSettings toastAdornerSettings)
 {
     if (_toastSettingsCollection.Remove(toastAdornerSettings) && AutoSaveOnAddOrRemove)
     {
         Save();
     }
 }
コード例 #2
0
        public ToastAdornerSettings Clone(string newName)
        {
            var settings = new ToastAdornerSettings(newName);

            settings.CanUserClose               = CanUserClose;
            settings.CloseAfterClickAction      = CloseAfterClickAction;
            settings.CloseOnRightClick          = CloseOnRightClick;
            settings.DynamicLifetime            = DynamicLifetime;
            settings.RefreshLifetimeOnMouseOver = RefreshLifetimeOnMouseOver;
            settings.DynamicLifetimeBase        = DynamicLifetimeBase;
            settings.DynamicLifetimeMaximum     = DynamicLifetimeMaximum;
            settings.DynamicLifetimeMillisecondsPerCharacter = DynamicLifetimeMillisecondsPerCharacter;
            settings.DynamicLifetimeMinimum = DynamicLifetimeMinimum;
            settings.LeaveTime = LeaveTime;
            settings.Lifetime  = Lifetime;
            return(settings);
        }
コード例 #3
0
        public void AddSettings(ToastAdornerSettings toastAdornerSettings)
        {
            if (string.IsNullOrWhiteSpace(toastAdornerSettings.Name))
            {
                throw new ArgumentException("The settings name cannot be empty or null.");
            }

            if (ToastSettings.Any(p => p.Name == toastAdornerSettings.Name))
            {
                throw new ArgumentException("A toast settings object already exists with that name.");
            }

            _toastSettingsCollection.Add(toastAdornerSettings);

            if (AutoSaveOnAddOrRemove)
            {
                Save();
            }
        }