private void ShowHideBars(AppBarNativeWindow previousAppBarTopWindow, AppBarNativeWindow previousAppBarBottomWindow, AppBarNativeWindow newAppBarTopWindow, AppBarNativeWindow newAppBarBottomWindow, Workspace oldWorkspace, Workspace newWorkspace) { ShowHideAppBarForms(previousAppBarTopWindow, newAppBarTopWindow); ShowHideAppBarForms(previousAppBarBottomWindow, newAppBarBottomWindow); var oldBarsAtTop = oldWorkspace.barsAtTop[monitorIndex]; var oldBarsAtBottom = oldWorkspace.barsAtBottom[monitorIndex]; var newBarsAtTop = newWorkspace.barsAtTop[monitorIndex]; var newBarsAtBottom = newWorkspace.barsAtBottom[monitorIndex]; // first position and show new bars var winPosInfo = NativeMethods.BeginDeferWindowPos(newBarsAtTop.Count + newBarsAtBottom.Count); if (newAppBarTopWindow != null) { winPosInfo = newAppBarTopWindow.PositionBars(winPosInfo, newBarsAtTop); } if (newAppBarBottomWindow != null) { winPosInfo = newAppBarBottomWindow.PositionBars(winPosInfo, newBarsAtBottom); } NativeMethods.EndDeferWindowPos(winPosInfo); newBarsAtTop.Concat(newBarsAtBottom).ForEach(b => b.Show()); // and only after that hide the old ones to avoid flickering oldBarsAtTop.Concat(oldBarsAtBottom).Except(newBarsAtTop.Concat(newBarsAtBottom)).ForEach(b => b.Hide()); }
private void ShowHideAppBarsAndRepositionBars(AppBarNativeWindow previousAppBarTopWindow, AppBarNativeWindow previousAppBarBottomWindow, AppBarNativeWindow newAppBarTopWindow, AppBarNativeWindow newAppBarBottomWindow, Workspace newWorkspace) { ShowHideAppBarForms(previousAppBarTopWindow, newAppBarTopWindow); ShowHideAppBarForms(previousAppBarBottomWindow, newAppBarBottomWindow); var newBarsAtTop = newWorkspace.barsAtTop[monitorIndex]; var newBarsAtBottom = newWorkspace.barsAtBottom[monitorIndex]; var winPosInfo = NativeMethods.BeginDeferWindowPos(newBarsAtTop.Count + newBarsAtBottom.Count); if (newAppBarTopWindow != null) { winPosInfo = newAppBarTopWindow.PositionBars(winPosInfo, newBarsAtTop); } if (newAppBarBottomWindow != null) { winPosInfo = newAppBarBottomWindow.PositionBars(winPosInfo, newBarsAtBottom); } NativeMethods.EndDeferWindowPos(winPosInfo); }
private void ShowHideAppBarsAndRepositionBars(AppBarNativeWindow previousAppBarTopWindow, AppBarNativeWindow previousAppBarBottomWindow, AppBarNativeWindow newAppBarTopWindow, AppBarNativeWindow newAppBarBottomWindow, Workspace newWorkspace) { ShowHideAppBarForms(previousAppBarTopWindow, newAppBarTopWindow); ShowHideAppBarForms(previousAppBarBottomWindow, newAppBarBottomWindow); var newBarsAtTop = newWorkspace.barsAtTop[monitorIndex]; var newBarsAtBottom = newWorkspace.barsAtBottom[monitorIndex]; var winPosInfo = NativeMethods.BeginDeferWindowPos(newBarsAtTop.Count + newBarsAtBottom.Count); if (newAppBarTopWindow != null) { winPosInfo = newAppBarTopWindow.PositionBars(winPosInfo, newBarsAtTop); } if (newAppBarBottomWindow != null) { winPosInfo = newAppBarBottomWindow.PositionBars(winPosInfo, newBarsAtBottom); } NativeMethods.EndDeferWindowPos(winPosInfo); }