private void ApplySkinSizeToWindow() { // in order to apply skin, player must be in the local machine try { SkinInfo skin = GetCurrentSkin(); Point skinPos = new Point(); if (!skin.GetName().Equals("None")) { // move skin window to player window Layout player = _layout; Screen currentScreen = Screen.AllScreens[_monitorId - 1]; skinPos.X = (int)((currentScreen.Bounds.Width * player.OriginX) / 1000.0f) - skin.VideoArea.OriginX + currentScreen.Bounds.Left; skinPos.Y = (int)((currentScreen.Bounds.Height * player.OriginY) / 1000.0f) - skin.VideoArea.OriginY + currentScreen.Bounds.Top; // set player size to fit _layout.SizeX = (int)((skin.VideoArea.SizeX * 1000.0f) / currentScreen.Bounds.Width); _layout.SizeY = (int)((skin.VideoArea.SizeY * 1000.0f) / currentScreen.Bounds.Height); } if (SkinInfoChanged != null) { SkinInfoChanged(skin, skinPos); } } catch (System.Exception) { } }
private void OnSkinInfoChangedEvent(SkinInfo skin, Point position) { if (!skin.GetName().Equals("None")) { _skinForm.Top = position.Y; _skinForm.Left = position.X; } _skinForm.SetSkin(skin); }
public void SetCurrentSkin(SkinInfo skin) { foreach (var item in _skins) { if (item.GetName().Equals(skin.GetName())) { // skin found, apply it SkinsListBox.SelectedIndex = SkinsListBox.FindString(item.GetName()); } } }
public void SetSkin(SkinInfo skin) { try { if (skin.GetName().Equals("None")) { if (AlphaFormTransformer.IsVisible) { AlphaFormTransformer.Fade(AlphaForm.FadeType.FadeOut, true, false, 1000); } } else { Bitmap bitmap = new Bitmap(skin.ImageFilename); this.Width = skin.FormLayout.SizeX; this.Height = skin.FormLayout.SizeY; AlphaFormTransformer.UpdateSkin(bitmap, null, 255); } } catch (System.Exception) { } }
public override List <string> SerializeSettings() { List <string> settings = new List <string>(); try { settings.Add(SeriallizeSetting(Properties.Settings.Default.SettingNamePort, _port)); settings.Add(SeriallizeSetting(Properties.Settings.Default.SettingNameSkinfilename, _skin.GetName())); settings.Add(SeriallizeSetting(Properties.Settings.Default.SettingNamePlayerIp, _ip)); } catch (System.Exception e) { System.Windows.Forms.MessageBox.Show("Error while serializing Player Settings\n" + e.Message, "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Stop); } return(settings); }