Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/20/09 15:21:05 (15 years ago)
Author:
epitzer
Message:

Reset/Re-initialize persistence configuration within GUI. (#548)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence.GUI/3.3/PersistenceConfigurationForm.cs

    r1566 r1611  
    2020    private readonly Dictionary<string, Type> typeNameTable;
    2121    private readonly Dictionary<Type, string> reverseTypeNameTable;
     22    private bool underConstruction;
    2223
    2324    public PersistenceConfigurationForm() {
     
    2829      typeNameTable = new Dictionary<string, Type>();
    2930      reverseTypeNameTable = new Dictionary<Type, string>();
     31      underConstruction = true;
     32      InitializeTooltips();
    3033      InitializeNameTables();
    3134      initializeConfigPages();
    3235      UpdateFromConfigurationService();
     36      underConstruction = false;
     37      UpdatePreview();
     38    }
     39
     40    private void InitializeTooltips() {
     41      ToolTip tooltip = new ToolTip() {
     42        AutoPopDelay = 5000,
     43        InitialDelay = 1000,
     44        ReshowDelay = 500,
     45        ShowAlways = true
     46      };
     47      tooltip.SetToolTip(resetButton,
     48        "Clear all custom configurations from memory.\r\n" +
     49        "The saved configuration will still be used next\r\n" +
     50        "time if you don't save (define) this change.");
     51      tooltip.SetToolTip(updateButton,
     52        "Define configuration for currently active format\r\n" +
     53        "and save to disk.");
    3354    }
    3455
     
    112133          Name = "CheckBox",
    113134          Dock = DockStyle.Fill,
    114           Enabled = false,
    115135        };
    116136        horizontalSplit.Panel2.Controls.Add(checkBox);
     
    246266    }
    247267
     268    private void UpdatePreview() {
     269      if (underConstruction)
     270        return;
     271      ListBox checkBox = (ListBox)GetActiveControl("CheckBox");
     272      IFormat activeFormat = (IFormat)configurationTabs.SelectedTab.Tag;
     273      if (activeFormat != null && checkBox != null) {
     274        checkBox.Items.Clear();
     275        Configuration activeConfig = GetActiveConfiguration();
     276        foreach (var formatter in activeConfig.Formatters) {
     277          checkBox.Items.Add(formatter.GetType().Name + " (F)");
     278        }
     279        foreach (var decomposer in activeConfig.Decomposers)
     280          checkBox.Items.Add(decomposer.GetType().Name + " (D)");
     281      }
     282    }
     283
     284
    248285    void gridView_CellValueChanged(object sender, DataGridViewCellEventArgs e) {
    249286      UpdatePreview();
     
    292329    }
    293330
    294     private void UpdatePreview() {
    295       ListBox checkBox = (ListBox)GetActiveControl("CheckBox");
    296       IFormat activeFormat = (IFormat)configurationTabs.SelectedTab.Tag;
    297       if (activeFormat != null && checkBox != null) {
    298         checkBox.Items.Clear();
    299         Configuration activeConfig = GetActiveConfiguration();
    300         foreach (var formatter in activeConfig.Formatters) {
    301           checkBox.Items.Add(formatter.GetType().Name + " (F)");
    302         }
    303         foreach (var decomposer in activeConfig.Decomposers)
    304           checkBox.Items.Add(decomposer.GetType().Name + " (D)");
    305       }
    306     }
    307331
    308332    private void decomposerList_ItemChecked(object sender, ItemCheckedEventArgs e) {
     
    370394    }
    371395
     396    private void resetButton_Click(object sender, EventArgs e) {
     397      ConfigurationService.Instance.Reset();
     398      underConstruction = true;
     399      UpdateFromConfigurationService();
     400      underConstruction = false;
     401      UpdatePreview();
     402    }
     403
    372404  }
    373405
Note: See TracChangeset for help on using the changeset viewer.