// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public void getProfiles() { ui.log("ProfileHandler.getProfiles()"); profiles = new List <ProfileVO>(); ui.log("------"); string [] fileEntries = Directory.GetFiles("profiles"); foreach (string fileName in fileEntries) { ProfileVO profile = new ProfileVO(); profile.displayName = fileName.Replace("profiles\\", ""); profile.displayName = profile.displayName.Replace(".xml", ""); profile.fileName = fileName; profiles.Add(profile); ui.log("\t" + profile.displayName); } ui.log("------"); cbProfiles.DataSource = profiles; cbProfiles.DisplayMember = "displayName"; cbProfiles.ValueMember = "fileName"; //cbProfiles }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - private void profileSelectionChangeHandler(object sender, System.EventArgs e) { ui.log("ProfileHandler.profileSelectionChangeHandler()"); //cbProfiles.Select(0, 0); // Doesn't work //cbProfiles.SelectionLength = 0; // Doesn't work ui.getListViewCommands().Focus(); //Console.WriteLine(cbProfiles.SelectedIndex); ProfileVO vo = (ProfileVO)cbProfiles.Items[cbProfiles.SelectedIndex]; Console.WriteLine(vo.displayName); load(vo.displayName); }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public void load(String arg) { ui.log("ProfileHandler.load(" + arg + ")"); profileName = arg; file = "profiles/" + profileName + ".xml"; //file = arg; //profileName = file.Replace("profiles\\",""); //profileName = profileName.Replace(".xml", ""); xmlDoc = new XmlDocument(); //xmlDoc.Load("profiles/" + profileName + ".xml"); xmlDoc.Load(file); xmlString = xmlDoc.InnerXml; commands = xmlDoc.SelectNodes("//command"); //ui.grammarHandler.clear(); ui.grammarHandler.grammarLoaded += new EventHandler(grammarLoadedHandler); ui.grammarHandler.loadCommands(commands, profileName); //ui.log("#### profileName = " + profileName); //ui.log("#### file = " + file); //cbProfiles.SelectedValue = "default"; //cbProfiles.SelectedItem = "default"; //foreach (ProfileVO vo in cbProfiles.Items) for (int i = 0; i < cbProfiles.Items.Count; i++) { //Console.WriteLine(cbProfiles.Items[i].GetType()); ProfileVO vo = (ProfileVO)cbProfiles.Items[i]; //ui.log("#### vo = " + vo.displayName); if (vo.displayName == profileName) { cbProfiles.SelectedIndex = i; } } }