예제 #1
0
 public static void TestAllItems()
 {
     for (int c = 0; c < openFiles.Length; c++)
     {
         CataFile fileDef = GetFileDefForOpenFile(c);
         if (fileDef != null && fileDef.control != null)
         {
             for (int d = 0; d < openItems[c].Count; d++)
             {
                 WinformsUtil.ControlsLoadItem(fileDef.control, openItems[c][d].data);
             }
         }
     }
     MessageBox.Show("Done");
 }
예제 #2
0
        /// <summary>
        /// Load up one item from current file's JSON.
        /// </summary>
        /// <param name="id"></param>
        public static void LoadItem(int index)
        {
            if (index < 0)
            {
                return;
            }

            currentItemIndex = index;

            CataFile fileDef = GetFileDefForOpenFile(currentFileIndex);

            if (fileDef != null && fileDef.control != null)
            {
                WinformsUtil.ControlsLoadItem(fileDef.control, CurrentItemData);
            }
        }
예제 #3
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);
            }
        }