void btnAddProfileOnClick(object sender, EventArgs e) { try { String newSize = new Prompt("Enter new Size in format width:height").ShowDialog(this); if (!String.IsNullOrEmpty(newSize) && newSize.Contains(":")) { String[] splittedSize = newSize.Split(':'); var size = new Size(Convert.ToInt32(splittedSize[0]), Convert.ToInt32(splittedSize[1])); profiles.Add(size); String profilesJson = JsonConvert.SerializeObject(profiles); File.WriteAllText(filePath, profilesJson); } } catch (Exception ex) { new Alert(ex.Message).ShowDialog(); } }