public TrayNotificationBalloon(TrayIcon trayIcon) { InitializeComponent(); _trayIcon = trayIcon; var command = ReactiveCommand.Create(); command.Subscribe(x => _trayIcon.CloseBalloon()); CloseNotificationCommand = command; _closeTimer = new Timer(5000); _closeTimer.Elapsed += OnCloseTimerElapsed; _closeTimer.Start(); }
CompositeDisposable CreateTrayIcon() { var trayIcon = new TrayIcon(_handler.TrayNotification); TBI = trayIcon.TBI; trayIcon.Icon = "pack://application:,,,/withSIX-Play;component/app.ico"; var list = new CompositeDisposable { this.OneWayBind(ViewModel, vm => vm.TrayIconDoubleclicked, v => v.TBI.DoubleClickCommand), //this.OneWayBind(ViewModel, vm => vm.Icon, v => v.TBI.Icon), this.OneWayBind(ViewModel, vm => vm.DisplayName, v => v.TBI.ToolTipText), this.OneWayBind(ViewModel, vm => vm.Settings.EnableTrayIcon, v => v.TBI.Visibility), Disposable.Create(() => VisualRoot.Children.Remove(trayIcon)) }; VisualRoot.Children.Add(trayIcon); return list; }