Beispiel #1
0
        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();
            }
        }