/// <summary> /// Creates a new taskbar window and adds it to the given taskbar /// </summary> /// <param name="targetTaskbar">The taskbar to add this window to</param> public TaskbarWindow(TaskbarRef targetTaskbar, IWindowContentRenderer contentRenderer) { if (targetTaskbar == null) { throw new ArgumentNullException("targetTaskbar"); } if (contentRenderer == null) { throw new ArgumentNullException("contentRenderer"); } Taskbar = targetTaskbar; ContentRenderer = contentRenderer; FormBorderStyle = FormBorderStyle.None; // fix flickering SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.UserPaint, true); // since the window is a child of the taskbar, its //background becomes transparent automatically BackColor = Color.Black; // when the taskbar position or size changes // update this window's position/size accordingly Taskbar.PositionOrSizeChanged += (s, e) => AttachToTaskbar(); }
public WeekWindow(TaskbarRef targetTaskbar, IAppSettings settings, IDialogService dialogService) : base(targetTaskbar, settings.Placement, new CalendarWeekComponent(settings)) { DialogService = dialogService; InitializeComponent(); }
/// <summary> /// Creates a new taskbar window and adds it to the given taskbar /// </summary> /// <param name="targetTaskbar">The taskbar to add this window to</param> public TaskbarWindow(TaskbarRef targetTaskbar, TaskbarWindowPlacement placement, ITaskbarComponent component) { if (targetTaskbar == null) { throw new ArgumentNullException("targetTaskbar"); } if (component == null) { throw new ArgumentNullException("component"); } Taskbar = targetTaskbar; TaskbarComponent = component; Placement = placement; TargetSize = TaskbarComponent.PreferredSize; FormBorderStyle = FormBorderStyle.None; // fix flickering SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.UserPaint, true); // since the window is a child of the taskbar, its // background becomes transparent automatically BackColor = Color.Black; // when the taskbar position or size changes // update this window's position/size accordingly Taskbar.PositionOrSizeChanged += Taskbar_PositionOrSizeChanged; // wire up component events component.RefreshRequested += Component_RefreshRequested; }
public ClockWindow(TaskbarRef targetTaskbar, ClockViewModel viewModel) // currently we always use the Windows 10 renderer : base(targetTaskbar, TaskbarWindowPlacement.LeftOfTray, new ClockComponent(viewModel)) { InitializeComponent(); ViewModel = viewModel; // the tool tip which contains a long version of the day including Weekday toolTip = new ToolTip(); toolTip.Active = true; toolTip.UseFading = false; // we have to show the tooltip manually for correct positioning MouseMove += ClockWindow_MouseMove; MouseLeave += ClockWindow_MouseLeave; // when clicked, open the calendar flyout MouseClick += ClockWindow_MouseClick; }
public ClockWindow(TaskbarRef targetTaskbar, ClockViewModel viewModel) // currently we always use the Windows 10 renderer : base(targetTaskbar, new Win10TaskbarClockRenderer(viewModel)) { InitializeComponent(); ViewModel = viewModel; // redraw the window, when the current time changes ViewModel.PropertyChanged += (s, e) => Invalidate(); // the tool tip which contains a long version of the day including Weekday toolTip = new ToolTip(); toolTip.Active = true; toolTip.UseFading = false; // we have to show the tooltip manually for correct positioning MouseMove += ClockWindow_MouseMove; MouseLeave += ClockWindow_MouseLeave; // when clicked, open the calendar flyout MouseClick += ClockWindow_MouseClick; }