private void OnSkinChanged() { // Backup the buttons, needed later BackupButtons(); // Set the skin to the selected skin and reload GUI GUIGraphicsContext.Skin = _btnSkin.Label; SaveSettings(); GUITextureManager.Clear(); GUITextureManager.Init(); SkinSettings.Load(); GUIFontManager.LoadFonts(GUIGraphicsContext.GetThemedSkinFile(@"\fonts.xml")); GUIFontManager.InitializeDeviceObjects(); GUIExpressionManager.ClearExpressionCache(); GUIControlFactory.ClearReferences(); GUIControlFactory.LoadReferences(GUIGraphicsContext.GetThemedSkinFile(@"\references.xml")); GUIWindowManager.OnResize(); GUIWindowManager.ActivateWindow(GetID); GUIControl.FocusControl(GetID, _btnSkin.GetID); // Apply the selected buttons again, since they are cleared when we reload RestoreButtons(); using (Settings xmlreader = new MPSettings()) { xmlreader.SetValue("general", "skinobsoletecount", 0); if (!GUIGraphicsContext.Fullscreen) { try { var border = new Size(GUIGraphicsContext.form.Width - GUIGraphicsContext.form.ClientSize.Width, GUIGraphicsContext.form.Height - GUIGraphicsContext.form.ClientSize.Height); if (GUIGraphicsContext.SkinSize.Width + border.Width <= GUIGraphicsContext.currentScreen.WorkingArea.Width && GUIGraphicsContext.SkinSize.Height + border.Height <= GUIGraphicsContext.currentScreen.WorkingArea.Height) { GUIGraphicsContext.form.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height); } else { double ratio = Math.Min((double)(GUIGraphicsContext.currentScreen.WorkingArea.Width - border.Width) / GUIGraphicsContext.SkinSize.Width, (double)(GUIGraphicsContext.currentScreen.WorkingArea.Height - border.Height) / GUIGraphicsContext.SkinSize.Height); GUIGraphicsContext.form.ClientSize = new Size((int)(GUIGraphicsContext.SkinSize.Width * ratio), (int)(GUIGraphicsContext.SkinSize.Height * ratio)); } } catch (Exception ex) { Log.Error("OnSkinChanged exception:{0}", ex.ToString()); Log.Error(ex); } } } if (BassMusicPlayer.Player != null && BassMusicPlayer.Player.VisualizationWindow != null) { BassMusicPlayer.Player.VisualizationWindow.Reinit(); } // Send a message that the skin has changed. var msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SKIN_CHANGED, 0, 0, 0, 0, 0, null); GUIGraphicsContext.SendMessage(msg); }
public void RevertSkin() { //int ActiveWindowID = GUIWindowManager.ActiveWindow; // Change skin back to OutdatedSkinName GUIGraphicsContext.Skin = _userSkin; GUITextureManager.Clear(); GUITextureManager.Init(); SkinSettings.Load(); GUIFontManager.LoadFonts(GUIGraphicsContext.GetThemedSkinFile(@"\fonts.xml")); GUIFontManager.InitializeDeviceObjects(); GUIExpressionManager.ClearExpressionCache(); GUIControlFactory.ClearReferences(); GUIControlFactory.LoadReferences(GUIGraphicsContext.GetThemedSkinFile(@"\references.xml")); GUIWindowManager.OnResize(); //GUIWindowManager.ActivateWindow(ActiveWindowID); using (Settings xmlreader = new MPSettings()) { xmlreader.SetValue("general", "skinobsoletecount", 0); if (!GUIGraphicsContext.Fullscreen) { try { GUIGraphicsContext.form.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height); } catch (Exception ex) { Log.Error("OnSkinChanged exception:{0}", ex.ToString()); Log.Error(ex); } } } }
private void OnSkinChanged() { // Backup the buttons, needed later BackupButtons(); // Set the skin to the selected skin and reload GUI GUIGraphicsContext.Skin = btnSkin.Label; SaveSettings(); GUITextureManager.Clear(); GUITextureManager.Init(); SkinSettings.Load(); GUIFontManager.LoadFonts(GUIGraphicsContext.GetThemedSkinFile(@"\fonts.xml")); GUIFontManager.InitializeDeviceObjects(); GUIExpressionManager.ClearExpressionCache(); GUIControlFactory.ClearReferences(); GUIControlFactory.LoadReferences(GUIGraphicsContext.GetThemedSkinFile(@"\references.xml")); GUIWindowManager.OnResize(); GUIWindowManager.ActivateWindow(GetID); GUIControl.FocusControl(GetID, btnSkin.GetID); // Apply the selected buttons again, since they are cleared when we reload RestoreButtons(); using (Settings xmlreader = new MPSettings()) { xmlreader.SetValue("general", "skinobsoletecount", 0); bool autosize = xmlreader.GetValueAsBool("gui", "autosize", true); if (autosize && !GUIGraphicsContext.Fullscreen) { try { GUIGraphicsContext.form.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height); //Form.ActiveForm.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height); } catch (Exception ex) { Log.Error("OnSkinChanged exception:{0}", ex.ToString()); Log.Error(ex); } } } if (BassMusicPlayer.Player != null && BassMusicPlayer.Player.VisualizationWindow != null) { BassMusicPlayer.Player.VisualizationWindow.Reinit(); } // Send a message that the skin has changed. GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SKIN_CHANGED, 0, 0, 0, 0, 0, null); GUIGraphicsContext.SendMessage(msg); }
public void RevertSkin() { //int ActiveWindowID = GUIWindowManager.ActiveWindow; // Change skin back to OutdatedSkinName GUIGraphicsContext.Skin = _userSkin; GUITextureManager.Clear(); GUITextureManager.Init(); GUIFontManager.LoadFonts(GUIGraphicsContext.Skin + @"\fonts.xml"); GUIFontManager.InitializeDeviceObjects(); GUIExpressionManager.ClearExpressionCache(); GUIControlFactory.ClearReferences(); GUIControlFactory.LoadReferences(GUIGraphicsContext.Skin + @"\references.xml"); GUIWindowManager.OnResize(); //GUIWindowManager.ActivateWindow(ActiveWindowID); using (Settings xmlreader = new MPSettings()) { xmlreader.SetValue("general", "skinobsoletecount", 0); bool autosize = xmlreader.GetValueAsBool("gui", "autosize", true); if (autosize && !GUIGraphicsContext.Fullscreen) { try { GUIGraphicsContext.form.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height); //Form.ActiveForm.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height); } catch (Exception ex) { Log.Error("OnSkinChanged exception:{0}", ex.ToString()); Log.Error(ex); } } } if (BassMusicPlayer.Player != null && BassMusicPlayer.Player.VisualizationWindow != null) { BassMusicPlayer.Player.VisualizationWindow.Reinit(); } }