private void cbProfile_DropDown(object sender, EventArgs e) { cbProfile.Items.Clear(); profiles.Clear(); //просканируем каталог на наличие файлов. string Catalog = string.Format("{0}\\profiles", Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); if (!Directory.Exists(Catalog)) { return; } string[] MyFiles = Directory.GetFiles(Catalog, @"*.*", SearchOption.AllDirectories); //parse finded files foreach (string filename in MyFiles) { profile tmp = new profile(filename); profiles.Add(tmp); } //add elements to droplist foreach (profile VARIABLE in profiles) { cbProfile.Items.Add(VARIABLE.Name); } }
private void cbProfile_SelectedIndexChanged(object sender, EventArgs e) { int curr = cbProfile.SelectedIndex; if (curr == -1) { return; } CurrProfile = profiles[curr]; //if (CurrProfile != null) myToolTip1.SetToolTip(btEditProfile, CurrProfile.Text); }
private void btOpenProfile_Click(object sender, EventArgs e) { int curr = cbProfile.SelectedIndex; if (curr == -1) { return; } CurrProfile = profiles[curr]; ProfileEditor pfEditor = new ProfileEditor(); pfEditor.textBoxFileProfile.Text = CurrProfile.FileName; pfEditor.Show(); pfEditor.LoadDataFromFile(); }