Example #1
0
        private void listSplits_SelectedIndexChanged(object sender, EventArgs e)
        {
            panelSplitEdit.Controls.Clear();
            var index = listSplits.SelectedIndices.Count == 0 ? -1 : listSplits.SelectedIndices[0];
            var rule  = index < 0 ? null : settings.SplitRules[index];

            SplitRuleEditControl editControl = rule switch
            {
                null => new EmptySplitRuleControl(autosplitter),
                SplitRuleGettingCards gc => new GettingCardsEditControl(gc, database),
                SplitRuleGettingFairiesOfClass gfoc => new GettingFairiesOfClassEditControl(gfoc, database),
                SplitRuleGettingTotalFairies gtf => new GettingTotalFairiesEditControl(gtf, database),
                SplitRuleReaching r => new ReachingEditControl(r, database),
                SplitRuleDefeating d => new DefeatingEditControl(d, database),
                SplitRuleWatching w => new WatchingEditControl(w, database),
                _ => throw new NotImplementedException($"Unimplemented edit control for {rule}")
            };

            if (editControl == null)
            {
                return;
            }

            editControl.Dock = DockStyle.Fill;
            if (index >= 0)
            {
                editControl.OnRuleChanged += () => ModifySplitItem(listSplits.Items[index], index, rule);
            }
            panelSplitEdit.Controls.Add(editControl);
        }
Example #2
0
        public GettingTotalFairiesEditControl(SplitRuleGettingTotalFairies rule, Database database)
        {
            this.rule     = rule;
            this.database = database;
            InitializeComponent();

            numericAmount.Value = rule.Amount;
            pictureBox.Image    = rule.GetIcon(database);
            isInitialised       = true;
        }