public static void GetWorkArea(AppBarWindow window, out int screen, out DockEdge edge, out WorkArea windowWA, out WorkArea appbarWA) { screen = Framework.Settings.Instance.ScreenIndex; edge = Framework.Settings.Instance.DockEdge; double _uiScale = Framework.Settings.Instance.UIScale; if (OS.SupportDPI) { window.UpdateScale(_uiScale, _uiScale, false); } Monitor[] _monitors = GetMonitors(); Monitor _primary = _monitors.GetPrimary(); Monitor _active = GetMonitorFromIndex(screen, _monitors); windowWA = Windows.WorkArea.FromRECT(_active.WorkArea); windowWA.Scale(_primary.InverseScaleX, _primary.InverseScaleY); double _modifyX = 0d; double _modifyY = 0d; if ( window.IsAppBar && window.Screen == screen && window.DockEdge == edge && (_active.WorkArea.Width + window.ActualWidth) <= _active.Size.Width ) { _modifyX = window.ActualWidth; if (edge == DockEdge.Left) { _modifyX *= -1; } } windowWA.Offset(_modifyX, _modifyY); double _windowWidth = Framework.Settings.Instance.SidebarWidth * _uiScale; windowWA.SetWidth(edge, _windowWidth); int _offsetX = Framework.Settings.Instance.XOffset; int _offsetY = Framework.Settings.Instance.YOffset; windowWA.Offset(_offsetX, _offsetY); appbarWA = Windows.WorkArea.FromRECT(_active.WorkArea); appbarWA.Offset(_modifyX, _modifyY); double _appbarWidth = Framework.Settings.Instance.UseAppBar ? windowWA.Width * _primary.ScaleX : 0; appbarWA.SetWidth(edge, _appbarWidth); appbarWA.Offset(_offsetX, _offsetY); }
public SettingsModel() { DockEdgeItems = new DockEdge[2] { DockEdge.Left, DockEdge.Right }; DockEdge = Properties.Settings.Default.DockEdge; MonitorInfo[] _monitors = Windows.Monitor.GetMonitors(); ScreenItems = _monitors.Select((s, i) => new ScreenItem() { Index = i, Text = string.Format("#{0}", i + 1) }).ToArray(); if (Properties.Settings.Default.ScreenIndex < _monitors.Length) { ScreenIndex = Properties.Settings.Default.ScreenIndex; } else { ScreenIndex = _monitors.Where(s => s.IsPrimary).Select((s, i) => i).Single(); } PollingInterval = Properties.Settings.Default.PollingInterval; UseAppBar = Properties.Settings.Default.UseAppBar; ClickThrough = Properties.Settings.Default.ClickThrough; AlwaysTop = Properties.Settings.Default.AlwaysTop; CheckForUpdates = Properties.Settings.Default.CheckForUpdates; RunAtStartup = Startup.StartupTaskExists(); SidebarWidth = Properties.Settings.Default.SidebarWidth; BGColor = Properties.Settings.Default.BGColor; BGOpacity = Properties.Settings.Default.BGOpacity; FontSettingItems = new FontSetting[5] { FontSetting.x10, FontSetting.x12, FontSetting.x14, FontSetting.x16, FontSetting.x18 }; FontSetting = Properties.Settings.Default.FontSetting; FontColor = Properties.Settings.Default.FontColor; AlertFontColor = Properties.Settings.Default.AlertFontColor; Clock24HR = Properties.Settings.Default.Clock24HR; MonitorConfig = Properties.Settings.Default.MonitorConfig; }
public static void GetWorkArea(AppBarWindow window, out int screen, out DockEdge edge, out WorkArea initPos, out WorkArea windowWA, out WorkArea appbarWA) { screen = Framework.Settings.Instance.ScreenIndex; edge = Framework.Settings.Instance.DockEdge; double _uiScale = Framework.Settings.Instance.UIScale; if (OS.SupportDPI) { window.UpdateScale(_uiScale, _uiScale, false); } Monitor[] _monitors = GetMonitors(); Monitor _primary = _monitors.GetPrimary(); Monitor _active = GetMonitorFromIndex(screen, _monitors); initPos = new WorkArea() { Top = _active.WorkArea.Top, Left = _active.WorkArea.Left, Bottom = _active.WorkArea.Top + 10, Right = _active.WorkArea.Left + 10 }; windowWA = Windows.WorkArea.FromRECT(_active.WorkArea); windowWA.Scale(_active.InverseScaleX, _active.InverseScaleY); double _modifyX = 0d; double _modifyY = 0d; windowWA.Offset(_modifyX, _modifyY); double _windowWidth = Framework.Settings.Instance.SidebarWidth * _uiScale; windowWA.SetWidth(edge, _windowWidth); int _offsetX = Framework.Settings.Instance.XOffset; int _offsetY = Framework.Settings.Instance.YOffset; windowWA.Offset(_offsetX, _offsetY); appbarWA = Windows.WorkArea.FromRECT(_active.WorkArea); appbarWA.Offset(_modifyX, _modifyY); double _appbarWidth = Framework.Settings.Instance.UseAppBar ? windowWA.Width * _active.ScaleX : 0; appbarWA.SetWidth(edge, _appbarWidth); appbarWA.Offset(_offsetX, _offsetY); }
public void SetWidth(DockEdge edge, double width) { switch (edge) { case DockEdge.Left: Right = Left + width; break; case DockEdge.Right: Left = Right - width; break; } }
public void SetAppBar(int screen, DockEdge edge, WorkArea windowWA, WorkArea appbarWA) { if (edge == DockEdge.None) { throw new ArgumentException("This parameter cannot be set to 'none'.", "edge"); } if (!IsAppBar) { IsAppBar = true; APPBARDATA _data = NewData(); _callbackID = _data.uCallbackMessage = NativeMethods.RegisterWindowMessage("AppBarMessage"); NativeMethods.SHAppBarMessage(APPBARMSG.ABM_NEW, ref _data); } Screen = screen; DockEdge = edge; DockAppBar(edge, windowWA, appbarWA); }
private void DockAppBar(DockEdge edge, WorkArea windowWA, WorkArea appbarWA) { APPBARDATA _data = NewData(); _data.uEdge = (int)edge; _data.rc = new RECT() { Left = (int)Math.Round(appbarWA.Left), Top = (int)Math.Round(appbarWA.Top), Right = (int)Math.Round(appbarWA.Right), Bottom = (int)Math.Round(appbarWA.Bottom) }; NativeMethods.SHAppBarMessage(APPBARMSG.ABM_QUERYPOS, ref _data); NativeMethods.SHAppBarMessage(APPBARMSG.ABM_SETPOS, ref _data); appbarWA.Left = _data.rc.Left; appbarWA.Top = _data.rc.Top; appbarWA.Right = _data.rc.Right; appbarWA.Bottom = _data.rc.Bottom; AppBarWidth = appbarWA.Width; _source = HwndSource.FromHwnd(_data.hWnd); Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() => { Top = windowWA.Top; Left = windowWA.Left; Width = windowWA.Width; Height = windowWA.Height; _source.AddHook(AppBarHook); })); }
public static void GetWorkArea(AppBarWindow window, out int screen, out DockEdge edge, out WorkArea windowWA, out WorkArea appbarWA) { screen = Framework.Settings.Instance.ScreenIndex; edge = Framework.Settings.Instance.DockEdge; Monitor _screen = GetMonitorFromIndex(screen); double _screenX = _screen.ScaleX; double _screenY = _screen.ScaleY; double _inverseX = _screen.InverseScaleX; double _inverseY = _screen.InverseScaleY; double _uiScale = Framework.Settings.Instance.UIScale; double _abScaleX = _screenX * _uiScale; double _abScaleY = _screenY * _uiScale; if (OS.SupportDPI) { window.UpdateScale(_uiScale, _uiScale, false); } windowWA = new WorkArea() { Left = _screen.WorkArea.Left, Top = _screen.WorkArea.Top, Right = _screen.WorkArea.Right, Bottom = _screen.WorkArea.Bottom }; if (Framework.Settings.Instance.HighDPISupport) { windowWA.Left *= _inverseX; windowWA.Top *= _inverseY; windowWA.Right *= _inverseX; windowWA.Bottom *= _inverseY; } double _windowWidth = Framework.Settings.Instance.SidebarWidth * _uiScale; double _modifyX = 0d; if ( window.IsAppBar && window.Screen == screen && window.DockEdge == edge && (_screen.WorkArea.Width + window.AppBarWidth) <= _screen.Size.Width ) { _modifyX = window.AppBarWidth; } switch (edge) { case DockEdge.Left: windowWA.Right = windowWA.Left + _windowWidth - _modifyX; windowWA.Left -= _modifyX; break; case DockEdge.Right: windowWA.Left = windowWA.Right - _windowWidth + _modifyX; windowWA.Right += _modifyX; break; } int _offsetX = Framework.Settings.Instance.XOffset; int _offsetY = Framework.Settings.Instance.YOffset; windowWA.Left += _offsetX; windowWA.Top += _offsetY; windowWA.Right += _offsetX; windowWA.Bottom += _offsetY; appbarWA = new WorkArea() { Left = windowWA.Left, Top = windowWA.Top, Right = windowWA.Right, Bottom = windowWA.Bottom }; if (Framework.Settings.Instance.UseAppBar) { if (Framework.Settings.Instance.HighDPISupport) { double _abWidth = appbarWA.Width * _abScaleX; switch (edge) { case DockEdge.Left: appbarWA.Right = appbarWA.Left + _abWidth; break; case DockEdge.Right: appbarWA.Left = appbarWA.Right - _abWidth; break; } } } else { switch (edge) { case DockEdge.Left: appbarWA.Right = appbarWA.Left; break; case DockEdge.Right: appbarWA.Left = appbarWA.Right; break; } } }
public void SetAppBar(int screen, DockEdge edge, WorkArea windowWA, WorkArea appbarWA, Action callback) { if (edge == DockEdge.None) { throw new ArgumentException("This parameter cannot be set to 'none'.", "edge"); } bool _init = false; APPBARDATA _data = NewData(); if (!IsAppBar) { IsAppBar = _init = true; _callbackID = _data.uCallbackMessage = NativeMethods.RegisterWindowMessage("AppBarMessage"); NativeMethods.SHAppBarMessage(APPBARMSG.ABM_NEW, ref _data); } Screen = screen; DockEdge = edge; _data.uEdge = (int)edge; _data.rc = new RECT() { Left = (int)Math.Round(appbarWA.Left), Top = (int)Math.Round(appbarWA.Top), Right = (int)Math.Round(appbarWA.Right), Bottom = (int)Math.Round(appbarWA.Bottom) }; NativeMethods.SHAppBarMessage(APPBARMSG.ABM_QUERYPOS, ref _data); NativeMethods.SHAppBarMessage(APPBARMSG.ABM_SETPOS, ref _data); appbarWA.Left = _data.rc.Left; appbarWA.Top = _data.rc.Top; appbarWA.Right = _data.rc.Right; appbarWA.Bottom = _data.rc.Bottom; AppBarWidth = appbarWA.Width; Move(windowWA); if (_init) { Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() => { HwndSource.AddHook(AppBarHook); if (callback != null) { callback(); } })); } else if (callback != null) { callback(); } }
public static void GetWorkArea(AppBarWindow window, out int screen, out DockEdge edge, out WorkArea windowWA, out WorkArea appbarWA) { screen = Properties.Settings.Default.ScreenIndex; edge = Properties.Settings.Default.DockEdge; Monitor _screen = GetMonitorFromIndex(screen); double _screenX = _screen.ScaleX; double _screenY = _screen.ScaleY; double _inverseX = _screen.InverseScaleX; double _inverseY = _screen.InverseScaleY; double _uiScale = Properties.Settings.Default.UIScale; double _abScaleX = _screenX * _uiScale; double _abScaleY = _screenY * _uiScale; if (OS.SupportDPI) { window.UpdateScale(_uiScale, _uiScale, false); } windowWA = new WorkArea() { Left = _screen.WorkArea.Left, Top = _screen.WorkArea.Top, Right = _screen.WorkArea.Right, Bottom = _screen.WorkArea.Bottom }; if (Properties.Settings.Default.HighDPISupport) { windowWA.Left *= _inverseX; windowWA.Top *= _inverseY; windowWA.Right *= _inverseX; windowWA.Bottom *= _inverseY; } double _windowWidth = Properties.Settings.Default.SidebarWidth * _uiScale; double _modifyX = 0d; if (window.IsAppBar && window.Screen == screen && window.DockEdge == edge) { _modifyX = window.AppBarWidth; } switch (edge) { case DockEdge.Left: windowWA.Right = windowWA.Left + _windowWidth - _modifyX; windowWA.Left -= _modifyX; break; case DockEdge.Right: windowWA.Left = windowWA.Right - _windowWidth + _modifyX; windowWA.Right += _modifyX; break; } int _offsetX = Properties.Settings.Default.XOffset; int _offsetY = Properties.Settings.Default.YOffset; windowWA.Left += _offsetX; windowWA.Top += _offsetY; windowWA.Right += _offsetX; windowWA.Bottom += _offsetY; appbarWA = new WorkArea() { Left = windowWA.Left, Top = windowWA.Top, Right = windowWA.Right, Bottom = windowWA.Bottom }; if (Properties.Settings.Default.HighDPISupport) { double _abWidth = appbarWA.Width * _abScaleX; switch (edge) { case DockEdge.Left: appbarWA.Right = appbarWA.Left + _abWidth; break; case DockEdge.Right: appbarWA.Left = appbarWA.Right - _abWidth; break; } } }
public static void SetAppBar(Window window, WorkArea workArea, DockEdge edge) { RegisterInfo _regInfo = GetRegisterInfo(window, workArea); APPBARDATA _appBarData = new APPBARDATA(); _appBarData.cbSize = Marshal.SizeOf(_appBarData); _appBarData.hWnd = new WindowInteropHelper(window).Handle; if (edge == DockEdge.None) { if (_regInfo.IsRegistered) { _regInfo.Source.RemoveHook(_regInfo.Hook); NativeMethods.SHAppBarMessage((int)AppBarMsg.ABM_REMOVE, ref _appBarData); _regInfo.IsRegistered = false; } return; } if (!_regInfo.IsRegistered) { _regInfo.IsRegistered = true; _regInfo.CallbackID = NativeMethods.RegisterWindowMessage("AppBarMessage"); _regInfo.Edge = edge; _appBarData.uCallbackMessage = _regInfo.CallbackID; NativeMethods.SHAppBarMessage((int)AppBarMsg.ABM_NEW, ref _appBarData); } window.WindowStyle = WindowStyle.None; window.ResizeMode = ResizeMode.NoResize; DockAppBar(window, workArea, edge, _regInfo); }
private void DockAppBar(WorkArea workArea, DockEdge edge) { APPBARDATA _data = NewData(); _data.uEdge = (int)edge; _data.rc = new RECT() { Left = (int)Math.Round(workArea.Left), Top = (int)Math.Round(workArea.Top), Right = (int)Math.Round(workArea.Right), Bottom = (int)Math.Round(workArea.Bottom) }; NativeMethods.SHAppBarMessage((int)APPBARMSG.ABM_QUERYPOS, ref _data); NativeMethods.SHAppBarMessage((int)APPBARMSG.ABM_SETPOS, ref _data); Rect _rect = new Rect( _data.rc.Left, _data.rc.Top, (_data.rc.Right - _data.rc.Left), (_data.rc.Bottom - _data.rc.Top) ); _hook = new HwndSourceHook(AppBarCallback); _source = HwndSource.FromHwnd(_data.hWnd); Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() => { Width = _rect.Width; Height = _rect.Height; Top = _rect.Top; Left = _rect.Left; LocationChanged += AppBarWindow_LocationChanged; })); }
public SettingsModel(Sidebar sidebar) { DockEdgeItems = new DockEdge[2] { DockEdge.Left, DockEdge.Right }; DockEdge = Properties.Settings.Default.DockEdge; Monitor[] _monitors = Monitor.GetMonitors(); ScreenItems = _monitors.Select((s, i) => new ScreenItem() { Index = i, Text = string.Format("#{0}", i + 1) }).ToArray(); if (Properties.Settings.Default.ScreenIndex < _monitors.Length) { ScreenIndex = Properties.Settings.Default.ScreenIndex; } else { ScreenIndex = _monitors.Where(s => s.IsPrimary).Select((s, i) => i).Single(); } UIScale = Properties.Settings.Default.UIScale; XOffset = Properties.Settings.Default.XOffset; YOffset = Properties.Settings.Default.YOffset; PollingInterval = Properties.Settings.Default.PollingInterval; UseAppBar = Properties.Settings.Default.UseAppBar; AlwaysTop = Properties.Settings.Default.AlwaysTop; HighDPISupport = Properties.Settings.Default.HighDPISupport; ClickThrough = Properties.Settings.Default.ClickThrough; ShowTrayIcon = Properties.Settings.Default.ShowTrayIcon; CheckForUpdates = Properties.Settings.Default.CheckForUpdates; RunAtStartup = Startup.StartupTaskExists(); SidebarWidth = Properties.Settings.Default.SidebarWidth; BGColor = Properties.Settings.Default.BGColor; BGOpacity = Properties.Settings.Default.BGOpacity; FontSettingItems = new FontSetting[5] { FontSetting.x10, FontSetting.x12, FontSetting.x14, FontSetting.x16, FontSetting.x18 }; FontSetting = Properties.Settings.Default.FontSetting; FontColor = Properties.Settings.Default.FontColor; AlertFontColor = Properties.Settings.Default.AlertFontColor; DateSettingItems = new DateSetting[4] { DateSetting.Disabled, DateSetting.Short, DateSetting.Normal, DateSetting.Long }; DateSetting = Properties.Settings.Default.DateSetting; CollapseMenuBar = Properties.Settings.Default.CollapseMenuBar; ShowClock = Properties.Settings.Default.ShowClock; Clock24HR = Properties.Settings.Default.Clock24HR; if (sidebar.Ready) { foreach (MonitorConfig _record in Properties.Settings.Default.MonitorConfig) { _record.Hardware = ( from hw in sidebar.Model.MonitorManager.GetHardware(_record.Type) join config in _record.Hardware on hw.ID equals config.ID into c from config in c.DefaultIfEmpty(hw) select config ).ToArray(); } } MonitorConfig = Properties.Settings.Default.MonitorConfig.Select(c => c.Clone()).ToArray(); if (Properties.Settings.Default.Hotkeys != null) { ToggleKey = Properties.Settings.Default.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Toggle); ShowKey = Properties.Settings.Default.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Show); HideKey = Properties.Settings.Default.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Hide); ReloadKey = Properties.Settings.Default.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Reload); CloseKey = Properties.Settings.Default.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Close); } IsChanged = false; }
public static void GetWorkArea(AppBarWindow window, out int screen, out DockEdge edge, out WorkArea windowWA, out WorkArea appbarWA) { screen = Properties.Settings.Default.ScreenIndex; edge = Properties.Settings.Default.DockEdge; Monitor _screen = GetMonitorFromIndex(screen); double _screenX = _screen.ScaleX; double _screenY = _screen.ScaleY; double _inverseX = _screen.InverseScaleX; double _inverseY = _screen.InverseScaleY; if (OS.SupportDPI) { window.UpdateScale(_screen.ScaleX, _screen.ScaleY, false); } windowWA = new WorkArea() { Left = _screen.WorkArea.Left, Top = _screen.WorkArea.Top, Right = _screen.WorkArea.Right, Bottom = _screen.WorkArea.Bottom }; if (Properties.Settings.Default.HighDPISupport) { windowWA.Left *= _inverseX; windowWA.Top *= _inverseY; windowWA.Right *= _inverseX; windowWA.Bottom *= _inverseY; } double _windowWidth = Properties.Settings.Default.SidebarWidth * _screenX; double _modifyX = 0d; if (window.IsAppBar && window.Screen == screen && window.DockEdge == edge) { _modifyX = window.AppBarWidth; } switch (edge) { case DockEdge.Left: windowWA.Right = windowWA.Left + _windowWidth - _modifyX; windowWA.Left -= _modifyX; break; case DockEdge.Right: windowWA.Left = windowWA.Right - _windowWidth + _modifyX; windowWA.Right += _modifyX; break; } int _offsetX = Properties.Settings.Default.XOffset; int _offsetY = Properties.Settings.Default.YOffset; windowWA.Left += _offsetX; windowWA.Top += _offsetY; windowWA.Right += _offsetX; windowWA.Bottom += _offsetY; appbarWA = new WorkArea() { Left = windowWA.Left, Top = windowWA.Top, Right = windowWA.Right, Bottom = windowWA.Bottom }; if (Properties.Settings.Default.HighDPISupport) { double _oldWidth = appbarWA.Width; double _newWidth = _oldWidth * _screenX; double _delta = _newWidth - _oldWidth; switch (edge) { case DockEdge.Left: appbarWA.Right += _delta; break; case DockEdge.Right: appbarWA.Left -= _delta; break; } } }
private static void DockAppBar(Window window, WorkArea workArea, DockEdge edge, RegisterInfo regInfo) { APPBARDATA _appBarData = new APPBARDATA(); _appBarData.cbSize = Marshal.SizeOf(_appBarData); _appBarData.hWnd = new WindowInteropHelper(window).Handle; _appBarData.uEdge = (int)edge; _appBarData.rc = new RECT() { Left = (int)Math.Round(workArea.Left), Top = (int)Math.Round(workArea.Top), Right = (int)Math.Round(workArea.Right), Bottom = (int)Math.Round(workArea.Bottom) }; NativeMethods.SHAppBarMessage((int)AppBarMsg.ABM_QUERYPOS, ref _appBarData); NativeMethods.SHAppBarMessage((int)AppBarMsg.ABM_SETPOS, ref _appBarData); Rect _rect = new Rect( _appBarData.rc.Left, _appBarData.rc.Top, (_appBarData.rc.Right - _appBarData.rc.Left), (_appBarData.rc.Bottom - _appBarData.rc.Top) ); window.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() => { window.Width = _rect.Width; window.Height = _rect.Height; window.Top = _rect.Top; window.Left = _rect.Left; window.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() => { Task.Delay(150).ContinueWith(_ => { regInfo.Hook = new HwndSourceHook(regInfo.WndProc); regInfo.Source = HwndSource.FromHwnd(_appBarData.hWnd); regInfo.Source.AddHook(regInfo.Hook); }); })); })); }
public SettingsModel(Sidebar sidebar) { DockEdgeItems = new DockEdge[2] { DockEdge.Left, DockEdge.Right }; DockEdge = Framework.Settings.Instance.DockEdge; Monitor[] _monitors = Monitor.GetMonitors(); ScreenItems = _monitors.Select((s, i) => new ScreenItem() { Index = i, Text = string.Format("#{0}", i + 1) }).ToArray(); if (Framework.Settings.Instance.ScreenIndex < _monitors.Length) { ScreenIndex = Framework.Settings.Instance.ScreenIndex; } else { ScreenIndex = _monitors.Where(s => s.IsPrimary).Select((s, i) => i).Single(); } UIScale = Framework.Settings.Instance.UIScale; XOffset = Framework.Settings.Instance.XOffset; YOffset = Framework.Settings.Instance.YOffset; PollingInterval = Framework.Settings.Instance.PollingInterval; UseAppBar = Framework.Settings.Instance.UseAppBar; AlwaysTop = Framework.Settings.Instance.AlwaysTop; HighDPISupport = Framework.Settings.Instance.HighDPISupport; ShowAltTab = Framework.Settings.Instance.ShowAltTab; ClickThrough = Framework.Settings.Instance.ClickThrough; ShowTrayIcon = Framework.Settings.Instance.ShowTrayIcon; AutoUpdate = Framework.Settings.Instance.AutoUpdate; RunAtStartup = Framework.Settings.Instance.RunAtStartup; SidebarWidth = Framework.Settings.Instance.SidebarWidth; AutoBGColor = Framework.Settings.Instance.AutoBGColor; BGColor = Framework.Settings.Instance.BGColor; BGOpacity = Framework.Settings.Instance.BGOpacity; FontSettingItems = new FontSetting[5] { FontSetting.x10, FontSetting.x12, FontSetting.x14, FontSetting.x16, FontSetting.x18 }; FontSetting = Framework.Settings.Instance.FontSetting; FontColor = Framework.Settings.Instance.FontColor; AlertFontColor = Framework.Settings.Instance.AlertFontColor; DateSettingItems = new DateSetting[4] { DateSetting.Disabled, DateSetting.Short, DateSetting.Normal, DateSetting.Long }; DateSetting = Framework.Settings.Instance.DateSetting; CollapseMenuBar = Framework.Settings.Instance.CollapseMenuBar; ShowClock = Framework.Settings.Instance.ShowClock; Clock24HR = Framework.Settings.Instance.Clock24HR; ObservableCollection <MonitorConfig> _config = new ObservableCollection <MonitorConfig>(Framework.Settings.Instance.MonitorConfig.Select(c => c.Clone()).OrderByDescending(c => c.Order)); if (sidebar.Ready) { foreach (MonitorConfig _record in _config) { _record.HardwareOC = new ObservableCollection <HardwareConfig>( from hw in sidebar.Model.MonitorManager.GetHardware(_record.Type) join config in _record.Hardware on hw.ID equals config.ID into merged from newhw in merged.DefaultIfEmpty(hw) orderby newhw.Order descending, newhw.Name ascending select newhw ); } } MonitorConfig = _config; if (Framework.Settings.Instance.Hotkeys != null) { ToggleKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Toggle); ShowKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Show); HideKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Hide); ReloadKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Reload); CloseKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.Close); CycleEdgeKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.CycleEdge); CycleScreenKey = Framework.Settings.Instance.Hotkeys.FirstOrDefault(k => k.Action == Hotkey.KeyAction.CycleScreen); } IsChanged = false; }
public DockPosition(DockEdge edge) { Selected = edge; }
public void SetAppBar(int screen, DockEdge edge, WorkArea windowWA, WorkArea appbarWA, Action callback) { if (edge == DockEdge.None) { throw new ArgumentException("This parameter cannot be set to 'none'.", "edge"); } bool _init = false; APPBARDATA _data = NewData(); if (!IsAppBar) { IsAppBar = _init = true; _callbackID = _data.uCallbackMessage = NativeMethods.RegisterWindowMessage("AppBarMessage"); NativeMethods.SHAppBarMessage(APPBARMSG.ABM_NEW, ref _data); } Screen = screen; DockEdge = edge; _data.uEdge = (int)edge; _data.rc = new RECT() { Left = (int)Math.Round(appbarWA.Left), Top = (int)Math.Round(appbarWA.Top), Right = (int)Math.Round(appbarWA.Right), Bottom = (int)Math.Round(appbarWA.Bottom) }; NativeMethods.SHAppBarMessage(APPBARMSG.ABM_QUERYPOS, ref _data); NativeMethods.SHAppBarMessage(APPBARMSG.ABM_SETPOS, ref _data); appbarWA.Left = _data.rc.Left; appbarWA.Top = _data.rc.Top; appbarWA.Right = _data.rc.Right; appbarWA.Bottom = _data.rc.Bottom; AppBarWidth = appbarWA.Width; Move(windowWA); if (_init) { Task.Delay(500).ContinueWith(_ => { Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() => { HwndSource.AddHook(AppBarHook); if (callback != null) { callback(); } })); }); } else if (callback != null) { callback(); } }
public void SetAppBar(WorkArea workArea, DockEdge edge) { if (edge == DockEdge.None) { throw new ArgumentException("This parameter cannot be set to 'none'.", "edge"); } APPBARDATA _data = NewData(); if (!IsAppBar) { IsAppBar = true; DockEdge = edge; _callbackID = _data.uCallbackMessage = NativeMethods.RegisterWindowMessage("AppBarMessage"); NativeMethods.SHAppBarMessage((int)APPBARMSG.ABM_NEW, ref _data); } DockAppBar(workArea, edge); }