Exemplo n.º 1
0
 public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
 {
     if (values != null && values[3] is AppTheme theme)
     {
         bool newIconProvider = false;
         if (theme is AppTheme.Dark)
         {
             if (!(currentIconProvider is LightIconProvider))
             {
                 currentIconProvider = new LightIconProvider();
                 newIconProvider     = true;
             }
         }
         else
         {
             if (!(currentIconProvider is DarkIconProvider))
             {
                 currentIconProvider = new DarkIconProvider();
                 newIconProvider     = true;
             }
         }
         return(this.GetIcon(values, newIconProvider));
     }
     return(Binding.DoNothing);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Enables "minimize to tray" behavior for the specified Window.
        /// </summary>
        /// <param name = "window"><see cref="Window"/> to enable the behavior on.</param>
        /// <param name="windows">Additional <see cref="Window"/>s to enable the behavior on.</param>
        public static void Enable(Window window, params Window[] windows)
        {
            // No need to track this instance; its event handlers will keep it alive
            foreach (var w in windows.Prepend(window))
            {
                switch (w)
                {
                case InProgressWindow inProgress:
                    TrayIconProvider.FromInProgressWindow(inProgress);
                    break;

                default:
                    TrayIconProvider.FromWindow(w);
                    break;
                }
            }
        }