private ApplicationWindow addWindow(IntPtr hWnd, ApplicationWindow.WindowState initialState = ApplicationWindow.WindowState.Inactive, bool sanityCheck = false) { ApplicationWindow win = new ApplicationWindow(hWnd, this); // set window state if a non-default value is provided if (initialState != ApplicationWindow.WindowState.Inactive) { win.State = initialState; } // add window unless we need to validate it is eligible to show in taskbar if (!sanityCheck || win.CanAddToTaskbar) { Windows.Add(win); } // Only send TaskbarButtonCreated if we are shell, and if OS is not Server Core // This is because if Explorer is running, it will send the message, so we don't need to // Server Core doesn't support ITaskbarList, so sending this message on that OS could cause some assuming apps to crash if (Interop.Shell.IsCairoRunningAsShell && !Interop.Shell.IsServerCore) { SendNotifyMessage(win.Handle, (uint)TASKBARBUTTONCREATEDMESSAGE, UIntPtr.Zero, IntPtr.Zero); } return(win); }
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (!(values[0] is FrameworkElement fxElement)) { return(null); } // Default style is Inactive... var fxStyle = fxElement.FindResource("TaskButton"); if (values[1] == null) { // Default - couldn't get window state. return(fxStyle); } if (values[1] is ApplicationWindow.WindowState) { ApplicationWindow.WindowState state = (ApplicationWindow.WindowState)values[1]; switch (state) { case ApplicationWindow.WindowState.Active: fxStyle = fxElement.FindResource("TaskButtonActive"); break; case ApplicationWindow.WindowState.Flashing: fxStyle = fxElement.FindResource("TaskButtonFlashing"); break; } } return(fxStyle); }
private void AppButton_OnPreviewMouseDown(object sender, MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left) { PressedWindowState = Window.State; } }
private ApplicationWindow addWindow(IntPtr hWnd, ApplicationWindow.WindowState initialState = ApplicationWindow.WindowState.Inactive, bool sanityCheck = false) { ApplicationWindow win = new ApplicationWindow(this, hWnd); // set window state if a non-default value is provided if (initialState != ApplicationWindow.WindowState.Inactive) { win.State = initialState; } // add window unless we need to validate it is eligible to show in taskbar if (!sanityCheck || win.CanAddToTaskbar) { Windows.Add(win); } // Only send TaskbarButtonCreated if we are shell, and if OS is not Server Core // This is because if Explorer is running, it will send the message, so we don't need to if (EnvironmentHelper.IsAppRunningAsShell) { sendTaskbarButtonCreatedMessage(win.Handle); } return(win); }
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var fxElement = values[0] as FrameworkElement; if (fxElement == null) { return(null); } // Default style is Inactive... var fxStyle = fxElement.FindResource("CairoTaskbarButtonInactiveStyle"); if (values[1] == null) { // Default - couldn't get window state. return(fxStyle); } ApplicationWindow.WindowState winState = ApplicationWindow.WindowState.Unknown; EnumUtility.TryCast <ApplicationWindow.WindowState>(values[1], out winState, ApplicationWindow.WindowState.Inactive); switch (winState) { case ApplicationWindow.WindowState.Active: fxStyle = fxElement.FindResource("CairoTaskbarButtonActiveStyle"); break; case ApplicationWindow.WindowState.Flashing: fxStyle = fxElement.FindResource("CairoTaskbarButtonFlashingStyle"); break; case ApplicationWindow.WindowState.Hidden: fxStyle = fxElement.FindResource("CairoTaskbarButtonHiddenStyle"); break; } return(fxStyle); }