/// <summary> /// When the form is closing by user, update the url in database by passing the item in listBox and removeList. /// The item in listBox might contain both existed and new added url /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void form_FormClosing(object sender, FormClosingEventArgs e) { List <string> existed = lb_RssUrlStore.Items.Cast <string>().ToList(); if (e.CloseReason == CloseReason.UserClosing) { RssFeedReader.updateUrlInDb(existed, removeList); Action instance = actionMainForm; if (instance != null) { instance(); } } }