private void Form1_FormClosing(object sender, FormClosingEventArgs e) { File.WriteAllText("../../Token.json", Newtonsoft.Json.JsonConvert.SerializeObject(Token)); if (Application.OpenForms[settingForm.Name] != null) { settingForm.Dispose(); } Properties.Settings.Default.Save(); }