private void OpenLibrary() { OpenMapDialog.RestoreDirectory = true; OpenMapDialog.Filter = "Library(*.dll)|*.dll"; if (OpenMapDialog.ShowDialog() == DialogResult.OK) { string filename = Path.GetFileNameWithoutExtension(OpenMapDialog.FileName); CurrentLibLbl.Text = OpenMapDialog.FileName; CurrentLibrary = Assembly.LoadFile(OpenMapDialog.FileName); try { StreamReader s = new StreamReader(CurrentLibrary.GetManifestResourceStream("ImageLibrary.mf")); ImageList l = new ImageList(); listView1.SmallImageList = l; listView1.LargeImageList = l; while (!s.EndOfStream) { //LibViewTree.Nodes.Add(s.ReadLine()); string[] attributes = (s.ReadLine()).Split(':'); string name = attributes[0]; l.Images.Add(Image.FromStream(CurrentLibrary.GetManifestResourceStream(name))); listView1.Items.Add(new ListViewItem(name, l.Images.Count - 1)); } } catch (Exception) { MessageBox.Show("This library is incompatible or corrupted."); listView1.Items.Clear(); } } }
public void BrowseMaps() { OpenMapDialog.Filter = "Tiff files (*.tiff)|*.tif|All files (*.*)|*.*"; OpenMapDialog.RestoreDirectory = true; OpenMapDialog.InitialDirectory = LocalMapDir; if (OpenMapDialog.ShowDialog() == DialogResult.OK) { this.MapBox.Image = this.OpenImageFile(OpenMapDialog.FileName, MapBox.Size); CurrentImage = OpenMapDialog.FileName; } }
private void openToolStripMenuItem1_Click(object sender, EventArgs e) { OpenMapDialog dialog = new OpenMapDialog(_controller.State.Info.Name); var res = dialog.ShowDialog(); if (res == DialogResult.OK) { var id = dialog.Result; ProcessMapForm form = new ProcessMapForm(_controller, id); form.ShowDialog(); } }