private void CreateButtons(Manager manager, Texture2D[] textures) { HightLightPanel = new Panel(manager) { Width = textures[0].Width + Padding, Height = textures[0].Height + Padding, Color = Color.DarkCyan }; HightLightPanel.Init(); HightLightPanel.Parent = Panel; HightLightPanel.SendToBack(); var left = Padding; const int top = Padding; foreach (var texture in textures) { var graphicalButton = new GraphicalButton(manager, texture, texture, texture) { Left = left, Top = top, Width = texture.Width, Height = texture.Height }; graphicalButton.Init(); graphicalButton.Click += (sender, args) => SelectAvatar(graphicalButton); graphicalButton.MouseOver += (sender, args) => MouseOverAvatar(graphicalButton); graphicalButton.MouseOut += (sender, args) => MouseOutAvatar(graphicalButton); graphicalButton.Parent = Panel; _graphicalButtons.Add(graphicalButton); left += (Padding + graphicalButton.Width); } SetSelected(0); }
public override void ApplySkin(XmlNode pXmlNode, string pSkinPath) { base.ApplySkin(pXmlNode, pSkinPath); XmlNode node = pXmlNode.SelectSingleNode(XPATH_APPLY_SKIN); if (node != null) { GraphicalButton button = new GraphicalButton(); button.ButtonString = "Apply Skin"; button.ApplySkin(node, pSkinPath); AddViewControl(button); button.StartRender(); button.Click += (sender, e) => { AppMain.WindowManager.ApplySkin(); }; } }
public void ApplySkin(XmlNode pXmlNode, string pSkinPath) { Clear(); XmlNode buttonNode = pXmlNode.SelectSingleNode(XPATH_REBUILD_DATABSE); if (buttonNode != null) { var button = new GraphicalButton(); button.ButtonString = "Rebuild Database"; button.ApplySkin(buttonNode, pSkinPath); AddViewControl(button); button.StartRender(); button.Click += (sender, e) => { AppMain.BackgroundTasks.ScanMedia(true); }; } var nodeNames = new string[] { XPATH_MUSIC_FOLDER, XPATH_PICTURE_FOLDER, XPATH_VIDEO_FOLDER }; foreach (string nodeName in nodeNames) { XmlNode node = pXmlNode.SelectSingleNode(nodeName); if (node != null) { TextInput ti = new TextInput(); ti.ApplySkin(node, pSkinPath); AddViewControl(ti); ti.StartRender(); switch (nodeName) { case XPATH_MUSIC_FOLDER: ti.InputLeave += () => { if (AppMain.Settings.MusicPath != ti.TextString) { AppMain.Settings.MusicPath = ti.TextString; AppMain.Settings.SaveXml(); } }; ti.TextString = AppMain.Settings.MusicPath; break; case XPATH_PICTURE_FOLDER: ti.InputLeave += () => { if (AppMain.Settings.PicturePath != ti.TextString) { AppMain.Settings.PicturePath = ti.TextString; AppMain.Settings.SaveXml(); } }; ti.TextString = AppMain.Settings.PicturePath; break; case XPATH_VIDEO_FOLDER: ti.InputLeave += () => { if (AppMain.Settings.VideoPath != ti.TextString) { AppMain.Settings.VideoPath = ti.TextString; AppMain.Settings.SaveXml(); } }; ti.TextString = AppMain.Settings.VideoPath; break; } } } }
private void SelectAvatar(GraphicalButton button) { HightLightPanel.SetPosition(button.Left - Padding / 2, button.Top - Padding / 2); CurrentlySelected = button; }