Exemple #1
0
        private FrmEditGroupBase(GroupInfoBase group, bool readOnly)
            : this()
        {
            this._group = group;

            this._txtTitle.Text         = group.OverrideDisplayName;
            this._txtTitle.Watermark    = group.DefaultDisplayName;
            this._txtAbvTitle.Text      = group.OverrideShortName;
            this._txtAbvTitle.Watermark = group.DefaultShortName;
            this._txtComments.Text      = group.Comment;
            this._txtId.Text            = group.Id.ToString();
            this._txtDisplayOrder.Value = group.DisplayPriority;
            this._txtTimeRange.Text     = group.Range.ToString();

            this._ecbIcon = EnumComboBox.Create(this._lstIcon, group.GraphIcon);
            this._ecbFill = EnumComboBox.Create(this._lstStyle, group.HatchStyle);

            this._colour = group.Colour;

            this.UpdateButtonImage();

            bool   exp          = group is GroupInfo;
            string txtGroup     = exp ? "group" : "batch";
            string txtGroupLong = exp ? "experimental group" : "batch";
            string txtContext   = readOnly ? "View" : "Edit";

            this._lblTimeRange.Text   = exp ? "Time range" : "Acquisition range";
            this.ctlTitleBar1.Text    = $"{txtContext} {txtGroup}";
            this.ctlTitleBar1.SubText = $"{txtContext} the details for the {txtGroupLong}";

            if (readOnly)
            {
                UiControls.MakeReadOnly(this);
            }

            // UiControls.CompensateForVisualStyles(this);
        }
        /// <summary>
        /// Ctor.
        /// </summary>
        private FrmEditObsFilterCondition(Form owner, Core core, ObsFilter.Condition defaults, bool readOnly)
            : this()
        {
            this._core     = core;
            this._readOnly = readOnly;

            this.ctlTitleBar1.Text = readOnly ? "View Condition" : "Edit Condition";

            // Setup boxes
            this._cbAq    = DataSet.ForAcquisitions(core).CreateConditionBox(this._txtAq, this._btnAq);
            this._cbBatch = DataSet.ForBatches(core).CreateConditionBox(this._txtBatch, this._btnBatch);
            this._cbCond  = DataSet.ForConditions(core).CreateConditionBox(this._txtCond, this._btnCond);
            this._cbGroup = DataSet.ForGroups(core).CreateConditionBox(this._txtGroup, this._btnGroup);
            this._cbObs   = DataSet.ForObservations(core).CreateConditionBox(this._txtObs, this._btnObs);
            this._cbRep   = DataSet.ForReplicates(core).CreateConditionBox(this._txtRep, this._btnRep);
            this._cbTime  = DataSet.ForTimes(core).CreateConditionBox(this._txtTime, this._btnTime);

            this._lsoAq    = EnumComboBox.Create(this._lstAq, Filter.EElementOperator.Is);
            this._lsoBatch = EnumComboBox.Create(this._lstBatch, Filter.EElementOperator.Is);
            this._lsoCond  = EnumComboBox.Create(this._lstCond, Filter.EElementOperator.Is);
            this._lsoGroup = EnumComboBox.Create(this._lstGroup, Filter.EElementOperator.Is);
            this._lsoObs   = EnumComboBox.Create(this._lstObs, Filter.EElementOperator.Is);
            this._lsoRep   = EnumComboBox.Create(this._lstRep, Filter.EElementOperator.Is);
            this._lsoTime  = EnumComboBox.Create(this._lstDay, Filter.EElementOperator.Is);

            this._isInitialised = true;

            if (defaults == null)
            {
                this.checkBox1.Checked = false;
                this._radAnd.Checked   = true;
                this.something_Changed(null, null);
            }
            else
            {
                // Not
                this.checkBox1.Checked = defaults.Negate;
                this._radAnd.Checked   = defaults.CombiningOperator == Filter.ELogicOperator.And;
                this._radOr.Checked    = defaults.CombiningOperator == Filter.ELogicOperator.Or;

                if (defaults      is ObsFilter.ConditionAcquisition)
                {
                    var def = (ObsFilter.ConditionAcquisition)defaults;
                    this._chkAq.Checked      = true;
                    this._lsoAq.SelectedItem = def.Operator;
                    this._cbAq.SelectedItems = def.Possibilities;
                }
                else if (defaults is ObsFilter.ConditionBatch)
                {
                    var def = (ObsFilter.ConditionBatch)defaults;
                    this._chkBatch.Checked      = true;
                    this._lsoBatch.SelectedItem = def.Operator;
                    this._cbBatch.SelectedItems = def.Possibilities;
                }
                else if (defaults is ObsFilter.ConditionGroup)
                {
                    var def = (ObsFilter.ConditionGroup)defaults;
                    this._chkGroup.Checked      = true;
                    this._lsoGroup.SelectedItem = def.Operator;
                    this._cbGroup.SelectedItems = def.Possibilities;
                }
                else if (defaults is ObsFilter.ConditionRep)
                {
                    var def = (ObsFilter.ConditionRep)defaults;
                    this._chkRep.Checked      = true;
                    this._lsoRep.SelectedItem = def.Operator;
                    this._cbRep.SelectedItems = def.Possibilities;
                }
                else if (defaults is ObsFilter.ConditionTime)
                {
                    var def = (ObsFilter.ConditionTime)defaults;
                    this._chkTime.Checked      = true;
                    this._lsoTime.SelectedItem = def.Operator;
                    this._cbTime.SelectedItems = def.Possibilities;
                }
                else if (defaults is ObsFilter.ConditionObservation)
                {
                    var def = (ObsFilter.ConditionObservation)defaults;
                    this._chkObs.Checked      = true;
                    this._lsoObs.SelectedItem = def.Operator;
                    this._cbObs.SelectedItems = def.Possibilities;
                }
                else if (defaults is ObsFilter.ConditionCondition)
                {
                    var def = (ObsFilter.ConditionCondition)defaults;
                    this._chkCond.Checked      = true;
                    this._lsoCond.SelectedItem = def.Operator;
                    this._cbCond.SelectedItems = def.Possibilities;
                }
                else
                {
                    throw new SwitchException(defaults.GetType());
                }
            }

            if (readOnly)
            {
                UiControls.MakeReadOnly(this);
            }
        }
Exemple #3
0
        /// <summary>
        /// CONSTRUCTOR
        /// </summary>
        private FrmEditPeakFilterCondition(Form owner, Core core, PeakFilter.Condition defaults, bool readOnly)
            : this()
        {
            this._core     = core;
            this._readOnly = readOnly;

            this.ctlTitleBar1.Text = readOnly ? "View Condition" : "Edit Condition";

            // Setup boxes
            this._cbPeaks    = DataSet.ForPeaks(core).CreateConditionBox(this._txtIsInSet, this._btnIsInSet);
            this._cbFlags    = DataSet.ForUserFlags(core).CreateConditionBox(this._txtIsFlaggedWith, this._btnIsFlaggedWith);
            this._cbClusters = DataSet.ForClusters(core).CreateConditionBox(this._txtIsInCluster, this._btnIsInCluster);

            this._lsoFlags  = EnumComboBox.Create(this._lstFlagComparator, Filter.ESetOperator.Any);
            this._lsoPats   = EnumComboBox.Create(this._lstClusterComparator, Filter.ELimitedSetOperator.Any);
            this._lsoPeaks  = EnumComboBox.Create(this._lstPeakComparator, Filter.EElementOperator.Is);
            this._lsoFilter = EnumComboBox.Create(this._lstFilterOp, Filter.EElementOperator.Is);
            this._lsoStats  = EnumComboBox.Create(this._lstStatisticComparator, Filter.EStatOperator.LessThan);
            this._lstIsStatistic.Items.AddRange(IVisualisableExtensions.WhereEnabled(core.Statistics).ToArray());

            this._ecbFilter = DataSet.ForPeakFilter(core).CreateComboBox(this._lstFilter, null, EditableComboBox.EFlags.IncludeAll);

            this._isInitialised = true;

            if (defaults == null)
            {
                this.checkBox1.Checked = false;
                this._radAnd.Checked   = true;
                this._txtComp_TextChanged(null, null);
            }
            else
            {
                // Not
                this.checkBox1.Checked = defaults.Negate;
                this._radAnd.Checked   = defaults.CombiningOperator == Filter.ELogicOperator.And;
                this._radOr.Checked    = defaults.CombiningOperator == Filter.ELogicOperator.Or;

                if (defaults is PeakFilter.ConditionCluster)
                {
                    PeakFilter.ConditionCluster def = (PeakFilter.ConditionCluster)defaults;

                    List <Cluster> strong;

                    if (!def.Clusters.TryGetStrong(out strong))
                    {
                        this.ShowWeakFailureMessage("clusters");
                    }

                    this._chkIsInCluster.Checked   = true;
                    this._lsoPats.SelectedItem     = def.ClustersOp;
                    this._cbClusters.SelectedItems = strong;
                }
                else if (defaults is PeakFilter.ConditionPeak)
                {
                    PeakFilter.ConditionPeak def = (PeakFilter.ConditionPeak)defaults;

                    List <Peak> strong;

                    if (!def.Peaks.TryGetStrong(out strong))
                    {
                        this.ShowWeakFailureMessage("peaks");
                    }

                    this._chkIsInSet.Checked    = true;
                    this._lsoPeaks.SelectedItem = def.PeaksOp;
                    this._cbPeaks.SelectedItems = strong;
                }
                else if (defaults is PeakFilter.ConditionFlags)
                {
                    PeakFilter.ConditionFlags def = (PeakFilter.ConditionFlags)defaults;

                    List <UserFlag> strong;

                    if (!def.Flags.TryGetStrong(out strong))
                    {
                        this.ShowWeakFailureMessage("peaks");
                    }

                    this._chkIsFlaggedWith.Checked = true;
                    this._lsoFlags.SelectedItem    = def.FlagsOp;
                    this._cbFlags.SelectedItems    = strong;
                }
                else if (defaults is PeakFilter.ConditionStatistic)
                {
                    PeakFilter.ConditionStatistic def = (PeakFilter.ConditionStatistic)defaults;

                    ConfigurationStatistic strong;

                    if (!def.Statistic.TryGetTarget(out strong))
                    {
                        this.ShowWeakFailureMessage("statistics");
                    }

                    ConfigurationStatistic stat = def.Statistic.GetTarget();

                    if (stat == null)
                    {
                        FrmMsgBox.ShowError(this, "The statistic specified when this condition was created has since been removed. Please select a different statistic.");
                    }

                    this._chkIsStatistic.Checked      = true;
                    this._lsoStats.SelectedItem       = def.StatisticOp;
                    this._lstIsStatistic.SelectedItem = stat;
                    this._txtStatisticValue.Text      = def.StatisticValue.ToString();
                }
                else if (defaults is PeakFilter.ConditionFilter)
                {
                    PeakFilter.ConditionFilter def = (PeakFilter.ConditionFilter)defaults;

                    this._radFilter.Checked      = true;
                    this._lsoFilter.SelectedItem = def.FilterOp ? Filter.EElementOperator.Is : Filter.EElementOperator.IsNot;
                    this._ecbFilter.SelectedItem = def.Filter;
                }
                else
                {
                    throw new SwitchException(defaults.GetType());
                }
            }

            if (readOnly)
            {
                UiControls.MakeReadOnly(this);
            }
        }