private void ResetStyle() { // get the offsets of buttons that may or may not be visible int offset = (_startButton.IsElementVisible() ? _startButton.GetWidth() : 0) + (_cortanaButton.IsElementVisible() ? _cortanaButton.GetWidth() : 0); // fix the taskbar opacity //TODO (justin): get accent state before application is activated, then set it back to what it was _taskbar.AccentPolicy.AccentState = Utility.AccentState.ACCENT_DISABLED; _taskbar.ApplyAccentPolicy(); // return things back to normal _startButton.ShowElement(); _startButton.MoveElement(0); // move the start menu into the correct position if (_taskbar.GetTop() == 0) { _startMenu.MoveElement(0); _cortanaSearchMenu.MoveElement(0, (int)_dummyTaskbar.Height); } else { _startMenu.MoveElement(0); _cortanaSearchMenu.MoveElement(0, (int)_taskbar.GetTop() - (_cortanaSearchMenu.GetHeight())); } if (_cortanaButton.IsElementVisible()) { _cortanaButton.MoveElement(offset - _cortanaButton.GetWidth()); } _showDesktopButton.ShowElement(); _mainAppContainer.MoveElement(offset); _mainAppContainer.ResizeElement(_taskbar.GetWidth() - _trayIconContainer.GetWidth() - offset); _trayIconContainer.MoveElement(_taskbar.GetWidth() - _trayIconContainer.GetWidth()); // get rid of the system tray icon _trayIcon.Dispose(); }
private void ApplyStyle() { // make taskbar transparent if (CheckTaskbarVisible.IsChecked == true) { // show the taskbar _taskbar.AccentPolicy.AccentState = Utility.AccentState.ACCENT_DISABLED; _taskbar.ApplyAccentPolicy(); } else { // hide the taskbar _taskbar.AccentPolicy.AccentState = Utility.AccentState.ACCENT_INVALID_STATE; _taskbar.ApplyAccentPolicy(); } // make sure the dummy taskbar maintains position _dummyTaskbar.Top = _taskbar.GetTop(); _dummyTaskbar.Width = _taskBarWidth; _dummyTaskbar.Left = (_taskbar.GetWidth() / 2) - _dummyTaskbar.Width / 2; _dummyTaskbar.Height = _taskbar.GetHeight(); //_dummyTaskbar.Background = new SolidColorBrush(Color.FromArgb((byte)SliderDummyTaskOpacity.Value, 0, 0, 0)); UpdateDummySliders(); // get the offsets of buttons that may or may not be visible int offset = 0; // (_startButton.IsElementVisible() ? _startButton.GetWidth() : 0); for (int i = 0; i < 3; i++) { offset += _taskbarButtons[i].IsElementVisible() ? _taskbarButtons[i].GetWidth() : 0; } // resize the app container and then move it into position _mainAppContainer.ResizeElement((int)_dummyTaskbar.Width - _trayIconContainer.GetWidth() - offset - 32); _mainAppContainer.MoveElement((int)_dummyTaskbar.Left + offset + 32); // move the start button into position if (_startButton.IsElementVisible()) { _startButton.MoveElement((int)_dummyTaskbar.Left); } // show or hide the show desktopbutton if (CheckHideShowDesk.IsChecked == true) { _showDesktopButton.HideElement(); } else { _showDesktopButton.ShowElement(); } // move taskbar buttons into position for (int i = 0; i < 3; i++) { if (_taskbarButtons[i].IsElementVisible()) { _taskbarButtons[i].MoveElement((int)_dummyTaskbar.Left + offset - (_taskbarButtons[i].GetWidth() * i)); } } // move the start menu into the correct position if (_dummyTaskbar.Top == 0) { _startMenu.MoveElement((int)_dummyTaskbar.Left, (int)_dummyTaskbar.Height); _cortanaSearchMenu.MoveElement((int)_dummyTaskbar.Left, (int)_dummyTaskbar.Height); } else { _startMenu.MoveElement((int)_dummyTaskbar.Left); _cortanaSearchMenu.MoveElement((int)_dummyTaskbar.Left, (int)_dummyTaskbar.Top - (_cortanaSearchMenu.GetHeight())); } // move the tray icon container into position _trayIconContainer.MoveElement((int)_dummyTaskbar.Left + (int)_dummyTaskbar.Width - _trayIconContainer.GetWidth()); }