Esempio n. 1
0
        private void AddProfileSettingsTabCallback()
        {
            RightSideTab.SuspendLayout();
            if (RightSideTab.TabPages.ContainsKey("ProfileSettings"))
            {
                RightSideTab.TabPages.RemoveByKey("ProfileSettings");
            }
            RightSideTab.TabPages.Add("ProfileSettings", _pb.Strings["UI_ProfileSettings"]);

            _settingsPropertyGrid = new PropertyGrid {Dock = DockStyle.Fill};
            RightSideTab.TabPages["ProfileSettings"].Controls.Add(_settingsPropertyGrid);

            _profilePropertyBag = new PropertyBag();
            foreach (var kv in _pb.ProfileSettings.SettingsDictionary)
            {
                if (!kv.Value.Hidden)
                {
                    _profilePropertyBag[kv.Key] = new MetaProp(kv.Key, kv.Value.Value.GetType(),
                                                               new DescriptionAttribute(kv.Value.Summary),
                                                               new CategoryAttribute(kv.Value.Category))
                                                      {Value = kv.Value.Value};
                    _profilePropertyBag[kv.Key].PropertyChanged += ProfileSettingsPropertyChanged;
                }
            }
            _settingsPropertyGrid.SelectedObject = _profilePropertyBag;
            RightSideTab.SelectTab(1);
            RightSideTab.ResumeLayout();
        }
Esempio n. 2
0
 private void RemoveProfileSettingsTabCallback()
 {
     if (RightSideTab.TabPages.ContainsKey("ProfileSettings"))
     {
         _profilePropertyBag = null;
         RightSideTab.TabPages.RemoveByKey("ProfileSettings");
     }
 }
Esempio n. 3
0
        private void toolStripSettings_Click(object sender, EventArgs e)
        {
            Form settingWindow = new Form();
            settingWindow.Height = 300;
            settingWindow.Width = 300;
            settingWindow.Text = "Profile Settings";
            PropertyGrid pg = new PropertyGrid();
            pg.Dock = DockStyle.Fill;
            settingWindow.Controls.Add(pg);

            ProfilePropertyBag = new PropertyBag();
            foreach (var kv in PB.ProfileSettings.Settings)
            {
                string sum = PB.ProfileSettings.Summaries.ContainsKey(kv.Key) ?
                    PB.ProfileSettings.Summaries[kv.Key] : "";
                ProfilePropertyBag[kv.Key] = new MetaProp(kv.Key, kv.Value.GetType(),
                    new DescriptionAttribute(sum));
                ProfilePropertyBag[kv.Key].Value = kv.Value;
                ProfilePropertyBag[kv.Key].PropertyChanged += new EventHandler(MainForm_PropertyChanged);
            }
            pg.SelectedObject = ProfilePropertyBag;
            toolStripSettings.Enabled = false;
            settingWindow.Show();
            settingWindow.Disposed += new EventHandler(settingWindow_Disposed);
        }