private void CmdRouteActivate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (grdRouteView.SelectedRowsCount <= 0) { return; } Route route = (Route)grdRouteView.GetRow(grdRouteView.GetSelectedRows()[0]); if (route != null) { if (!route.IsActive) { if (!route.Activate()) { StudioContext.AlertError("<b>Route conflict</b>", String.Format("Route <b>{0}</b> cannot be activated due to a conflict with current active route(s)", route.Name)); } } else { route.Deactivate(); } this.RefreshRouteList(); } }
/// <summary> /// Execute the action. /// </summary> /// <param name="element">Parameter to remove!</param> /// <param name="project">Project where the action must be executed.</param> /// <param name="system">System used to execute the digital commands.</param> public override void Execute(Element element, Project project) { try { Route route = Route.Get(this.RouteID); route.Activate(); } catch (Exception ex) { Logger.LogError(this, ex); throw; } }