private void menuTreeItem_Click(object sender, EventArgs e)
        {
            ListSettingsDialog listDialog = new ListSettingsDialog();
            ICollection <IListColumnDefinition> available = new List <IListColumnDefinition>();

            available.Add(new ColumnDefinition(ColumnDefinition.Q1Percent));
            available.Add(new ColumnDefinition(ColumnDefinition.Q2Percent));
            available.Add(new ColumnDefinition(ColumnDefinition.Q2PercentHigh));
            available.Add(new ColumnDefinition(ColumnDefinition.Q2PercentLow));
            available.Add(new ColumnDefinition(ColumnDefinition.Q3Percent));
            available.Add(new ColumnDefinition(ColumnDefinition.Q4Percent));
            available.Add(new ColumnDefinition(ColumnDefinition.Q4PercentHigh));
            available.Add(new ColumnDefinition(ColumnDefinition.Q4PercentLow));
            available.Add(new ColumnDefinition(ColumnDefinition.Q1Time));
            available.Add(new ColumnDefinition(ColumnDefinition.Q2Time));
            available.Add(new ColumnDefinition(ColumnDefinition.Q2TimeHigh));
            available.Add(new ColumnDefinition(ColumnDefinition.Q2TimeLow));
            available.Add(new ColumnDefinition(ColumnDefinition.Q3Time));
            available.Add(new ColumnDefinition(ColumnDefinition.Q4Time));
            available.Add(new ColumnDefinition(ColumnDefinition.Q4TimeHigh));
            available.Add(new ColumnDefinition(ColumnDefinition.Q4TimeLow));

            listDialog.AvailableColumns = available;

            List <string> selected = new List <string>();

            foreach (string id in GlobalSettings.Instance.TreeColumns)
            {
                ColumnDefinition value = new ColumnDefinition(id);

                if (available.Contains(value) && !selected.Contains(id))
                {
                    selected.Add(id);
                }
            }

            listDialog.SelectedColumns        = selected;
            listDialog.Text                   = CommonResources.Text.LabelCharts;
            listDialog.SelectedItemListLabel  = Resources.Strings.Label_SelectedCharts;
            listDialog.AddButtonLabel         = CommonResources.Text.ActionAdd;
            listDialog.AllowFixedColumnSelect = false;
            listDialog.AllowZeroSelected      = true;
            listDialog.Icon                   = Util.Utilities.GetIcon(Resources.Images.Charts);

            listDialog.ThemeChanged(PluginMain.GetApplication().VisualTheme);

            if (listDialog.ShowDialog() == DialogResult.OK)
            {
                GlobalSettings.Instance.TreeColumns = listDialog.SelectedColumns as List <string>;

                InitializeTreelist(maximized);

                RefreshPage();
            }

            listDialog.Close();
            listDialog.Dispose();

            return;
        }
Ejemplo n.º 2
0
        private void ExtraChartsButton_Click(object sender, EventArgs e)
        {
            ListSettingsDialog listDialog = new ListSettingsDialog();
            ICollection <IListColumnDefinition> available = new List <IListColumnDefinition>();
            List <string> selected = new List <string>();

            // Define available and selected items
            foreach (CriticalLineDefinition line in GlobalSettings.Instance.CriticalPowerLines)
            {
                available.Add(new ColumnDefinition(line.Name, 100));

                if (line.Selected)
                {
                    selected.Add(line.Name);
                }
            }

            // Setup list selection dialog
            listDialog.AvailableColumns       = available;
            listDialog.SelectedColumns        = selected;
            listDialog.Text                   = CommonResources.Text.LabelCharts;
            listDialog.SelectedItemListLabel  = Resources.Strings.Label_SelectedCharts;
            listDialog.AddButtonLabel         = CommonResources.Text.ActionAdd;
            listDialog.AllowFixedColumnSelect = false;
            listDialog.AllowZeroSelected      = false;
            listDialog.Icon                   = Utilities.GetIcon(Images.Charts);
            listDialog.ThemeChanged(PluginMain.GetApplication().VisualTheme);

            // Popup list dialog
            if (listDialog.ShowDialog() == DialogResult.OK)
            {
                selected = listDialog.SelectedColumns as List <string>;

                // Save selected lines
                int countSelected = 0;
                foreach (CriticalLineDefinition line in GlobalSettings.Instance.CriticalPowerLines)
                {
                    // NOTE: Eval limitation: Number of charts
                    if (selected.Contains(line.Name))
                    {
                        countSelected++;
                        line.Selected = true;
                    }
                    else
                    {
                        line.Selected = false;
                    }
                }

                RefreshPage();
            }

            listDialog.Close();
            listDialog.Dispose();

            return;
        }
Ejemplo n.º 3
0
        private void ExtraChartsButton_Click(object sender, EventArgs e)
        {
            ListSettingsDialog listDialog = new ListSettingsDialog();
            ICollection <IListColumnDefinition> available = new List <IListColumnDefinition>();

            available.Add(new ColumnDefinition(ColumnDefinition.cadenceID, 100));
            available.Add(new ColumnDefinition(ColumnDefinition.gradeID, 100));
            available.Add(new ColumnDefinition(ColumnDefinition.hrID, 100));
            available.Add(new ColumnDefinition(ColumnDefinition.powerID, 100));

            List <string> selected = new List <string>();

            foreach (string id in GlobalSettings.Instance.ChartLines)
            {
                foreach (ColumnDefinition column in available)
                {
                    if (id == column.Id)
                    {
                        selected.Add(column.Id);
                        break;
                    }
                }
            }

            listDialog.AvailableColumns = available;
            listDialog.SelectedColumns  = selected;
            listDialog.Text             = CommonResources.Text.LabelCharts;

            listDialog.SelectedItemListLabel  = Resources.Strings.Label_SelectedCharts;
            listDialog.AddButtonLabel         = CommonResources.Text.ActionAdd;
            listDialog.AllowFixedColumnSelect = false;
            listDialog.AllowZeroSelected      = true;
            listDialog.Icon = Utilities.GetIcon(Images.Charts);

            listDialog.ThemeChanged(PluginMain.GetApplication().VisualTheme);

            if (listDialog.ShowDialog() == DialogResult.OK)
            {
                GlobalSettings.Instance.ChartLines = listDialog.SelectedColumns as List <string>;

                SetupSecondaryAxes(listDialog.SelectedColumns);

                RefreshPage();
            }

            listDialog.Close();
            listDialog.Dispose();

            return;
        }