public static T Choose <T>(this RouterMirrorSide side, T objSideA, T objSideB, bool invert = false)
 {
     if ((!invert && (side == RouterMirrorSide.SideA)) || (invert && (side == RouterMirrorSide.SideB)))
     {
         return(objSideA);
     }
     return(objSideB);
 }
예제 #2
0
        private void syncButtonClickMethod(RouterMirror routerMirror, RouterMirrorSide sourceSide)
        {
            if ((routerMirror.RouterA == null) || (routerMirror.RouterB == null))
            {
                return;
            }
            Router sourceRouter      = sourceSide.Choose(routerMirror.RouterA, routerMirror.RouterB);
            Router destinationRouter = sourceSide.Choose(routerMirror.RouterA, routerMirror.RouterB, true);
            string messageBoxText    = string.Format("Are sure you want to synchronize crosspoints from router [(#{0}) {1}] to router [(#{2}) {3}]?",
                                                     sourceRouter.ID, sourceRouter.Name, destinationRouter.ID, destinationRouter.Name);

            if (MessageBox.Show(messageBoxText, "Router synchronization", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                routerMirror.Synchronize(sourceSide);
            }
        }
예제 #3
0
        private void routerRefCellUpdaterMethod(RouterMirror routerMirror, DataGridViewCell cell, RouterMirrorSide side)
        {
            Router router = side.Choose(routerMirror.RouterA, routerMirror.RouterB);

            if (router == null)
            {
                cell.Value = "-";
                return;
            }
            cell.Value = string.Format("(#{0}) {1}", router.ID, router.Name);
        }