private void saveButton_Click(object sender, EventArgs e) { string name = shortcutCombobox.Text; if (name.Trim() != "" && name.Trim() != "<New...>") { SpecialCommandConfigurationElement shortcut = shortucts[name]; if (shortcut == null) { shortcut = new SpecialCommandConfigurationElement(); } shortcut.Name = name.Trim(); shortcut.Executable = executableTextBox.Text; shortcut.WorkingFolder = workingFolderTextBox.Text; shortcut.Arguments = argumentsTextBox.Text; string imageName = Path.GetFileName(shortcut.Executable) + ".ico"; string imageFullName = Path.Combine(FileLocations.ThumbsDirectoryFullPath, imageName); if (this.iconPicturebox.Image != null) { try { this.iconPicturebox.Image.Save(imageFullName); } catch (Exception exc) { Logging.Error("Saving icon picture box failed", exc); imageFullName = ""; } } else { imageFullName = ""; } shortcut.Thumbnail = imageFullName; shortucts.Remove(shortcut); shortucts.Add(shortcut); settings.SpecialCommands = shortucts; shortucts = settings.SpecialCommands; } }
private void deleteButton_Click(object sender, EventArgs e) { string name = shortcutCombobox.Text; if (name.Trim() != "" && name.Trim() != "<New...>") { SpecialCommandConfigurationElement shortcut = shortucts[name]; if (shortcut != null) { shortucts.Remove(shortcut); Settings.SpecialCommands = shortucts; shortucts = Settings.SpecialCommands; } } LoadShortcuts(); }