public void OnWindowClosing() { // isPingInProcess is also use to cancel task isPingInProcess = false; // save ip address data if there are changes List <IPProfile> iplist = new List <IPProfile>(IPListOC); if (IPManager.HasChangesToFile(iplist)) { string title = (string)Application.Current.FindResource("ip_title"); string ask_save = (string)Application.Current.FindResource("ip_ask_save_data"); View.DialogButton dialog = new View.DialogButton(title, ask_save); dialog.ShowDialog(); if (dialog.CancelableResult == true) { IPManager.IPList = iplist; IPManager.Save(); } else { // TODO - Is ObservableCollection write data to list item? IPManager.Reload(); } } }
private void saveData(object parameter) { List <IPProfile> iplist = new List <IPProfile>(IPListOC); if (IPManager.HasChangesToFile(iplist)) { IPManager.IPList = iplist; IPManager.Save(); } }