public void SelectElement(SkinElementControl element) { SelectedElement = element; }
private void RedrawSlider(SkinSlider slider) { var color = Core.MapColor2Color(slider.MapColor); if (SelectedWindow.ColorPositions.All(t => t.MapColor != color)) return; var pos = SelectedWindow.ColorPositions.First(t => t.MapColor == color); slider.X = pos.X; slider.Y = pos.Y; slider.Width = pos.Width; slider.Height = pos.Height; SkinElementControl sliderControl; if (Canvas.Children.Cast<UIElement>().Where(t => t.GetType() == typeof(SkinElementControl)).Cast<SkinElementControl>().Any(t => t.SkinElement == slider)) { sliderControl = Canvas.Children.Cast<UIElement>().Where(t => t.GetType() == typeof(SkinElementControl)).Cast<SkinElementControl>().First(t => t.SkinElement == slider); Canvas.Children.Remove(sliderControl); } sliderControl = new SkinElementControl(this, slider); Canvas.Children.Add(sliderControl); }
private void RedrawComboBox(SkinComboBox comboBox) { var color = Core.MapColor2Color(comboBox.MapColor); if (SelectedWindow.ColorPositions.All(t => t.MapColor != color)) return; var pos = SelectedWindow.ColorPositions.First(t => t.MapColor == color); comboBox.X = pos.X; comboBox.Y = pos.Y; comboBox.Width = pos.Width; comboBox.Height = pos.Height; SkinElementControl comboBoxControl; if (Canvas.Children.Cast<UIElement>().Where(t => t.GetType() == typeof(SkinElementControl)).Cast<SkinElementControl>().Any(t => t.SkinElement == comboBox)) { comboBoxControl = Canvas.Children.Cast<UIElement>().Where(t => t.GetType() == typeof(SkinElementControl)).Cast<SkinElementControl>().First(t => t.SkinElement == comboBox); Canvas.Children.Remove(comboBoxControl); } comboBoxControl = new SkinElementControl(this, comboBox); Canvas.Children.Add(comboBoxControl); }
private void RedrawProgressBar(SkinProgressBar progressBar) { var color = Core.MapColor2Color(progressBar.MapColor); if (SelectedWindow.ColorPositions.All(t => t.MapColor != color)) return; var pos = SelectedWindow.ColorPositions.First(t => t.MapColor == color); progressBar.X = pos.X; progressBar.Y = pos.Y; progressBar.Width = pos.Width; progressBar.Height = pos.Height; SkinElementControl progressBarControl; if (Canvas.Children.Cast<UIElement>().Where(t => t.GetType() == typeof(SkinElementControl)).Cast<SkinElementControl>().Any(t => t.SkinElement == progressBar)) { progressBarControl = Canvas.Children.Cast<UIElement>().Where(t => t.GetType() == typeof(SkinElementControl)).Cast<SkinElementControl>().First(t => t.SkinElement == progressBar); Canvas.Children.Remove(progressBarControl); } progressBarControl = new SkinElementControl(this, progressBar); Canvas.Children.Add(progressBarControl); }
private void RedrawButton(SkinButton button) { var color = Core.MapColor2Color(button.MapColor); if (SelectedWindow.ColorPositions.All(t => t.MapColor != color)) return; var pos = SelectedWindow.ColorPositions.First(t => t.MapColor == color); button.X = pos.X; button.Y = pos.Y; button.Width = pos.Width; button.Height = pos.Height; SkinElementControl buttonControl; if (Canvas.Children.Cast<UIElement>().Where(t => t.GetType() == typeof(SkinElementControl)).Cast<SkinElementControl>().Any(t => t.SkinElement == button)) { buttonControl = Canvas.Children.Cast<UIElement>().Where(t => t.GetType() == typeof(SkinElementControl)).Cast<SkinElementControl>().First(t => t.SkinElement == button); Canvas.Children.Remove(buttonControl); } buttonControl = new SkinElementControl(this, button); Canvas.Children.Add(buttonControl); }