Ejemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            formController = new FormController(this);
            currentState   = State.Viewing;

            ShowFileControls(false);
            ToggleAllControls(false);
        }
Ejemplo n.º 2
0
 private bool TryInitializingTraitsDataGridViews(FormController formController)
 {
     if (formController?.LoadedBackstoryFile?.SelectedBackstory is Backstory backstory)
     {
         dataGridViewTraitsDisallowed.DataSource = backstory.disallowedTraits;
         dataGridViewTraitsForced.DataSource     = backstory.forcedTraits;
         return(true);
     }
     return(false);
 }
Ejemplo n.º 3
0
        private void UpdateListBox(FormController formController)
        {
            BindingList <string> defNames = new BindingList <string>();

            foreach (var def in formController.LoadedBackstoryFile.Backstories)
            {
                defNames.Add(def.defName);
            }
            listBox1.DataSource = defNames;
        }
Ejemplo n.º 4
0
 private bool TryInitializingTraitsComboboxes(FormController formController)
 {
     if (formController?.LoadedTraitEntryFile?.entries is List <TraitEntry> entries)
     {
         comboBoxTraitsForced.DataSource      = new List <TraitEntry>(entries);
         comboBoxTraitsForced.DisplayMember   = "label";
         comboBoxTraitsDisabled.DataSource    = new List <TraitEntry>(entries);
         comboBoxTraitsDisabled.DisplayMember = "label";
         return(true);
     }
     return(false);
 }
Ejemplo n.º 5
0
        private void UpdateComboboxesAndDataViews(FormController formController)
        {
            var currentIndex = listBox1.SelectedIndex;

            //var realIndex = currentIndex % defNames.ToArray().Length;
            if (listBox1.SelectedIndex >= 0)
            {
                TryUpdatingBackstoryListBoxIndex(listBox1.SelectedIndex);

                if (!TryInitializingTraitsComboboxes(formController))
                {
                    throw new Exception("Failed to initialize trait comboboxes.");
                }
                if (!TryInitializingTraitsDataGridViews(formController))
                {
                    MessageBox.Show("Failed to initialize trait data grid views." + "\n\n" + Environment.StackTrace.ToString());
                }
            }

            currentState = State.Viewing;
        }