示例#1
0
        private void btnListFields_Click(object sender, EventArgs e)
        {
            itemListerDialog ild = new itemListerDialog(this);

            ild.items             = availFields;
            btnListFields.Enabled = false;
            ild.Show();
            //MessageBox.Show(string.Join("\n", availFields));
        }
示例#2
0
 private void frmPairRelDB_Load(object sender, EventArgs e)
 {
     itmL     = new itemListerDialog(this);
     slash    = Path.DirectorySeparatorChar.ToString();
     usdaRoot = $"{Application.StartupPath}{slash}usr{slash}share{slash}DBs{slash}USDAstock";
     string[] dbs = Directory.GetDirectories($"{Application.StartupPath}{slash}usr{slash}profile{frmMain.currentUser.index}{slash}lib{slash}fields");
     foreach (string s in dbs)
     {
         string db = s.Split(Path.DirectorySeparatorChar)[s.Split(Path.DirectorySeparatorChar).Length - 1];
         if (!db.StartsWith("_"))
         {
             comboFields.Items.Add(db);
         }
     }
     if (comboFields.Items.Count == 0)
     {
         MessageBox.Show("Please create some fields before using this form.");
         this.Close();
     }
     comboFields.SelectedIndex = 0;
 }
示例#3
0
        private void btnBegin_Click(object sender, EventArgs e)
        {
            if (btnBegin.Text == "Begin")
            {
                btnBegin.Visible       = false;
                comboFields.Enabled    = false;
                lblTweak.Visible       = true;
                txtTweak.Visible       = true;
                lblNum.Visible         = true;
                numUpDownIndex.Visible = true;
                lblFieldVal.Visible    = true;

                string[] usdaNutKeyPairLines = File.ReadAllLines($"{usdaRoot}{slash}_nutKeyPairs.TXT");
                foreach (string s in usdaNutKeyPairLines)
                {
                    if (s.Split('|')[1] == "FoodName")
                    {
                        usdaDB.names = File.ReadAllLines($"{usdaRoot}{slash}{s.Split('|')[0]}");
                    }
                    else if (s.Split('|')[1] == "NDBNo")
                    {
                        usdaDB.ndbs = File.ReadAllLines($"{usdaRoot}{slash}{s.Split('|')[0]}");
                    }
                }

                storLoc       = $"{Application.StartupPath}{slash}usr{slash}profile{frmMain.currentUser.index}{slash}DBs{slash}_par_f{slash}{comboFields.Text}.TXT";
                txtTweak.Text = fobjs[_n].foodName;
                itmL.items    = new List <string>();
                foreach (_diskEntry d in diskEntries)
                {
                    if (d.fIndex == _n)
                    {
                        for (int i = 0; i < usdaDB.ndbs.Length; i++)
                        {
                            if (d.ndb == usdaDB.ndbs[i])
                            {
                                itmL.items.Add($"{d.ndb} -- {usdaDB.names[i]}");
                            }
                        }
                    }
                }
                btnBegin.Text    = $"List {itmL.items.Count} Pairs";
                btnBegin.Visible = true;
            }
            else if (itmL.items.Count > 0)
            {
                itmL       = new itemListerDialog(this);
                itmL.items = new List <string>();
                foreach (_diskEntry d in diskEntries)
                {
                    if (d.fIndex == _n)
                    {
                        for (int i = 0; i < usdaDB.ndbs.Length; i++)
                        {
                            if (d.ndb == usdaDB.ndbs[i])
                            {
                                itmL.items.Add($"{d.ndb} -- {usdaDB.names[i]}");
                            }
                        }
                    }
                }
                itmL.Show();
            }
        }