예제 #1
0
        private void filesComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!Storage.FilesLoaded)
            {
                return;
            }

            Storage.SelectFile(filesComboBox.SelectedIndex);

            //Hide all forms
            ItemGroupControl.Visible   = false;
            GenericItemControl.Visible = false;
            RecipeControl.Visible      = false;
            HideItemExtensions();

            //Show appropriate forms
            string ffilename = Path.GetFileName(Storage.CurrentFileName);

            if (Storage.CurrentFileIsItems)
            {
                WinformsUtil.ControlsResetValues(GenericItemControl.Controls[0]);
                GenericItemControl.Visible = true;
            }
            else if (ffilename.Equals("item_groups.json"))
            {
                ItemGroupControl.Visible = true;
            }
            else if (ffilename.Equals("recipes.json"))
            {
                RecipeControl.Visible = true;
            }

            //Prepare item box
            entriesListBox.ClearSelected();
            entriesListBox.DataSource    = Storage.OpenItems;
            entriesListBox.DisplayMember = "Display";

            //Load first item
            entriesListBox.SelectedIndex = 0;
            HideItemExtensions();
            Storage.LoadItem(entriesListBox.SelectedIndex);
        }
예제 #2
0
        private void filesComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!Storage.FilesLoaded)
            {
                return;
            }

            Storage.SelectFile(filesComboBox.SelectedIndex);

            //Hide all forms
            Storage.HideAllControls();
            HideItemExtensions();

            //Show appropriate forms
            CataFile fdef = Storage.GetFileDefForCurrentFile();

            if (fdef != null)
            {
                if (fdef.control != null)
                {
                    WinformsUtil.ControlsResetValues(fdef.control);
                    fdef.control.Visible = true;
                }
            }

            //Prepare item box
            entriesListBox.ClearSelected();
            entriesListBox.DataSource    = Storage.OpenItems;
            entriesListBox.DisplayMember = "Display";

            //Load first item
            HideItemExtensions();
            if (entriesListBox.Items.Count > 0)
            {
                entriesListBox.SelectedIndex = 0;
                Storage.LoadItem(entriesListBox.SelectedIndex);
            }
        }