//从文件夹中读取图像增强方案的文件名,并显示 private void ParseEnhanceDirectory(string path) { string[] files = Directory.GetFiles(path, "*.xml", SearchOption.AllDirectories); if (files == null || files.Length == 0) { return; } string fname = string.Empty; foreach (string fi in files) { fname = Path.GetFileNameWithoutExtension(fi); string[] parts = fname.Split('_'); int count = parts.Length; RadGalleryItem item = null; switch (count) { case 5: { item = new RadGalleryItem(" " + parts[0] + "_" + parts[1] + "\n" + parts[2] + "_" + parts[3] + "\n " + parts[4]); break; } case 4: //"火情_EOST_MODIS_夏晚上.xml",信息齐全 { item = new RadGalleryItem(" " + parts[0] + "\n" + parts[1] + "_" + parts[2] + "\n " + parts[3]); break; } case 3: //"火情_EOST_MODIS.xml",没有时间信息 { item = new RadGalleryItem(" " + parts[0] + "\n" + parts[1] + "_" + parts[2]); break; } case 2: //"火情_EOST.xml",没有传感器信息 { item = new RadGalleryItem(" " + parts[0] + "\n" + parts[1]); break; } case 1: //"火情.xml",只有当前产品标识 { item = new RadGalleryItem(" " + parts[0]); break; } default: continue; } item.Tag = fi; item.Click += new EventHandler(item_Click); _galItemList.Add(item); } }
//应用图像增强方案 void item_Click(object sender, EventArgs e) { RadGalleryItem item = sender as RadGalleryItem; if (item == null) { return; } string enhanceName = item.Tag.ToString(); if (string.IsNullOrEmpty(enhanceName)) { return; } ICommand cmd = _session.CommandEnvironment.Get(9112); if (cmd != null) { cmd.Execute(enhanceName); } }
void changeThemes(object sender, EventArgs e) { RadGalleryItem element = sender as RadGalleryItem; ThemeResolutionService.ApplicationThemeName = element.Text; }