private void EditMI_Click(object sender, EventArgs e)
        {
            try
            {
                // choose the first selected row.
                foreach (DataGridViewRow row in ResultsDV.SelectedRows)
                {
                    DataRowView source = row.DataBoundItem as DataRowView;
                    WriteValue  value  = (WriteValue)source.Row[0];

                    WriteValue result = new EditWriteValueDlg().ShowDialog(m_session, value);

                    if (result != null)
                    {
                        UpdateRow(source.Row, result);
                    }

                    break;
                }
            }
            catch (Exception exception)
            {
                ClientUtils.HandleException(this.Text, exception);
            }
        }
Ejemplo n.º 2
0
        private void NewMI_Click(object sender, EventArgs e)
        {
            try {
                WriteValue nodeToWrite = null;

                // choose the first selected row as a template.
                foreach (DataGridViewRow row in ResultsDV.SelectedRows)
                {
                    DataRowView source = row.DataBoundItem as DataRowView;
                    WriteValue  value  = (WriteValue)source.Row[0];
                    nodeToWrite = (WriteValue)value.Clone();
                    break;
                }

                if (nodeToWrite == null)
                {
                    nodeToWrite = new WriteValue()
                    {
                        AttributeId = Attributes.Value
                    };
                }

                // prompt use to edit new value.
                WriteValue result = new EditWriteValueDlg().ShowDialog(m_session, nodeToWrite);

                if (result != null)
                {
                    DataRow row = m_dataset.Tables[0].NewRow();
                    UpdateRow(row, result);
                    m_dataset.Tables[0].Rows.Add(row);
                }
            } catch (Exception exception) {
                ClientUtils.HandleException(this.Text, exception);
            }
        }
        private void EditMI_Click(object sender, EventArgs e)
        {
            try
            {
                // choose the first selected row.
                foreach (DataGridViewRow row in ResultsDV.SelectedRows)
                {
                    DataRowView source = row.DataBoundItem as DataRowView;
                    WriteValue value = (WriteValue)source.Row[0];

                    WriteValue result = new EditWriteValueDlg().ShowDialog(m_session, value);

                    if (result != null)
                    {
                        UpdateRow(source.Row, result);
                    }

                    break;
                }
            }
            catch (Exception exception)
            {
                ClientUtils.HandleException(this.Text, exception);
            }
        }
        private void NewMI_Click(object sender, EventArgs e)
        {
            try
            {
                WriteValue nodeToWrite = null;

                // choose the first selected row as a template.
                foreach (DataGridViewRow row in ResultsDV.SelectedRows)
                {
                    DataRowView source = row.DataBoundItem as DataRowView;
                    WriteValue value = (WriteValue)source.Row[0];
                    nodeToWrite = (WriteValue)value.Clone();
                    break;
                }

                if (nodeToWrite == null)
                {
                    nodeToWrite = new WriteValue() { AttributeId = Attributes.Value };
                }

                // prompt use to edit new value.
                WriteValue result = new EditWriteValueDlg().ShowDialog(m_session, nodeToWrite);

                if (result != null)
                {
                    DataRow row = m_dataset.Tables[0].NewRow();
                    UpdateRow(row, result);
                    m_dataset.Tables[0].Rows.Add(row);
                }
            }
            catch (Exception exception)
            {
                ClientUtils.HandleException(this.Text, exception);
            }
        }