public SystemTray(IMenuBar host, NotificationArea notificationArea) { PromotedIcons = new ObservableCollection <NotifyIcon>(); InitializeComponent(); _notificationArea = notificationArea; DataContext = _notificationArea; Host = host; ((INotifyCollectionChanged)PinnedItems.Items).CollectionChanged += PinnedItems_CollectionChanged; ((INotifyCollectionChanged)UnpinnedItems.Items).CollectionChanged += UnpinnedItems_CollectionChanged; if (Settings.Instance.SysTrayAlwaysExpanded) { PromotedItems.Visibility = Visibility.Collapsed; UnpinnedItems.Visibility = Visibility.Visible; } // Don't allow showing both the Windows TaskBar and the Cairo tray if (Settings.Instance.EnableSysTray && (Settings.Instance.EnableTaskbar || EnvironmentHelper.IsAppRunningAsShell) && _notificationArea.Handle == IntPtr.Zero) { _notificationArea.Initialize(); } }
/// <summary> /// Initializes ManagedShell with a custom configuration. /// </summary> /// <param name="config">A ShellConfig struct containing desired initialization parameters.</param> public ShellManager(ShellConfig config) { if (config.EnableTrayService) { TrayService = new TrayService(); ExplorerTrayService = new ExplorerTrayService(); NotificationArea = new NotificationArea(config.PinnedNotifyIcons, TrayService, ExplorerTrayService); } if (config.EnableTasksService) { TasksService = new TasksService(config.TaskIconSize); Tasks = new Tasks(TasksService); } FullScreenHelper = new FullScreenHelper(); ExplorerHelper = new ExplorerHelper(NotificationArea); AppBarManager = new AppBarManager(ExplorerHelper); if (config.EnableTrayService && config.AutoStartTrayService) { NotificationArea.Initialize(); } if (config.EnableTasksService && config.AutoStartTasksService) { Tasks.Initialize(); } }