/// <summary>
        /// Resets the available range labels
        /// </summary>
        private void UpdateAvailableRanges()
        {
            List <Range> availableFrom = null;
            List <Range> availableTo   = null;

            // Get the ranges and connections based on whether we are port-strand or strand-port
            #region Determine Direction
            if (cboFrom.SelectedItem is FiberCableWrapper &&
                cboTo.SelectedItem is ConnectableDeviceWrapper)
            {
                FiberCableWrapper        cable  = (FiberCableWrapper)cboFrom.SelectedItem;
                ConnectableDeviceWrapper device = (ConnectableDeviceWrapper)cboTo.SelectedItem;

                availableFrom = SpliceAndConnectionUtils.GetAvailableRanges(cable, device.IsCableFromEnd);
                availableTo   = SpliceAndConnectionUtils.GetAvailableRanges(device, PortType.Input);
            }
            else if (cboFrom.SelectedItem is DeviceWrapper &&
                     cboTo.SelectedItem is ConnectableCableWrapper)
            {
                DeviceWrapper           device = (DeviceWrapper)cboFrom.SelectedItem;
                ConnectableCableWrapper cable  = (ConnectableCableWrapper)cboTo.SelectedItem;

                availableFrom = SpliceAndConnectionUtils.GetAvailableRanges(device, PortType.Output);
                availableTo   = SpliceAndConnectionUtils.GetAvailableRanges(cable, cable.IsThisFromEnd);
            }
            #endregion

            lblAvailableFrom.Text = GetAvailableRangesString(availableFrom);
            lblAvailableTo.Text   = GetAvailableRangesString(availableTo);
        }
        /// <summary>
        /// Creates a label string for the available ranges of a cable at a certain end
        /// </summary>
        /// <param name="cable">Cable to check</param>
        /// <param name="isFromEnd">End to check</param>
        /// <returns>string</returns>
        private string GetAvailableRangeString(FiberCableWrapper cable, bool isFromEnd)
        {
            List <Range> availableRanges = SpliceAndConnectionUtils.GetAvailableRanges(cable, isFromEnd);
            string       result          = "No available ranges!";

            if (0 < availableRanges.Count)
            {
                StringBuilder availableLabel = new StringBuilder(64);
                for (int i = 0; i < availableRanges.Count; i++)
                {
                    availableLabel.AppendFormat("{0},", availableRanges[i].ToString());
                }
                availableLabel.Remove(availableLabel.Length - 1, 1);
                result = string.Format("Available: {0}", availableLabel.ToString());
            }

            return(result);
        }