//-------------------------------------------------------------------------------- private void buttonAddSync_Click(object sender, EventArgs e) { List <string> strings = new List <string>(); strings.Add("Sync Item 1"); strings.Add("Sync Item 2"); strings.Add("Sync Item 3"); FormAddSyncItem form = new FormAddSyncItem(strings); form.ShowDialog(); }
//-------------------------------------------------------------------------------- /// <summary> /// Fired when the user clicks the Add button. Displays the Add/Edit Sync Item /// form. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonAddSync_Click(object sender, EventArgs e) { List <string> strings = new List <string>(); foreach (SyncItem item in this.m_settings.SyncItems) { strings.Add(item.ToString()); } FormAddSyncItem form = new FormAddSyncItem(null, strings); if (form.ShowDialog() == DialogResult.OK && form.SyncItem != null) { this.m_settings.SyncItems.Add(form.SyncItem); AddSyncItem(form.SyncItem); } }
//-------------------------------------------------------------------------------- /// <summary> /// Fired when the user clicks the Edit button. Displays the Add/Edit Sync Item /// form. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonEditSync_Click(object sender, EventArgs e) { List <string> strings = new List <string>(); foreach (SyncItem item in this.m_settings.SyncItems) { strings.Add(item.ToString()); } if (this.listViewSyncItems.SelectedItems.Count > 0) { SyncItem syncItem = (SyncItem)(this.listViewSyncItems.SelectedItems[0].Tag); FormAddSyncItem form = new FormAddSyncItem(syncItem, strings); if (form.ShowDialog() == DialogResult.OK && form.SyncItem != null) { this.listViewSyncItems.SelectedItems[0].SubItems[0].Text = form.SyncItem.Name; this.listViewSyncItems.SelectedItems[0].SubItems[1].Text = form.SyncItem.SyncToPath; this.listViewSyncItems.SelectedItems[0].SubItems[2].Text = form.SyncItem.SyncFromPath; this.listViewSyncItems.SelectedItems[0].SubItems[3].Text = form.SyncItem.SyncSubfolders.ToString(); this.listViewSyncItems.SelectedItems[0].SubItems[4].Text = form.SyncItem.BackupBeforeSync.ToString(); this.listViewSyncItems.SelectedItems[0].SubItems[5].Text = form.SyncItem.DeleteAfterSync.ToString(); } } }