private void btnAdd_Click(object sender, EventArgs e) { frmWebsiteEdit webEdit = new frmWebsiteEdit(parentForm) { FormMode = frmWebsiteEdit.EditMode.Add }; webEdit.lblLastChecked.Text = DateTime.Now.ToShortDateString(); webEdit.ShowDialog(); webEdit.Dispose(); DrawWebsiteList(); //fillWWebsiteList(); }
private void Edit() { if (SelectedIndex <= olvWebsites.Items.Count && olvWebsites.SelectedItem != null) //s.Count > 0) { //// get index of entry for editing //for (int i = 0; i < lvWebsites.Items.Count; i++) //{ // if (((WebsiteInfo)lvWebsites.Items[i].Tag).Name == ((WebsiteInfo)lvWebsites.SelectedItems[0].Tag).Name) // { // SelectedIndex = i; // break; // } //} // fill in form frmWebsiteEdit frmEdit = new frmWebsiteEdit(parentForm) { Editndex = SelectedIndex, FormMode = frmWebsiteEdit.EditMode.Edit }; frmEdit.txtName.Text = ((WebsiteInfo)olvWebsites.SelectedItem.RowObject).Name; frmEdit.txtURL.Text = ((WebsiteInfo)olvWebsites.SelectedItem.RowObject).URL; frmEdit.lblLastChecked.Text = ((WebsiteInfo)olvWebsites.SelectedItem.RowObject).LastVisited.ToShortDateString(); frmEdit.cbDone.Checked = ((WebsiteInfo)olvWebsites.SelectedItem.RowObject).Done; frmEdit.Focus(); frmEdit.ShowDialog(); //Setting.SaveSettings(string.Empty, this.parentForm.settings); parentForm.SaveSettings(string.Empty, this.parentForm.settings); frmEdit.Dispose(); DrawWebsiteList(); //fillWWebsiteList(); } }
private void DragDropURL(object sender, DragEventArgs e) { //string[] s = (string[])e.Data.GetData(DataFormats.Text, false); string url = e.Data.GetData(DataFormats.Text, false).ToString(); if (url.ToUpper(CultureInfo.InvariantCulture).Contains("HTTP") == false) { return; } // check if its already in the Websites list for (int i = 0; i < parentForm.settings.Websites.Count; i++) { if (parentForm.settings.Websites[i].URL.Contains(url) == true) { // already in the list MessageBox.Show("Website is already in the list."); return; } } frmWebsiteEdit webEdit = new frmWebsiteEdit(parentForm) { FormMode = frmWebsiteEdit.EditMode.Add }; webEdit.lblLastChecked.Text = DateTime.Now.ToShortDateString(); webEdit.txtURL.Text = url; webEdit.Focus(); webEdit.ShowDialog(); webEdit.Dispose(); DrawWebsiteList(); //fillWWebsiteList(); }