Example #1
0
        private void EditHost()
        {
            if (listView1.SelectedItems.Count > 0)
            {
                int id    = Convert.ToInt16(listView1.SelectedItems[0].SubItems[1].Text);
                var query = from h in Hosts
                            where h.Id == id
                            select h;

                EditHostForm editHostForm = new EditHostForm();
                editHostForm.HostItem = query.Single();
                editHostForm.LoadData();
                editHostForm.ShowDialog();

                if (editHostForm.Edited == true)
                {
                    Host sourceHostItem = this.Hosts.Find(x => x.Id == editHostForm.HostItem.Id);
                    sourceHostItem = editHostForm.HostItem;
                    this.EditListViewItem(listView1.SelectedIndices[0], sourceHostItem);

                    this.modifed = true;
                    CheckSaveStatus();
                }
            }
        }
Example #2
0
        private void EditHost()
        {
            if (listView1.SelectedItems.Count > 0)
            {

                int id = Convert.ToInt16(listView1.SelectedItems[0].SubItems[1].Text);
                var query = from h in Hosts
                            where h.Id == id
                            select h;

                EditHostForm editHostForm = new EditHostForm();
                editHostForm.HostItem = query.Single();
                editHostForm.LoadData();
                editHostForm.ShowDialog();

                if (editHostForm.Edited == true)
                {
                    Host sourceHostItem = this.Hosts.Find(x => x.Id == editHostForm.HostItem.Id);
                    sourceHostItem = editHostForm.HostItem;
                    this.EditListViewItem(listView1.SelectedIndices[0], sourceHostItem);

                    this.modifed = true;
                    CheckSaveStatus();
                }
            }
        }