コード例 #1
0
ファイル: EffectForm.cs プロジェクト: andyaiken/masterplan
        private void EffectForm_Shown(object sender, EventArgs e)
        {
            if (ConditionBtn.Checked)
            {
                ConditionBox.Focus();
                ConditionBox.SelectAll();
            }

            if (DamageBtn.Checked)
            {
                DamageBox.Focus();
                DamageBox.Select(0, 1);
            }

            if (DefenceBtn.Checked)
            {
                DefenceModBox.Focus();
                DefenceModBox.Select(0, 1);
            }

            // Damage mods - do nothing

            if (RegenBtn.Checked)
            {
                RegenValueBox.Focus();
                RegenValueBox.Select(0, 1);
            }

            if (AuraBtn.Checked)
            {
                AuraRadiusBox.Focus();
                AuraRadiusBox.Select(0, 1);
            }
        }
コード例 #2
0
        private bool TryInvoke <T>(RadioButton radioButton, ConditionBox <T> conditionBox, EnumComboBox <Filter.EElementOperator> enumBox, Type type, out ObsFilter.Condition result)
        {
            if (!radioButton.Checked)
            {
                result = null;
                return(false);
            }

            Filter.ELogicOperator op = this._radAnd.Checked ? Filter.ELogicOperator.And : Filter.ELogicOperator.Or;

            bool negate = this.checkBox1.Checked;

            var sel = conditionBox.GetSelectionOrNull();

            this._checker.Check(conditionBox.TextBox, conditionBox.SelectionValid, "Select a condition");

            var en = enumBox.SelectedItem;

            this._checker.Check(enumBox.ComboBox, enumBox.HasSelection, "Select a condition");

            if (sel == null || !en.HasValue)
            {
                result = null;
                return(true);
            }

            Type[] types = { typeof(Filter.ELogicOperator), typeof(bool), typeof(Filter.EElementOperator), typeof(IEnumerable <T>) };
            result = (ObsFilter.Condition)type.GetConstructor(types).Invoke(new object[] { op, negate, en.Value, sel });
            return(true);
        }
 private void ConditionBox_OnPreviewKeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Back || e.Key == Key.Space)
     {
         ConditionBox.IsDropDownOpen = true;
         var be = ConditionBox.GetBindingExpression(ComboBox.TextProperty);
         be.UpdateSource();
     }
     if (e.Key == Key.Up && ConditionBox.IsDropDownOpen)
     {
         if (ConditionBox.SelectedIndex != -1)
         {
             ConditionBox.SelectedIndex = ConditionBox.SelectedIndex - 1;
             if (ConditionBox.SelectedIndex == -1)
             {
                 var be = ConditionBox.GetBindingExpression(ComboBox.TextProperty);
                 be.UpdateSource();
             }
         }
     }
     if (e.Key == Key.Down && ConditionBox.IsDropDownOpen)
     {
         if (ConditionBox.SelectedIndex < ConditionBox.Items.Count)
         {
             ConditionBox.SelectedIndex = ConditionBox.SelectedIndex + 1;
         }
     }
 }
        private void ConditionBox_OnTextInput(object sender, TextCompositionEventArgs textCompositionEventArgs)
        {
            ConditionBox.IsDropDownOpen = true;
            var be = ConditionBox.GetBindingExpression(ComboBox.TextProperty);

            be.UpdateSource();
        }
コード例 #5
0
        /// <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);
            }
        }
コード例 #6
0
        private FrmEditConfigurationCluster(Core core, ArgsClusterer def, bool readOnly, bool hideOptimise)
            : this()
        {
            this._core          = core;
            this._ecbPeakFilter = DataSet.ForPeakFilter(core).CreateComboBox(this._lstPeakFilter, this._btnPeakFilter, EditableComboBox.EFlags.IncludeAll);
            this._ecbObsFilter  = DataSet.ForObsFilter(core).CreateComboBox(this._lstObsFilter, this._btnObsFilter, EditableComboBox.EFlags.IncludeAll);
            this._ecbMethod     = DataSet.ForClustererAlgorithms(core).CreateComboBox(this._lstMethod, this._btnNewStatistic, EditableComboBox.EFlags.CreateSelection);
            this._ecbMeasure    = DataSet.ForMetricAlgorithms(core).CreateComboBox(this._lstMeasure, this._btnNewDistance, EditableComboBox.EFlags.IncludeNone);
            this._ecbSource     = DataSet.ForMatrixProviders(core).CreateComboBox(this._lstSource, this._btnSource, EditableComboBox.EFlags.None);
            this._cbStatistics  = DataSet.ForFlagsEnum <EClustererStatistics>(this._core, "Cluster Statistics").CreateConditionBox(this._txtStatistics, this._btnSetStatistics);
            this._readOnly      = readOnly;

            if (def != null)
            {
                // Name
                this._txtName.Text      = def.OverrideDisplayName;
                this._txtShortName.Text = def.OverrideShortName;

                // Comment
                this._comment = def.Comment;

                // Method
                this._ecbMethod.SelectedItem = (ClustererBase)def.GetAlgorithmOrNull();

                // Params
                this._txtParams.Text = AlgoParameterCollection.ParamsToReversableString(def.Parameters, core);

                // PeakFilter
                this._ecbPeakFilter.SelectedItem = def.PeakFilter;

                // Distance
                this._ecbMeasure.SelectedItem = def.Distance != null ? (MetricBase)def.Distance.Args.GetAlgorithmOrNull() : null;

                // Distance params
                this._txtMeasureParams.Text = StringHelper.ArrayToString(def.Distance?.Args.Parameters);

                // Suppress distance
                this._cbStatistics.SelectedItems = EnumHelper.SplitEnum <EClustererStatistics>(def.Statistics);

                // Input vector
                this._ecbSource.SelectedItem = def.SourceProvider;

                // ObsFilter
                this._ecbObsFilter.SelectedItem = def.ObsFilter;

                // Seperate groups
                this._chkSepGroups.Checked = def.SplitGroups;
            }

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

                this._btnParameterOptimiser.Visible = false;
                this._btnComment.Enabled            = true;
                this.ctlTitleBar1.Text = "View Clustering Algorithm";
            }
            else if (def != null)
            {
                this.ctlTitleBar1.Text = "Edit Clustering Algorithm";
            }
            else
            {
                this.ctlTitleBar1.Text = "New Clustering Algorithm";
            }

            this.CheckAndChange(null, null);

            // UiControls.CompensateForVisualStyles(this);

            if (hideOptimise)
            {
                this._btnParameterOptimiser.Visible = false;
                this._btnOk.Text = "Continue";
            }
        }
コード例 #7
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);
            }
        }
コード例 #8
0
ファイル: Choices.cs プロジェクト: Marin-MK/MK-API
        public List <BaseWidget> CreateWindow(dynamic Utility)
        {
            this.Text = new List <string>();
            foreach (object o in Utility.ParamAsArray("choices"))
            {
                this.Text.Add((string)o);
            }
            if (this.Text.Count < 8)
            {
                this.Text.AddRange(new string[8 - this.Text.Count]);
            }
            this.Conditions = Utility.HasParam("conditions") ? Utility.ParamAsArray("conditions") : new List <dynamic>();
            DisallowCancel  = Utility.ParamIsString("cancel") && Utility.ParamAsString("cancel") == ":disallow";
            BranchCancel    = Utility.ParamIsString("cancel") && Utility.ParamAsString("cancel") == ":branch";
            ChoiceCancel    = Utility.ParamIsInt("cancel") ? Utility.ParamAsInt("cancel") : -1;

            TabView         = new TabView("tabview");
            TabView.X       = 1;
            TabView.Y       = 24;
            TabView.Width   = 345;
            TabView.Height  = 306;
            SimpleContainer = TabView.NewTab("Simple");

            SimpleTooAdvancedLabel         = new MultilineLabel("tooadvanced", SimpleContainer);
            SimpleTooAdvancedLabel.X       = 30;
            SimpleTooAdvancedLabel.Y       = 105;
            SimpleTooAdvancedLabel.Width   = 285;
            SimpleTooAdvancedLabel.Text    = "There are active options in the Advanced tab. Please disable the advanced features, or use the Advanced tab.";
            SimpleTooAdvancedLabel.Visible = false;
            SimpleCancelLabel         = new Label("simplecancellabel", SimpleContainer);
            SimpleCancelLabel.X       = 252;
            SimpleCancelLabel.Y       = 4;
            SimpleCancelLabel.Text    = "On Cancel:";
            SimpleDisallowButton      = new RadioButton("simpledisallow", SimpleContainer);
            SimpleDisallowButton.X    = 252;
            SimpleDisallowButton.Y    = 21;
            SimpleDisallowButton.Text = "Disallow";
            SimpleDisallowButton.OnSelectionChanged += delegate()
            {
                if (SimpleDisallowButton.Selected)
                {
                    DisallowCancel = true;
                    BranchCancel   = false;
                    ChoiceCancel   = -1;
                    return(Sync(Utility));
                }
                return(Refresh());
            };
            SimpleBranchButton      = new RadioButton("simplebranch", SimpleContainer);
            SimpleBranchButton.X    = 252;
            SimpleBranchButton.Y    = 41;
            SimpleBranchButton.Text = "Branch";
            SimpleBranchButton.OnSelectionChanged += delegate()
            {
                if (SimpleBranchButton.Selected)
                {
                    DisallowCancel = false;
                    BranchCancel   = true;
                    ChoiceCancel   = -1;
                    return(Sync(Utility));
                }
                return(Refresh());
            };

            this.SimpleChoiceLabels    = new List <Label>();
            this.SimpleChoiceTextBoxes = new List <TextBox>();
            this.SimpleChoiceButtons   = new List <RadioButton>();

            List <object> choices = Utility.ParamAsArray("choices");

            for (int i = 0; i < 8; i++)
            {
                Label       label   = new Label($"choice{i + 1}label", SimpleContainer);
                TextBox     textbox = new TextBox($"choice{i + 1}text", SimpleContainer);
                RadioButton choice  = new RadioButton($"choice{i + 1}button", SimpleContainer);

                label.X    = 18;
                label.Y    = 14 + 33 * i;
                label.Text = $"Choice {i + 1}:";
                SimpleChoiceLabels.Add(label);

                textbox.X              = 77;
                textbox.Y              = 9 + 33 * i;
                textbox.Width          = 150;
                textbox.Height         = 27;
                textbox.OnTextChanged += delegate()
                {
                    choice.Enabled = !string.IsNullOrEmpty(textbox.Text);
                    this.Text[SimpleChoiceTextBoxes.IndexOf(textbox)] = textbox.Text;
                    int index = SimpleChoiceTextBoxes.IndexOf(textbox);
                    if (string.IsNullOrEmpty(textbox.Text))
                    {
                        this.Text.RemoveAt(index);
                        if (index < this.Conditions.Count)
                        {
                            this.Conditions.RemoveAt(index);
                        }
                    }
                    return(Refresh(choice, Sync(Utility)));
                };
                SimpleChoiceTextBoxes.Add(textbox);

                choice.X    = 252;
                choice.Y    = 61 + 20 * i;
                choice.Text = $"Choice {i + 1}";
                choice.OnSelectionChanged += delegate()
                {
                    if (choice.Selected)
                    {
                        DisallowCancel = false;
                        BranchCancel   = false;
                        ChoiceCancel   = SimpleChoiceButtons.IndexOf(choice);
                        return(Sync(Utility));
                    }
                    return(Refresh());
                };
                SimpleChoiceButtons.Add(choice);
            }

            AdvContainer                = TabView.NewTab("Advanced");
            AdvChoiceLabel              = new Label("choiceslabel", AdvContainer);
            AdvChoiceLabel.X            = 11;
            AdvChoiceLabel.Text         = "Choices:";
            AdvList                     = new List("choicelist", AdvContainer);
            AdvList.X                   = 8;
            AdvList.Y                   = 17;
            AdvList.Width               = 141;
            AdvList.Height              = 121;
            AdvList.OnSelectionChanged += delegate()
            {
                return(UpdateSelection());
            };
            for (int i = 0; i < choices.Count; i++)
            {
                AdvList.Items.Add((string)choices[i]);
            }
            AdvAddButton                   = new Button("add", AdvContainer);
            AdvAddButton.X                 = 4;
            AdvAddButton.Y                 = 138;
            AdvAddButton.Width             = 74;
            AdvAddButton.Height            = 31;
            AdvAddButton.Text              = "Add";
            AdvRemoveButton                = new Button("remove", AdvContainer);
            AdvRemoveButton.X              = 78;
            AdvRemoveButton.Y              = 138;
            AdvRemoveButton.Width          = 74;
            AdvRemoveButton.Height         = 31;
            AdvRemoveButton.Text           = "Remove";
            AdvEntryTextLabel              = new Label("textlabel", AdvContainer);
            AdvEntryTextLabel.X            = 157;
            AdvEntryTextLabel.Y            = 22;
            AdvEntryTextLabel.Text         = "Text:";
            AdvEntryTextLabel.Enabled      = false;
            AdvEntryTextBox                = new TextBox("textbox", AdvContainer);
            AdvEntryTextBox.X              = 187;
            AdvEntryTextBox.Y              = 17;
            AdvEntryTextBox.Width          = 150;
            AdvEntryTextBox.Height         = 27;
            AdvEntryTextBox.Enabled        = false;
            AdvEntryTextBox.OnTextChanged += delegate()
            {
                if (AdvList.Index == -1)
                {
                    return(Refresh());
                }
                AdvList.Items[AdvList.Index] = AdvEntryTextBox.Text;
                AdvTreatAsChoiceBox.Items    = AdvList.Items;
                this.Text[AdvList.Index]     = AdvEntryTextBox.Text;
                return(Refresh(AdvList, AdvTreatAsChoiceBox, Sync(Utility)));
            };
            AdvShowIfButton                 = new CheckBox("showif", AdvContainer);
            AdvShowIfButton.X               = 158;
            AdvShowIfButton.Y               = 49;
            AdvShowIfButton.Text            = "Show if:";
            AdvShowIfButton.Enabled         = false;
            AdvShowIfButton.OnCheckChanged += delegate()
            {
                AdvConditions.Enabled = AdvShowIfButton.Checked;
                if (!AdvShowIfButton.Checked)
                {
                    AdvConditions.Conditions = null;
                    if (AdvList.Index < this.Conditions.Count)
                    {
                        this.Conditions[AdvList.Index] = null;
                    }
                }
                AdvEditConditionsButton.Enabled = AdvShowIfButton.Checked;
                return(Refresh(AdvConditions, AdvEditConditionsButton, Sync(Utility)));
            };
            AdvConditions                      = new ConditionBox("conditions", AdvContainer);
            AdvConditions.X                    = 178;
            AdvConditions.Y                    = 68;
            AdvConditions.Width                = 159;
            AdvConditions.Height               = 65;
            AdvConditions.Enabled              = false;
            AdvConditions.OnConditionsChanged += delegate()
            {
                if (AdvConditions.Conditions.Count == 0)
                {
                    AdvShowIfButton.Checked = false;
                    if (AdvList.Index < Conditions.Count)
                    {
                        Conditions[AdvList.Index] = null;
                    }
                }
                else
                {
                    if (AdvList.Index < Conditions.Count)
                    {
                        Conditions[AdvList.Index] = AdvConditions.Conditions;
                    }
                    else
                    {
                        for (int i = Conditions.Count; i < AdvList.Index; i++)
                        {
                            Conditions.Add(null);
                        }
                        Conditions.Add(AdvConditions.Conditions);
                    }
                }
                return(Refresh(AdvShowIfButton, Sync(Utility)));
            };
            AdvEditConditionsButton            = new Button("editconditions", AdvContainer);
            AdvEditConditionsButton.X          = 282;
            AdvEditConditionsButton.Y          = 133;
            AdvEditConditionsButton.Width      = 59;
            AdvEditConditionsButton.Height     = 31;
            AdvEditConditionsButton.Text       = "Edit";
            AdvEditConditionsButton.Enabled    = false;
            AdvEditConditionsButton.OnPressed += delegate()
            {
                AdvConditions.Open();
                return(Refresh());
            };
            AdvCancelLabel         = new Label("advcancellabel", AdvContainer);
            AdvCancelLabel.X       = 8;
            AdvCancelLabel.Y       = 172;
            AdvCancelLabel.Text    = "When cancelled:";
            AdvDisallowButton      = new RadioButton("advdisallow", AdvContainer);
            AdvDisallowButton.X    = 9;
            AdvDisallowButton.Y    = 192;
            AdvDisallowButton.Text = "Disallow";
            AdvDisallowButton.OnSelectionChanged += delegate()
            {
                if (AdvDisallowButton.Selected)
                {
                    DisallowCancel = true;
                    BranchCancel   = false;
                    ChoiceCancel   = -1;
                    return(Sync(Utility));
                }
                return(Refresh());
            };
            AdvBranchButton      = new RadioButton("advbranch", AdvContainer);
            AdvBranchButton.X    = 9;
            AdvBranchButton.Y    = 212;
            AdvBranchButton.Text = "Branch";
            AdvBranchButton.OnSelectionChanged += delegate()
            {
                if (AdvBranchButton.Selected)
                {
                    DisallowCancel = false;
                    BranchCancel   = true;
                    ChoiceCancel   = -1;
                    return(Sync(Utility));
                }
                return(Refresh());
            };
            AdvTreatAsChoiceButton      = new RadioButton("advtreataschoice", AdvContainer);
            AdvTreatAsChoiceButton.X    = 9;
            AdvTreatAsChoiceButton.Y    = 232;
            AdvTreatAsChoiceButton.Text = "Treat as choice";
            AdvTreatAsChoiceButton.OnSelectionChanged += delegate()
            {
                if (AdvTreatAsChoiceButton.Selected)
                {
                    DisallowCancel = false;
                    BranchCancel   = false;
                    ChoiceCancel   = 0;
                    return(Sync(Utility));
                }
                return(Refresh());
            };
            AdvTreatAsChoiceBox                    = new Dropdown("advchoicebox", AdvContainer);
            AdvTreatAsChoiceBox.X                  = 30;
            AdvTreatAsChoiceBox.Y                  = 251;
            AdvTreatAsChoiceBox.Width              = 123;
            AdvTreatAsChoiceBox.Height             = 25;
            AdvTreatAsChoiceBox.Items              = AdvList.Items;
            AdvOutcomeLabel                        = new Label("outcome", AdvContainer);
            AdvOutcomeLabel.X                      = 172;
            AdvOutcomeLabel.Y                      = 195;
            AdvOutcomeLabel.Text                   = "Outcome:";
            AdvBranchCommandButton                 = new CheckBox("branchcommand", AdvContainer);
            AdvBranchCommandButton.X               = 173;
            AdvBranchCommandButton.Y               = 212;
            AdvBranchCommandButton.Text            = "Branch this command";
            AdvBranchCommandButton.Checked         = true;
            AdvBranchCommandButton.OnCheckChanged += delegate()
            {
                return(Sync(Utility));
            };
            if (Utility.HasParam("branch") && !Utility.ParamAsBool("branch"))
            {
                AdvBranchCommandButton.Checked = false;
            }
            AdvStoreInVariableButton      = new CheckBox("storeinvar", AdvContainer);
            AdvStoreInVariableButton.X    = 173;
            AdvStoreInVariableButton.Y    = 232;
            AdvStoreInVariableButton.Text = "Store in Game Variable";
            if (Utility.HasParam("variable") && Utility.ParamIsHash("variable"))
            {
                AdvStoreInVariableButton.Checked = true;
            }
            AdvStoreInVariableButton.OnCheckChanged += delegate()
            {
                AdvVariablePicker.Enabled = AdvStoreInVariableButton.Checked;
                return(Sync(Utility));
            };
            AdvVariablePicker         = new VariablePicker("variablepicker", AdvContainer);
            AdvVariablePicker.X       = 194;
            AdvVariablePicker.Y       = 251;
            AdvVariablePicker.Width   = 143;
            AdvVariablePicker.Height  = 25;
            AdvVariablePicker.Enabled = false;
            if (AdvStoreInVariableButton.Checked)
            {
                AdvVariablePicker.GroupID    = (int)Utility.ParamAsHash("variable")[":group_id"];
                AdvVariablePicker.VariableID = (int)Utility.ParamAsHash("variable")[":variable_id"];
                AdvVariablePicker.Enabled    = true;
            }

            return(Refresh(TabView,
                           SimpleContainer,
                           SimpleTooAdvancedLabel, SimpleCancelLabel, SimpleDisallowButton, SimpleBranchButton, SimpleChoiceLabels, SimpleChoiceTextBoxes, SimpleChoiceButtons,
                           AdvContainer,
                           AdvChoiceLabel, AdvAddButton, AdvRemoveButton, AdvEntryTextLabel, AdvShowIfButton, AdvConditions, AdvEditConditionsButton,
                           AdvCancelLabel, AdvOutcomeLabel, AdvBranchCommandButton, AdvStoreInVariableButton, AdvVariablePicker, Sync(Utility)));
        }