private void m_pRoutes_DoubleClick(object sender, EventArgs e) { if (m_pRoutes.SelectedItems.Count > 0) { Route route = (Route)m_pRoutes.SelectedItems[0].Tag; wfrm_Routing_Route frm = new wfrm_Routing_Route(m_pVirtualServer, route); if (frm.ShowDialog(this) == DialogResult.OK) { LoadRoutes(route.ID); } } }
/// <summary> /// Executes specified tool bar task. /// </summary> /// <param name="taskID">Task ID.</param> private void SwitchToolBarTask(string taskID) { if (taskID == "add") { wfrm_Routing_Route frm = new wfrm_Routing_Route(m_pVirtualServer); if (frm.ShowDialog(this) == DialogResult.OK) { LoadRoutes(frm.RouteID); } } else if (taskID == "edit") { Route route = (Route)m_pRoutes.SelectedItems[0].Tag; wfrm_Routing_Route frm = new wfrm_Routing_Route(m_pVirtualServer, route); if (frm.ShowDialog(this) == DialogResult.OK) { LoadRoutes(route.ID); } } else if (taskID == "delete") { Route route = (Route)m_pRoutes.SelectedItems[0].Tag; if (MessageBox.Show(this, "Are you sure you want to delete Route '" + route.Pattern + "' !", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { route.Owner.Remove(route); m_pRoutes.SelectedItems[0].Remove(); } } else if (taskID == "refresh") { LoadRoutes(""); } else if (taskID == "up") { if (m_pRoutes.SelectedItems.Count > 0 && m_pRoutes.SelectedItems[0].Index > 0) { SwapRoutes(m_pRoutes.SelectedItems[0], m_pRoutes.Items[m_pRoutes.SelectedItems[0].Index - 1]); } } else if (taskID == "down") { if (m_pRoutes.SelectedItems.Count > 0 && m_pRoutes.SelectedItems[0].Index < m_pRoutes.Items.Count - 1) { SwapRoutes(m_pRoutes.SelectedItems[0], m_pRoutes.Items[m_pRoutes.SelectedItems[0].Index + 1]); } } }
/// <summary> /// Executes specified tool bar task. /// </summary> /// <param name="taskID">Task ID.</param> private void SwitchToolBarTask(string taskID) { if(taskID == "add"){ wfrm_Routing_Route frm = new wfrm_Routing_Route(m_pVirtualServer); if(frm.ShowDialog(this) == DialogResult.OK){ LoadRoutes(frm.RouteID); } } else if(taskID == "edit"){ Route route = (Route)m_pRoutes.SelectedItems[0].Tag; wfrm_Routing_Route frm = new wfrm_Routing_Route(m_pVirtualServer,route); if(frm.ShowDialog(this) == DialogResult.OK){ LoadRoutes(route.ID); } } else if(taskID == "delete"){ Route route = (Route)m_pRoutes.SelectedItems[0].Tag; if(MessageBox.Show(this,"Are you sure you want to delete Route '" + route.Pattern + "' !","Confirm Delete",MessageBoxButtons.YesNo,MessageBoxIcon.Question,MessageBoxDefaultButton.Button2) == DialogResult.Yes){ route.Owner.Remove(route); m_pRoutes.SelectedItems[0].Remove(); } } else if(taskID == "refresh"){ LoadRoutes(""); } else if(taskID == "up"){ if(m_pRoutes.SelectedItems.Count > 0 && m_pRoutes.SelectedItems[0].Index > 0){ SwapRoutes(m_pRoutes.SelectedItems[0],m_pRoutes.Items[m_pRoutes.SelectedItems[0].Index - 1]); } } else if(taskID == "down"){ if(m_pRoutes.SelectedItems.Count > 0 && m_pRoutes.SelectedItems[0].Index < m_pRoutes.Items.Count - 1){ SwapRoutes(m_pRoutes.SelectedItems[0],m_pRoutes.Items[m_pRoutes.SelectedItems[0].Index + 1]); } } }
private void m_pRoutes_DoubleClick(object sender, EventArgs e) { if(m_pRoutes.SelectedItems.Count > 0){ Route route = (Route)m_pRoutes.SelectedItems[0].Tag; wfrm_Routing_Route frm = new wfrm_Routing_Route(m_pVirtualServer,route); if(frm.ShowDialog(this) == DialogResult.OK){ LoadRoutes(route.ID); } } }