Skip to content

Commit

Permalink
Fix issue #800
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Otykier committed Mar 18, 2021
1 parent 3123cdf commit f7cdbae
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions TabularEditor/UI/Actions/RefreshAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,18 @@ public void InitMenu(ToolStripItem item, Context currentContext)
// and one for script to file.
if (parent.Items[0] is ToolStripLabel) return;

var modes = GetValidRefreshTypes(currentContext).Select(m => m.ToString()).ToArray();
var modes = GetValidRefreshTypes(currentContext).ToList();

if (modes.Length > 1)
if (modes.Count > 1)
{
var cmb = new ToolStripComboBox();
cmb.DropDownStyle = ComboBoxStyle.DropDownList;
cmb.Items.AddRange(modes);
cmb.SelectedIndex = 4;
cmb.Items.AddRange(modes.Select(m => m.ToString()).ToArray());
var currentMode = modes.IndexOf(refreshType);
if (currentMode < 0) currentMode = modes.IndexOf(RefreshType.Automatic);
if (currentMode < 0) currentMode = 0;
refreshType = modes[currentMode];
cmb.SelectedIndex = currentMode < 0 ? 0 : currentMode;
cmb.SelectedIndexChanged += (s, e) => {
Enum.TryParse(cmb.Text, out refreshType);
};
Expand Down

0 comments on commit f7cdbae

Please sign in to comment.