public SettingDialog(DoSettings _doSettings, SettingsPDU _spdu) { InitializeComponent(); doSettings = _doSettings; spdu = _spdu; OuterWidth.Value = spdu.outerWidth; OuterWidthValue.Content = spdu.outerWidth; OuterTransparency.Value = spdu.outerTransparency; OuterTransparencyValue.Content = spdu.outerTransparency; InnerTransparency.Value = spdu.innerTransparency; InnerTransparencyValue.Content = spdu.innerTransparency; OuterBrush.Background = spdu.outerBrush; InnerBrush.Background = spdu.innerBrush; Brush1.Background = spdu.brush1; Brush2.Background = spdu.brush2; Brush3.Background = spdu.brush3; Brush4.Background = spdu.brush4; Brush5.Background = spdu.brush5; Brush6.Background = spdu.brush6; }
public void DoSettings(SettingsPDU spdu) { double width = 0; Thickness margin; switch (spdu.id) { case 1: if (TextPanelOuterBackground.Width - 2 * spdu.outerWidth - 40 < 100 || TextPanelOuterBackground.Height - 2 * spdu.outerWidth - 40 < 100) { return; } margin = TextPanelInnerBackground.Margin; margin.Top = TextPanelOuterBackground.Margin.Top + spdu.outerWidth; margin.Left = TextPanelOuterBackground.Margin.Left + spdu.outerWidth; TextPanelInnerBackground.Margin = margin; width = TextPanelOuterBackground.Width - 2 * spdu.outerWidth; width = width < 0 ? 0 : width; TextPanelInnerBackground.Width = width; width = TextPanelOuterBackground.Height - 2 * spdu.outerWidth; width = width < 0 ? 0 : width; TextPanelInnerBackground.Height = width; margin = WhitodoText.Margin; margin.Top = TextPanelInnerBackground.Margin.Top + 20; margin.Left = TextPanelInnerBackground.Margin.Left + 20; WhitodoText.Margin = margin; width = TextPanelInnerBackground.Width - 40; width = width < 0 ? 0 : width; WhitodoText.Width = width; width = TextPanelInnerBackground.Height - 40; width = width < 0 ? 0 : width; WhitodoText.Height = width; break; case 2: TextPanelOuterBackground.Opacity = spdu.outerTransparency; break; case 3: TextPanelInnerBackground.Opacity = spdu.innerTransparency; break; case 4: TextPanelOuterBackground.Background = spdu.outerBrush; break; case 5: TextPanelInnerBackground.Background = spdu.innerBrush; break; case 6: RedButton.Background = spdu.brush1; break; case 7: BlueButton.Background = spdu.brush2; break; case 8: GreenButton.Background = spdu.brush3; break; case 9: YellowButton.Background = spdu.brush4; break; case 10: WhiteButton.Background = spdu.brush5; break; case 11: BlackButton.Background = spdu.brush6; break; default: break; } }