Exemple #1
0
        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();
            }
        }
Exemple #2
0
        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;
            }

            TangraConfig.Settings.Save();

            foreach (SettingsPannel panel in m_PropertyPages.Values)
            {
                panel.OnPostSaveSettings();
            }

            DialogResult = DialogResult.OK;
            Close();
        }