| 141 | } |
| 142 | |
| 143 | private void cmdOpenFile_Click(object sender, EventArgs e) |
| 144 | { |
| 145 | if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.LastWinMDPath)) |
| 146 | { |
| 147 | openFileDialog.InitialDirectory = Path.GetDirectoryName(Properties.Settings.Default.LastWinMDPath); |
| 148 | } |
| 149 | |
| 150 | var result = openFileDialog.ShowDialog(); |
| 151 | if (result != System.Windows.Forms.DialogResult.Cancel) |
| 152 | { |
| 153 | namespaceList.Items.Clear(); |
| 154 | try |
| 155 | { |
| 156 | LoadNamespaces(openFileDialog.FileName); |
| 157 | |
| 158 | txtFilename.Text = openFileDialog.FileName; |
| 159 | Properties.Settings.Default.LastWinMDPath = openFileDialog.FileName; |
| 160 | Properties.Settings.Default.Save(); |
| 161 | |
| 162 | } |
| 163 | catch (TypeLoadException ex) |
| 164 | { |
| 165 | MessageBox.Show("Failed to load winmetadata information! \n" + |
| 166 | "Error details: " + ex.Message, "WinMD load error", MessageBoxButtons.OK, MessageBoxIcon.Error); |
| 167 | ClearSettingsAndUI(); |
| 168 | |
| 169 | System.Diagnostics.Process.Start(Application.ExecutablePath); |
| 170 | this.Close(); |
| 171 | } |
| 172 | catch (Exception ex) |
| 173 | { |
| 174 | MessageBox.Show("Error occurred when loading WinMD file: \n" + |
| 175 | ex.Message, "Failed to load WinMd file", MessageBoxButtons.OK, MessageBoxIcon.Error); |
| 176 | } |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | private void cmdGenerate_Click(object sender, EventArgs e) |
| 181 | { |