private void btnOK_Click(object sender, EventArgs e) { if (m_CurrentPanel != null) { if (m_CurrentPanel.ValidateSettings()) { foreach (SettingsPannel panel in m_PropertyPages.Values) { if (panel.ValidateSettings()) { panel.SaveSettings(); } else { m_CurrentPanel = panel; LoadPropertyPage(m_CurrentPanel); return; } } } else { return; } } Properties.Settings.Default.Save(); DialogResult = DialogResult.OK; Close(); }
private void tvSettings_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Node != null) { int propPageId = int.Parse((string)e.Node.Tag); if (m_CurrentPropertyPageId != propPageId) { SettingsPannel propPage = null; if (m_PropertyPages.TryGetValue(propPageId, out propPage)) { LoadPropertyPage(propPage); m_CurrentPanel = propPage; m_CurrentPropertyPageId = propPageId; SetFormTitle(e.Node); } } if (e.Node.Nodes.Count > 0) { e.Node.Expand(); } } }
void setSettingsOpened(bool b) { if (isSettingsOpened == b) { return; } var dur_a = TimeSpan.FromSeconds(0.15); isSettingsOpened = b; if (isSettingsOpened) { var o_animation = new DoubleAnimation { From = 0, To = 1, Duration = dur_a }; var p_animation = new ThicknessAnimation { From = new Thickness(130, 10, 0, 0), To = new Thickness(130, 40, 0, 0), Duration = dur_a }; var i_animation = new ThicknessAnimation { From = new Thickness(0, 35, 82, 0), To = new Thickness(0, 35, 72, 0), Duration = dur_a }; var i2_animation = new DoubleAnimation { From = 0, To = 20, Duration = dur_a }; SettingsPannel.BeginAnimation(OpacityProperty, o_animation); SettingsPannel.BeginAnimation(MarginProperty, p_animation); SettingsIndicator.BeginAnimation(MarginProperty, i_animation); SettingsIndicator.BeginAnimation(WidthProperty, i2_animation); SettingsPannel.IsHitTestVisible = true; } else { var o_animation = new DoubleAnimation { From = 1, To = 0, Duration = dur_a }; var p_animation = new ThicknessAnimation { From = new Thickness(130, 40, 0, 0), To = new Thickness(130, 60, 0, 0), Duration = dur_a }; var i_animation = new ThicknessAnimation { From = new Thickness(0, 35, 72, 0), To = new Thickness(0, 35, 82, 0), Duration = dur_a }; var i2_animation = new DoubleAnimation { From = 20, To = 0, Duration = dur_a }; o_animation.Completed += delegate { SettingsPannel.CloseServerSettings(); }; SettingsPannel.BeginAnimation(OpacityProperty, o_animation); SettingsPannel.BeginAnimation(MarginProperty, p_animation); SettingsIndicator.BeginAnimation(MarginProperty, i_animation); SettingsIndicator.BeginAnimation(WidthProperty, i2_animation); SettingsPannel.IsHitTestVisible = false; } }