private void UpdateNodeFromForm(PlanNode nodeToEdit) { nodeToEdit.Text = this.nameBox.Text; nodeToEdit.Currency = (string)currencyCombo.SelectedItem; nodeToEdit.ToolTipText = descriptionBox.Text; nodeToEdit.LocalCostInCents = (int)(localCostBox.Value * 100); }
public static DialogResult ShowDialog(PlanNode nodeToEdit) { EditPlanDialog dlg = new EditPlanDialog(); dlg.UpdateFormFromNode(nodeToEdit); DialogResult result = dlg.ShowDialog(); if (result == DialogResult.OK) dlg.UpdateNodeFromForm(nodeToEdit); return result; }
private void UpdateFormFromNode(PlanNode nodeToEdit) { this.nameBox.Text = nodeToEdit.Text; if (currencyCombo.Items.Contains(nodeToEdit.Currency)) currencyCombo.SelectedItem = nodeToEdit.Currency; else currencyCombo.SelectedItem = CurrencyData.DefaultCurrency; descriptionBox.Text = nodeToEdit.ToolTipText; decimal cost = nodeToEdit.LocalCostInCents; localCostBox.Value = cost / 100; }
private void AddPlanNodeToTree(TreeNode parentNode, PlanNode node, bool editFirst) { if (editFirst) { DialogResult result = EditNode(node); if (result == System.Windows.Forms.DialogResult.OK) { AddNode(parentNode, node); } } else { PopulateNode(node); AddNode(parentNode, node); } }
private DialogResult EditNode(PlanNode nodeToEdit) { DialogResult result = EditPlanDialog.ShowDialog(nodeToEdit); if (result == System.Windows.Forms.DialogResult.OK) { PopulateNode(nodeToEdit); DisplayTotalCost(); } return result; }
private void addNewItemToolStripMenuItem_Click(object sender, EventArgs e) { PlanNode newNode = new PlanNode(); AddPlanNodeToTree(travelTree.SelectedNode,newNode,true); }
private void PopulateNode(PlanNode data) { }