/// <summary> /// Save all contacts to contactfile /// Asks what type of contactfile /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void menuSaveToFile_Click(object sender, EventArgs e) { int filetype; FileTypeForm ft = new FileTypeForm(); DialogResult answer = ft.ShowDialog(); if (answer == DialogResult.OK) { filetype = ft.getFileType(); FileFunctions.saveToContactFile(ref contactlist, filetype); } contactlist.Updated = false; }
/// <summary> /// Saves the contacts selected in the listview /// Asks what type of contactfile /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void menuSaveSelected_Click(object sender, EventArgs e) { int filetype; FileTypeForm ft = new FileTypeForm(); DialogResult answer = ft.ShowDialog(); if (answer == DialogResult.OK) { string[] selectedRows; ContactList selectedContacts = new ContactList(); filetype = ft.getFileType(); foreach (ListViewItem item in listContacts.SelectedItems) { selectedRows = new string[listContacts.SelectedItems.Count]; selectedContacts.addcontact(item.SubItems[0].Text, item.SubItems[1].Text, item.SubItems[2].Text, item.SubItems[3].Text, item.SubItems[4].Text, item.SubItems[5].Text); } FileFunctions.saveToContactFile(ref selectedContacts, filetype); } contactlist.Updated = false; }