Ejemplo n.º 1
0
    public bool CanBeConnected(ConnectorType otherType, PartDirection otherDirection, int boxColliderIndex)
    {
        if (isConnected == false && boxColliderDirections != null && boxColliders != null && boxColliderDirections.Length == boxColliders.Length && boxColliderIndex >= 0 && boxColliderIndex < boxColliderDirections.Length && acceptedConnectortypes != null && acceptedConnectortypes.Length > 0)
        {
            bool isItAcceptable = false;
            for (int i = 0; i < acceptedConnectortypes.Length; i++)
            {
                if (acceptedConnectortypes[i] == otherType)
                {
                    isItAcceptable = true;
                    break;
                }
            }

            if (isItAcceptable)
            {
                PartDirection acceptedDirection = boxColliderDirections[boxColliderIndex];

                return(acceptedDirection == otherDirection);
            }
            else
            {
                return(false);
            }
        }
        else
        {
            return(false);
        }
    }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new NodeGraphConnector, given a name, a parent container, type and index
        /// </summary>
        /// <param name="newName">The display name of the connector</param>
        /// <param name="newParent">Reference to the parent NodeGraphNode</param>
        /// <param name="newConnectorType">Type of the connector (input/output)</param>
        /// <param name="newConnectorIndex">Connector Index</param>
        public Connector(string newName, Node newParent, ConnectorType newConnectorType, int newConnectorIndex)
        {
            // Try Setting Connector Data Correct
            ConnectorData newConnectorData = ConnectorData.None;

            bool success = Enum.TryParse(newName, out newConnectorData);

            if (!success)
            {
                Console.WriteLine($"## ERROR:\t\tCasting {newName} to Enum failed");
            }

            this.color = new Vector4(0, 0, 0, 1);

            this.Name   = newName;
            this.Parent = newParent;
            this.Type   = newConnectorType;
            this.Data   = newConnectorData;
            this.Index  = newConnectorIndex;

            this.scale = newParent.Tex_Scale;

            this.pen   = new Pen(Util.VectorToColor(this.color), 1.0f);
            this.font  = new Font(this.Parent.View.Font_Node_Connector.Name, this.Parent.View.Font_Node_Connector.Size * this.scale);
            this.brush = new SolidBrush(Util.VectorToColor(this.color));
        }
        public IActionResult GetProfileByConnector(ConnectorType ctype, string value)
        {
            UserProfile profile = null;

            switch (ctype)
            {
            case ConnectorType.SMS:
                profile = _queries.GetByMobile(value);
                break;

            case ConnectorType.Email:
                profile = _queries.GetByEmail(value);
                break;

            case ConnectorType.Skype:
                profile = _queries.GetBySkype(value);
                break;
            }

            if (profile != null)

            {
                profile.PhotoUrl = $"{_avatarsUrl}user_{profile.UserId}.jpg";
                return(Ok(profile));
            }

            return(NotFound());
        }
Ejemplo n.º 4
0
        public void SetUser(string username, string password, ConnectorType type)
        {
            UserLogin user = GetUserLogin(username);

            if (user == null)
            {
                user = new UserLogin()
                {
                    Username = username,
                    Password = password,
                    Created  = DateTime.Now,
                    Updated  = DateTime.Now,
                    Type     = (int)type
                };

                _dbContext.UserLogins.Add(user);
            }
            else
            {
                user.Password = password;
                user.Updated  = DateTime.Now;;
                user.Type     = (int)type;
            }

            _dbContext.SaveChanges();
        }
Ejemplo n.º 5
0
        private IConnector _Connect(IPort p1, IPort p2, ConnectorType connType, string name)
        {
            if (p1.Model != p2.Model)
            {
                string msg = string.Format("Trying to connect port {0} on object {1} to port {2} on object {3}, but they appear to be in different models.",
                                           p1.Name, p1.Owner, p2.Name, p2.Owner);
                throw new ApplicationException(msg);
            }

            if (name != null)
            {
            }

            if (name == null || name.Equals(string.Empty))
            {
                name = _prefix + (++m_nextConnectorNumber);
            }
            else
            {
                ForModel(p1.Model).UpdateNextConnectorNumber(p1.Model, name);
            }

            if (connType.Equals(ConnectorType.BasicNonBuffered))
            {
                return(new BasicNonBufferedConnector(p1.Model, name, null, Guid.NewGuid(), p1, p2));
            }
            else
            {
                throw new ApplicationException("Unknown connector type requested.");
            }
        }
Ejemplo n.º 6
0
    public ConnectorGearCorner(PartDirection facedDirection, Vector3 relativePosition)
    {
        type = ConnectorType.GEAR_CORNER;

        this.facedDirection = facedDirection;
        connectorPosition   = new Vector3Int(relativePosition.x, relativePosition.y, relativePosition.z);

        //Vector3 addVector = Vector3.zero;
        //if (facedDirection == PartDirection.East)
        //    addVector = new Vector3(1f, 0, 0);
        //if (facedDirection == PartDirection.West)
        //    addVector = new Vector3(-1f, 0, 0);
        //
        //this.connectingPosition = relativePosition + addVector;
        boxColliderDirections     = new PartDirection[6];
        boxColliderDirections[0]  = PartDirection.Down;
        boxColliderDirections[1]  = PartDirection.East;
        boxColliderDirections[2]  = PartDirection.North;
        boxColliderDirections[3]  = PartDirection.South;
        boxColliderDirections[4]  = PartDirection.Up;
        boxColliderDirections[5]  = PartDirection.West;
        acceptedConnectortypes    = new ConnectorType[1];
        acceptedConnectortypes[0] = ConnectorType.GEAR_CORNER;

        boxColliders = new BoxCollider[6];
    }
Ejemplo n.º 7
0
        private IVisio.VisCellVals ConnectorTypeToCellVal_Appearance(ConnectorType connector_type)
        {
            switch (connector_type)
            {
            case (ConnectorType.Curved):
            {
                return(IVisio.VisCellVals.visLORouteExtNURBS);
            }

            case (ConnectorType.Straight):
            {
                return(IVisio.VisCellVals.visLORouteExtStraight);
            }

            case (ConnectorType.RightAngle):
            {
                return(IVisio.VisCellVals.visLORouteExtStraight);
            }

            case (ConnectorType.Default):
            {
                // Treat as RightAngle
                return(IVisio.VisCellVals.visLORouteExtStraight);
            }

            default:
            {
                string msg = string.Format("Unhandled {0} value of {1}", nameof(ConnectorType), connector_type);
                throw new ArgumentOutOfRangeException(nameof(connector_type), msg);
            }
            }
        }
Ejemplo n.º 8
0
        private IVisio.VisCellVals ConnectorTypeToCellVal_Style(ConnectorType ct)
        {
            switch (ct)
            {
            case (ConnectorType.Curved):
            {
                return(IVisio.VisCellVals.visLORouteRightAngle);
            }

            case (ConnectorType.Straight):
            {
                return(IVisio.VisCellVals.visLORouteCenterToCenter);
            }

            case (ConnectorType.RightAngle):
            {
                return(IVisio.VisCellVals.visLORouteFlowchartNS);
            }

            default:
            {
                throw new ArgumentOutOfRangeException();
            }
            }
        }
        public async Task <User> GetUserAsync(ConnectorType connectorType, string id)
        {
            var request = new GetItemRequest
            {
                TableName = this.config.BotUserProfileTableName,
                Key       = new Dictionary <string, AttributeValue>()
                {
                    { Id, new AttributeValue {
                          SS = new List <string> {
                              connectorType.ToString(), id
                          }
                      } }
                }
            };

            var response = await client.GetItemAsync(request);

            if (!response.IsItemSet)
            {
                return(null);
            }

            var item = response.Item;

            return(new User
            {
                ConnectorType = connectorType,
                FirstName = item.TryGetValue(FirstName, out AttributeValue firstName) ? firstName.S : null,
                Gender = item.TryGetValue(Gender, out AttributeValue gender) ? (Enum.TryParse(gender.S, out Gender gd) ? gd : Abstractions.Models.Gender.Unknown) : Abstractions.Models.Gender.Unknown,
                Id = id,
                LastName = item.TryGetValue(LastName, out AttributeValue lastName) ? lastName.S : null,
                Locale = item.TryGetValue(Locale, out AttributeValue locale) ? locale.S : null,
                ProfilePicture = item.TryGetValue(ProfilePicture, out AttributeValue profilePicutre) ? profilePicutre.S : null,
                Timezone = item.TryGetValue(Timezone, out AttributeValue timezone) ? (int.TryParse(timezone.N, out int tz) ? tz : 0) : 0
            });
Ejemplo n.º 10
0
        public Connector AddConnection(string id, Shape from, Shape to, string label,
                                       ConnectorType type, int begin_arrow, int end_arrow, string hyperlink)
        {
            var new_connector = new Connector(from, to);

            new_connector.ID                       = id;
            new_connector.Label                    = label;
            new_connector.ConnectorType            = type;
            new_connector.Cells                    = new ShapeCells();
            new_connector.Cells.LineBeginArrow     = begin_arrow;
            new_connector.Cells.LineBeginArrowSize = begin_arrow;
            new_connector.Cells.LineEndArrow       = end_arrow;
            new_connector.Cells.LineEndArrowSize   = end_arrow;

            if (!string.IsNullOrEmpty(hyperlink))
            {
                //new_connector.VisioShape = IVisio.Shape; // IVisio.Shape();
                var h = new_connector.VisioShape.Hyperlinks.Add();

                h.Name    = hyperlink; // Name of Hyperlink
                h.Address = hyperlink; // Address of Hyperlink
            }

            this.Connectors.Add(id, new_connector);
            return(new_connector);
        }
Ejemplo n.º 11
0
        //Creating the connection
        private LineConnector Connect(ConnectorType connType, Node headnode, Node tailnode, ConnectionPort headport, ConnectionPort tailport, string label)
        {
            LineConnector conn = new LineConnector();

            conn.ConnectorType      = connType;
            conn.HeadNode           = headnode;
            conn.TailNode           = tailnode;
            conn.ConnectionHeadPort = headport;
            conn.ConnectionTailPort = tailport;
            conn.HeadDecoratorShape = DecoratorShape.None;
            conn.TailDecoratorShape = DecoratorShape.None;
            conn.LineStyle.Stroke   = new SolidColorBrush(Colors.Brown);
            conn.Label = label;
            conn.FirstSegmentLength       = 20;
            conn.LastSegmentLength        = 20;
            conn.LabelHorizontalAlignment = HorizontalAlignment.Right;
            conn.LabelVerticalAlignment   = VerticalAlignment.Center;
            diagramModel.Connections.Add(conn);
            if (conn.ConnectorType == ConnectorType.Orthogonal)
            {
                //conn.IntermediatePoints.RemoveAt(1);
                conn.AutoAdjustPoints = true;
            }
            return(conn);
        }
Ejemplo n.º 12
0
        public static List <Connector> ReferenceConnectors(this Connector connector, ConnectorType connectorType = ConnectorType.End)
        {
            if (connector == null || !connector.IsConnected || connector.Owner == null)
            {
                return(null);
            }

            ConnectorSet connectorSet = connector.AllRefs;

            if (connectorSet == null || connectorSet.Size == 0)
            {
                return(null);
            }

            List <Connector> result = new List <Connector>();

            foreach (Connector connector_Ref in connectorSet)
            {
                if (connector_Ref.ConnectorType == connectorType)
                {
                    if (connector_Ref.Owner == null || connector.Owner.Id != connector_Ref.Owner.Id)
                    {
                        result.Add(connector_Ref);
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 13
0
 public string GetConnectUrl(ConnectorType connectType, uint curConnectTime)
 {
     if (MonoSingleton <CTongCaiSys> .instance.IsCanUseTongCai())
     {
         if (connectType == ConnectorType.Lobby)
         {
             if (string.IsNullOrEmpty(this.m_successLobbyUrlForTongcai))
             {
                 return(this.m_successLobbyUrlForTongcai);
             }
             this.m_curLobbyUrlForTongcai = this.GetLobbyTongcaiConnectUrl(curConnectTime);
             return(this.m_curLobbyUrlForTongcai);
         }
         if (!string.IsNullOrEmpty(this.m_successRelayUrlForTongcai))
         {
             this.m_successRelayUrlForTongcai = this.GetRelayTongCaiConnectUrl(curConnectTime);
         }
         return(this.m_successRelayUrlForTongcai);
     }
     if (connectType == ConnectorType.Lobby)
     {
         if (string.IsNullOrEmpty(this.m_successLobbyUrlForNormal))
         {
             return(this.m_successLobbyUrlForNormal);
         }
         this.m_curLobbyUrlForNormal = this.GetLobbyNormalConnectUrl(curConnectTime);
         return(this.m_curLobbyUrlForNormal);
     }
     if (string.IsNullOrEmpty(this.m_successRelayUrlForNormal))
     {
         return(this.m_successRelayUrlForNormal);
     }
     this.m_curRelayUrlForNormal = this.GetRelayNormalConnectUrl(curConnectTime);
     return(this.m_curRelayUrlForNormal);
 }
Ejemplo n.º 14
0
        private IVisio.VisCellVals ConnectorTypeToCellVal_Style(ConnectorType connector_type)
        {
            switch (connector_type)
            {
            case (ConnectorType.Curved):
            {
                return(IVisio.VisCellVals.visLORouteRightAngle);
            }

            case (ConnectorType.Straight):
            {
                return(IVisio.VisCellVals.visLORouteCenterToCenter);
            }

            case (ConnectorType.RightAngle):
            {
                return(IVisio.VisCellVals.visLORouteFlowchartNS);
            }

            case (ConnectorType.Default):
            {
                return(IVisio.VisCellVals.visLORouteFlowchartNS);
            }

            default:
            {
                string msg = string.Format("Unhandled {0} value of {1}", nameof(ConnectorType), connector_type);
                throw new ArgumentOutOfRangeException(nameof(connector_type), msg);
            }
            }
        }
Ejemplo n.º 15
0
 public DiagramConnector(ConnectorType type,
                         DiagramConnectorNode startConnector, DiagramConnectorNode endConnector)
 {
     this.type  = type;
     this.start = startConnector;
     this.end   = endConnector;
 }
Ejemplo n.º 16
0
        /// <summary>
        /// A connector is the socket or cable available for the EV to make use of.
        /// </summary>
        /// <param name="ConnectorId">Identifier of the connector within the EVSE. Two connectors may have the same id as long as they do not belong to the same EVSE object.</param>
        /// <param name="Standard">The standard of the installed connector.</param>
        /// <param name="Format">The format (socket/cable) of the installed connector.</param>
        /// <param name="PowerType">The type of powert at the connector.</param>
        /// <param name="Voltage">Voltage of the connector (line to neutral for AC_3_PHASE), in volt [V].</param>
        /// <param name="Amperage">Maximum amperage of the connector, in ampere [A].</param>
        /// <param name="TariffId">Optional identifier of the current charging tariff structure.</param>
        /// <param name="TermsAndConditions">Optional URL to the operator's terms and conditions.</param>
        public Connector(Connector_Id ConnectorId,
                         ConnectorType Standard,
                         ConnectorFormatType Format,
                         PowerType PowerType,
                         UInt16 Voltage,
                         UInt16 Amperage,
                         Tariff_Id TariffId     = null,
                         Uri TermsAndConditions = null)
        {
            #region Initial checks

            if (ConnectorId == null)
            {
                throw new ArgumentNullException("ConnectorId", "The given parameter must not be null!");
            }

            #endregion

            this._Id                 = ConnectorId;
            this._Standard           = Standard;
            this._Format             = Format;
            this._PowerType          = PowerType;
            this._Voltage            = Voltage;
            this._Amperage           = Amperage;
            this._TariffId           = TariffId;
            this._TermsAndConditions = TermsAndConditions;
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Check if the point is any edge of the rect
        /// </summary>
        /// <param name="point">The Point should be within the rectangle</param>
        /// <param name="rect"></param>
        /// <returns>if it is not on the edge, return the nearest point, otherwise return itself</returns>
        private static Point AlignPoint(Point point, Rect rect, ConnectorType orientation = ConnectorType.Center)
        {
            //do a simple mathematics, if (point-rect.lt) has a coordinate of 0, bingo!, same with (rect.br-point)
            Vector v1 = point - rect.TopLeft, v2 = rect.BottomRight - point;

            if (v1.X == 0 || v1.Y == 0 || v2.X == 0 || v2.Y == 0)
            {
                return(point);
            }
            // top, left, right, bottom
            Point[] points = new Point[] { new Point(point.X, rect.Top), new Point(rect.Left, point.Y), new Point(rect.Right, point.Y), new Point(point.X, rect.Bottom) };
            // calculate the nearest point, no backwards
            if (v1.Length < v2.Length)
            {
                switch (orientation)
                {
                case ConnectorType.Right: return(points[0]);

                case ConnectorType.Top: return(points[1]);
                }
                return(v1.X < v1.Y ? points[1] : points[0]);
            }
            else
            {
                switch (orientation)
                {
                case ConnectorType.Left: return(points[3]);

                case ConnectorType.Bottom: return(points[2]);
                }
                return(v2.X < v2.Y ? points[2] : points[3]);
            }
        }
Ejemplo n.º 18
0
        private IVisio.VisCellVals ConnectorTypeToCellVal_Appearance(ConnectorType ct)
        {
            switch (ct)
            {
            case (ConnectorType.Curved):
            {
                return(IVisio.VisCellVals.visLORouteExtNURBS);
            }

            case (ConnectorType.Straight):
            {
                return(IVisio.VisCellVals.visLORouteExtStraight);
            }

            case (ConnectorType.RightAngle):
            {
                return(IVisio.VisCellVals.visLORouteExtStraight);
            }

            default:
            {
                throw new ArgumentOutOfRangeException();
            }
            }
        }
Ejemplo n.º 19
0
 /// <summary>
 /// Redirect after user login. To store username/password to use later request
 /// </summary>
 /// <param name="username"></param>
 /// <param name="password"></param>
 /// <param name="loginType"></param>
 /// <returns></returns>
 public ActionResult AfterMyActionResult(string username, string password, ConnectorType loginType)
 {
     _sessionHelperService.Username      = username;
     _sessionHelperService.Password      = password;
     _sessionHelperService.ConnectorType = loginType;
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 20
0
        /// <summary>
        ///     Creates a new PathAdvancedTargetInfo for TVs
        /// </summary>
        /// <param name="rotation">Screen rotation</param>
        /// <param name="scale">Screen scaling</param>
        /// <param name="tvFormat">The TV format to apply</param>
        /// <param name="connectorType">Specify connector type. For TV only</param>
        /// <param name="refreshRateInMillihertz">Screen refresh rate</param>
        /// <param name="timingOverride">Timing override</param>
        /// <param name="isInterlaced">Indicates if the mode is interlaced</param>
        /// <param name="isClonePrimary">Indicates if the display is the primary display of a clone topology</param>
        /// <param name="isClonePanAndScanTarget">Indicates if the target Pan and Scan is enabled</param>
        /// <param name="disableVirtualModeSupport"></param>
        /// <param name="isPreferredUnscaledTarget"></param>
        /// <exception cref="NVIDIANotSupportedException"></exception>
        public PathAdvancedTargetInfo(
            Rotate rotation,
            Scaling scale,
            TVFormat tvFormat,
            ConnectorType connectorType,
            uint refreshRateInMillihertz   = 0,
            TimingOverride timingOverride  = TimingOverride.Current,
            bool isInterlaced              = false,
            bool isClonePrimary            = false,
            bool isClonePanAndScanTarget   = false,
            bool disableVirtualModeSupport = false,
            bool isPreferredUnscaledTarget = false)
            : this(
                rotation, scale, refreshRateInMillihertz, timingOverride, isInterlaced, isClonePrimary,
                isClonePanAndScanTarget,
                disableVirtualModeSupport, isPreferredUnscaledTarget)
        {
            if (tvFormat == TVFormat.None)
            {
                throw new NVIDIANotSupportedException(
                          "This overload is for TV displays, use the other overload(s) if the display is not a TV.");
            }

            this           = typeof(PathAdvancedTargetInfo).Instantiate <PathAdvancedTargetInfo>();
            _TVFormat      = tvFormat;
            _ConnectorType = connectorType;
        }
Ejemplo n.º 21
0
 public static IInformationConnector GetInformationConnector(ConnectorType connectorType, SiteUtilBase siteUtil)
 {     
     if (connectorType == ConnectorType.AmazonPrime)
         return new AmazonPrimeInformationConnector(siteUtil);
     if (connectorType == ConnectorType.AmazonPrimeDe)
         return new AmazonPrimeInformationConnector(siteUtil);
     return null;
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Creates a new NodeGraphConnector, given a name, a parent container, type and index
 /// </summary>
 /// <param name="p_Name">The display name of the connector</param>
 /// <param name="p_parent">Reference to the parent NodeGraphNode</param>
 /// <param name="p_ConnectorType">Type of the connector (input/output)</param>
 /// <param name="p_ConnectorIndex">Connector Index</param>
 public NodeGraphConnector(string p_Name, NodeGraphNode p_parent, ConnectorType p_ConnectorType,int p_ConnectorIndex)
 {
     this.m_Name = p_Name;
     this.m_oParentNode = p_parent;
     this.m_oView = p_parent.ParentView;
     this.m_oConnectorType = p_ConnectorType;
     this.m_iConnectorIndex = p_ConnectorIndex;
 }
 public static IInformationConnector GetInformationConnector(ConnectorType connectorType, SiteUtilBase siteUtil)
 {     
     if (connectorType == ConnectorType.SkyGo)
         return new SkyGoInformationConnector(siteUtil);
     if (connectorType == ConnectorType._4oD)
         return new _4ODInformationConnector(siteUtil);
     return null;
 }
Ejemplo n.º 24
0
 public DiagramConnector(ConnectorType type,
                         DiagramNode startNode, DiagramGroup startGroup, DiagramRow startRow,
                         DiagramNode endNode, DiagramGroup endGroup, DiagramRow endRow)
 {
     this.type  = type;
     this.start = new DiagramConnectorNode(startNode, startGroup, startRow);
     this.end   = new DiagramConnectorNode(endNode, endGroup, endRow);
 }
Ejemplo n.º 25
0
 public ConnectorData Init(int id, int nodeId, ConnectorType type)
 {
     this.id                = id;
     this.type              = type;
     this.nodeId            = nodeId;
     this.connectorPairList = new List <ConnectorPair>();
     return(this);
 }
Ejemplo n.º 26
0
 public GCloudConnector(ConnectorType type, bool manualUpdate, bool autoReconnect, bool autoLogin)
 {
     this.manualUpdate  = manualUpdate;
     this.autoReconnect = autoReconnect;
     this.autoLogin     = autoLogin;
     this.connectorType = type;
     Connected          = false;
 }
Ejemplo n.º 27
0
 public DiagramConnector(
     IModelRelationship relationship,
     ModelNodeId source,
     ModelNodeId target,
     ConnectorType connectorType)
     : this(relationship, source, target, connectorType, Route.Empty)
 {
 }
Ejemplo n.º 28
0
 public void UpdateVisibility(ConnectorType connectorType)
 {
     Visible = ConnectorTypes.Contains(connectorType);
     foreach (Control ctrl in Controls)
     {
         ctrl.Visible = Visible;
     }
 }
Ejemplo n.º 29
0
 public NodeGraphConnector(EndpointDescriptor descriptor, NodeGraphNode p_parent, ConnectorType type)
 {
     this.m_Name = String.Empty;
     this.m_oParentNode = p_parent;
     this.m_oView = p_parent.ParentView;
     this.m_oConnectorType = type;
     this.m_iConnectorIndex = descriptor.index;
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Creates a new NodeGraphConnector, given a name, a parent container, type and index
 /// </summary>
 /// <param name="p_Name">The display name of the connector</param>
 /// <param name="p_parent">Reference to the parent NodeGraphNode</param>
 /// <param name="p_ConnectorType">Type of the connector (input/output)</param>
 /// <param name="p_ConnectorIndex">Connector Index</param>
 public NodeGraphConnector(string p_Name, NodeGraphNode p_parent, ConnectorType p_ConnectorType, int p_ConnectorIndex)
 {
     this.m_Name            = p_Name;
     this.m_oParentNode     = p_parent;
     this.m_oView           = p_parent.ParentView;
     this.m_oConnectorType  = p_ConnectorType;
     this.m_iConnectorIndex = p_ConnectorIndex;
 }
Ejemplo n.º 31
0
 public string GetConnectUrl(ConnectorType connectType, uint curConnectTime)
 {
     if (MonoSingleton <CTongCaiSys> .instance.IsCanUseTongCai())
     {
         if (connectType == ConnectorType.Lobby)
         {
             if (!string.IsNullOrEmpty(this.m_successLobbyUrlForTongcai) && this.lobbylastSucNetworkReachability == Application.internetReachability)
             {
                 return(this.m_successLobbyUrlForTongcai);
             }
             if (curConnectTime == 1u)
             {
                 MonoSingleton <TdirMgr> .GetInstance().TdirAsyncISP();
             }
             this.m_curLobbyUrlForTongcai = this.GetLobbyTongcaiConnectUrl(curConnectTime);
             return(this.m_curLobbyUrlForTongcai);
         }
         else
         {
             if (!string.IsNullOrEmpty(this.m_successRelayUrlForTongcai) && this.relaylastSucNetworkReachability == Application.internetReachability)
             {
                 return(this.m_successRelayUrlForTongcai);
             }
             if (curConnectTime == 1u)
             {
                 MonoSingleton <TdirMgr> .GetInstance().TdirAsyncISP();
             }
             this.m_curRelayUrlForTongcai = this.GetRelayTongCaiConnectUrl(curConnectTime);
             return(this.m_curRelayUrlForTongcai);
         }
     }
     else if (connectType == ConnectorType.Lobby)
     {
         if (!string.IsNullOrEmpty(this.m_successLobbyUrlForNormal) && this.lobbylastSucNetworkReachability == Application.internetReachability)
         {
             return(this.m_successLobbyUrlForNormal);
         }
         if (curConnectTime == 1u)
         {
             MonoSingleton <TdirMgr> .GetInstance().TdirAsyncISP();
         }
         this.m_curLobbyUrlForNormal = this.GetLobbyNormalConnectUrl(curConnectTime);
         return(this.m_curLobbyUrlForNormal);
     }
     else
     {
         if (!string.IsNullOrEmpty(this.m_successRelayUrlForNormal) && this.relaylastSucNetworkReachability == Application.internetReachability)
         {
             return(this.m_successRelayUrlForNormal);
         }
         if (curConnectTime == 1u)
         {
             MonoSingleton <TdirMgr> .GetInstance().TdirAsyncISP();
         }
         this.m_curRelayUrlForNormal = this.GetRelayNormalConnectUrl(curConnectTime);
         return(this.m_curRelayUrlForNormal);
     }
 }
Ejemplo n.º 32
0
        /// <summary>
        /// Get the path with one connector and one point
        /// </summary>
        /// <param name="endPoint"></param>
        /// <param name="endPointType">When this is set to ConnectorType.Center, means there is no restriction actually</param>
        /// <returns></returns>
        public List <Point> GetPath(Point endPoint, ConnectorType endPointType = ConnectorType.Center)
        {
            List <Point>  stops          = new List <Point>();
            Point         startPoint     = Connection.SourcePosition;
            ConnectorType startPointType = ConnectorType.Center;

            // if source position and sink position are not valid
            if (double.IsNaN(startPoint.X) || double.IsNaN(startPoint.Y) || double.IsNaN(endPoint.X) || double.IsNaN(endPoint.Y))
            {
                return(stops);
            }
            if (Connection.Source != null)
            {
                startPointType = Connection.Source.Type;
                Rect sourceRect = GetInflatedRect(Connection.Source.Owner);
                startPoint = GetOffsetPoint(Connection.Source, sourceRect);
            }
#if DEBUG_ON
            // test value
            System.Console.WriteLine("{0} Generating path, start {1} startType {2} end {3} endType {4}", System.DateTime.Now.Millisecond, startPoint.ToString(), startPointType, endPoint.ToString(), endPointType);
#endif
            // add first point, notice this is not the position of source point
            stops.Add(startPoint);
            List <Rect> conflicts = GetConflictedRects(startPoint, endPoint);
            // get the mega rect, whose edge is the path exactly
            Rect megaRect = UnionRects(conflicts);
            megaRect.Union(startPoint); megaRect.Union(endPoint);
            // check if start point or end point is one the edge, if not, we need to add some more stops
            Point startEdgeP = AlignPoint(startPoint, megaRect, startPointType);
            if (!startEdgeP.Equals(startPoint))
            {
                stops.Add(startEdgeP);
            }
            // check end point
            Point endEdgeP = AlignPoint(endPoint, megaRect, endPointType);
#if DEBUG_ON
            // test value
            System.Console.WriteLine("{0} startEdge {1} endEdge {2}", System.DateTime.Now.Millisecond, startEdgeP.ToString(), endEdgeP.ToString());
#endif
            // add two nearest corner point into the stops
            stops.AddRange(DecideCheapestPath(startEdgeP, endEdgeP, megaRect, startPointType, endPointType));
            if (!endEdgeP.Equals(endPoint))
            {
                stops.Add(endEdgeP);
            }
            // add last point
            stops.Add(endPoint);
#if DEBUG_ON
            // test value
            System.Console.WriteLine("{0} Final result", System.DateTime.Now.Millisecond);
            foreach (Point p in stops)
            {
                System.Console.Write("{0} ", p.ToString());
            }
#endif
            OptimizeStops(stops);
            return(stops);
        }
Ejemplo n.º 33
0
        public NodeGraphConnector(EndpointDescriptor descriptor, NodeGraphView p_view, ConnectorType type)
        {
            this.m_Name = String.Empty;
            this.m_oParentNode = null;

            this.m_oView = p_view;
            this.m_oConnectorType = type;
            this.m_iConnectorIndex = descriptor.index;
        }
Ejemplo n.º 34
0
 /// <summary>
 /// Creates a new NodeGraphConnector, given a name, a parent container, type and index
 /// </summary>
 /// <param name="p_Name">The display name of the connector</param>
 /// <param name="p_parent">Reference to the parent NodeGraphNode</param>
 /// <param name="p_ConnectorType">Type of the connector (input/output)</param>
 /// <param name="p_ConnectorIndex">Connector Index</param>
 public NodeGraphConnector(string p_Name, NodeGraphNode p_parent, ConnectorType p_ConnectorType, int p_ConnectorIndex)
 {
     this.m_Name = p_Name;
     this.m_oParentNode = p_parent;
     this.m_oView = p_parent.ParentView;
     this.m_oConnectorType = p_ConnectorType;
     this.m_iConnectorIndex = p_ConnectorIndex;
     this.m_oDataType = p_parent.ParentView.KnownDataTypes["Generic"];
 }
Ejemplo n.º 35
0
 public DiagramConnector(IModelRelationship relationship, IDiagramNode source, IDiagramNode target,
                         ConnectorType connectorType, Route route)
 {
     ModelRelationship = relationship ?? throw new ArgumentNullException(nameof(relationship));
     Source            = source ?? throw new ArgumentNullException(nameof(source));
     Target            = target ?? throw new ArgumentNullException(nameof(target));
     ConnectorType     = connectorType ?? throw new ArgumentNullException(nameof(connectorType));
     Route             = route;
 }
Ejemplo n.º 36
0
 private void FillSubTypeComboBox(ConnectorType connectorType)
 {
     ConnectionSubTypeCombo.DataSource = null;
     SubTypeList = Resources.ResourceHelper.Connectors
                   .Where(x => x.Type == connectorType).ToList();
     ConnectionSubTypeCombo.DataSource    = SubTypeList;
     ConnectionSubTypeCombo.DisplayMember = "SubTypeDisplayText";
     ConnectionSubTypeCombo.ValueMember   = "SubType";
 }
Ejemplo n.º 37
0
        public Connector Connect(
            string id, 
            Shape from, 
            Shape to, 
            string label,
             ConnectorType type)
        {
            var new_connector = new Connector(from, to);
            new_connector.Label = label;
            new_connector.ConnectorType = type;

            this.Connectors.Add(id, new_connector);
            return new_connector;
        }
Ejemplo n.º 38
0
        /// <summary>
        /// 获取连接点
        /// </summary>
        /// <param name="rc"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private static Point GetConnectionPoint(Rect rc, ConnectorType type)
        {
            int centerX = (int)(rc.Left + rc.Right) / 2;
            int centerY = (int)(rc.Top + rc.Bottom) / 2;

            switch (type)
            {
                case ConnectorType.Left: return new Point(rc.Left, centerY);
                case ConnectorType.Right: return new Point(rc.Right, centerY);
                case ConnectorType.Top: return new Point(centerX, rc.Top);
                case ConnectorType.Bottom: return new Point(centerX, rc.Bottom);
                default: throw new NotSupportedException("Unsupported connection point");
            }
        }
Ejemplo n.º 39
0
        /// <summary>
        /// 获取拐点集合
        /// </summary>
        /// <param name="srcRect"></param>
        /// <param name="srcType"></param>
        /// <param name="destRect"></param>
        /// <param name="destType"></param>
        /// <returns></returns>
        public static Point[] GetMidPoints(Rect srcRect, ConnectorType srcType,
            Rect destRect, ConnectorType destType)
        {
            List<Point> points = new List<Point>();

            Point startPoint = GetConnectionPoint(srcRect, srcType);
            Point endPoint = GetConnectionPoint(destRect, destType);
            Point startExtPoint = GetExtensionPoint(startPoint, srcType);
            Point endExtPoint = GetExtensionPoint(endPoint, destType);
            Point[] interPoints = CalcInterPoints(startExtPoint, srcType, endExtPoint, destType);

            points.Add(startPoint);
            points.Add(startExtPoint);
            points.AddRange(interPoints);
            points.Add(endExtPoint);
            points.Add(endPoint);

            return points.ToArray();
        }
Ejemplo n.º 40
0
 public DiagramConnector(ConnectorType type,
     DiagramNode startNode, DiagramGroup startGroup, DiagramRow startRow,
     DiagramNode endNode, DiagramGroup endGroup, DiagramRow endRow)
 {
     this.type = type;
     this.start = new DiagramConnectorNode(startNode, startGroup, startRow);
     this.end = new DiagramConnectorNode(endNode, endGroup, endRow);
 }
Ejemplo n.º 41
0
        static void RenderConnector(Graphics graphics, RectangleF bounds, RenderState state, ConnectorType type, NodeConnector connector=null)
        {
            var cornerSize = GraphConstants.ConnectorCornerSize;

            using (var brush = new SolidBrush(GetArrowLineColor(state)))
            {
                using (var path = new GraphicsPath(FillMode.Winding))
                {
                    Rectangle statusRect;
                    RectangleF clientRect;

                    if (type == ConnectorType.Input)
                    {
                        path.AddLine(bounds.Right, bounds.Top, bounds.Left + cornerSize, bounds.Top);
                        path.AddArc(bounds.Left, bounds.Top, cornerSize, cornerSize, 270, -90);
                        path.AddLine(bounds.Left, bounds.Top + cornerSize, bounds.Left, bounds.Bottom - cornerSize);
                        path.AddArc(bounds.Left, bounds.Bottom - cornerSize, cornerSize, cornerSize, 180, -90);
                        path.AddLine(bounds.Left + cornerSize, bounds.Bottom, bounds.Right, bounds.Bottom);

                        int width = (int)(bounds.Bottom - bounds.Top - 8);
                        statusRect = new Rectangle((int)(bounds.Left + 4), (int)(bounds.Top + 4), width, (int)(bounds.Height - 8));
                        clientRect = new RectangleF(bounds.Left + 8 + width, bounds.Top + 4, bounds.Width - 12 - width, bounds.Height - 8);
                    }
                    else
                    {
                        path.AddLine(bounds.Left, bounds.Top, bounds.Right - cornerSize, bounds.Top);
                        path.AddArc(bounds.Right - cornerSize, bounds.Top, cornerSize, cornerSize, 270, 90);
                        path.AddLine(bounds.Right, bounds.Top + cornerSize, bounds.Right, bounds.Bottom - cornerSize);
                        path.AddArc(bounds.Right - cornerSize, bounds.Bottom - cornerSize, cornerSize, cornerSize, 0, 90);
                        path.AddLine(bounds.Right - cornerSize, bounds.Bottom, bounds.Left, bounds.Bottom);

                        int width = (int)(bounds.Bottom - bounds.Top - 8);
                        statusRect = new Rectangle((int)(bounds.Right - 4 - width), (int)(bounds.Top + 4), width, (int)(bounds.Height - 8));
                        clientRect = new RectangleF(bounds.Left + 4, bounds.Top + 4, bounds.Width - 12 - width, bounds.Height - 8);
                    }

                    graphics.FillPath(NormalBrush, path);
                    graphics.DrawPath(BorderPen, path);
                    graphics.FillRectangle(brush, statusRect);

                    if ((state & (RenderState.Compatible | RenderState.Conversion | RenderState.Dragging)) == RenderState.Compatible)
                    {
                        graphics.FillRectangle(CompatibleBrush, statusRect);
                        graphics.DrawRectangle(BorderPen, statusRect);
                    }
                    else
                    {
                        graphics.FillRectangle(brush, statusRect);
                    }

                    if (connector!=null)
                    {
                        connector.Item.RenderConnector(graphics, clientRect);
                    }
                }
            }
        }
Ejemplo n.º 42
0
 private static PointF ConnectorInterfacePoint(RectangleF bounds, ConnectorType type)
 {
     float width = bounds.Bottom - bounds.Top - 8;
     if (type == ConnectorType.Input) {
         return new PointF(bounds.Left + width / 2.0f + 4.0f, (bounds.Top + bounds.Bottom) / 2.0f);
     } else {
         return new PointF(bounds.Right - width / 2.0f + 4.0f, (bounds.Top + bounds.Bottom) / 2.0f);
     }
 }
Ejemplo n.º 43
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExpressionConnector"/> class.
        /// </summary>
        /// <param name="connectorType">Type of the connector.</param>
        /// <param name="connector">The connector.</param>
        /// <exception cref="System.ArgumentNullException">connector</exception>
        public ExpressionConnector(ConnectorType connectorType, IConnector connector)
        {
            if (connector == null)
                throw new ArgumentNullException("connector");

            Id = connector.Id;
            _connectorType = connectorType;
            _dataType = connector.DataType;
            _name = connector.Name;
            _connector = connector;
            _connector.PropertyChanged += OnConnectorPropertyChanged;
        }
Ejemplo n.º 44
0
        //public ExpressionConnector(ConnectorType connectorType, NodeDataType nodeDataType, string name)
        //{
        //    _connectorType = connectorType;
        //    _dataType = nodeDataType;
        //    _name = name;
        //}

        /// <summary>
        /// Initializes a new instance of the <see cref="ExpressionConnector"/> class.
        /// </summary>
        /// <param name="connectorType">Type of the connector.</param>
        /// <param name="expressionField">The expression field.</param>
        /// <exception cref="System.ArgumentNullException">expressionField</exception>
        public ExpressionConnector(ConnectorType connectorType, IExpressionField expressionField)
        {
            if (expressionField == null) throw new ArgumentNullException("expressionField");

            Id = expressionField.Id;
            _connectorType = connectorType;
            _dataType = expressionField.DataType;
            _name = expressionField.Name;
            _field = expressionField;
            _connector = expressionField.Connector;

            if (_connector != null)
            {
                _connector.PropertyChanged += OnConnectorPropertyChanged;
            }
        }
Ejemplo n.º 45
0
        /// <summary>
        /// 是否有方向重叠
        /// </summary>
        /// <param name="dir"></param>
        /// <param name="connectorType"></param>
        /// <returns></returns>
        private static bool IsConflitDirection(Direction dir, ConnectorType connectorType)
        {
            if (connectorType == ConnectorType.Left && dir == Direction.Right)
                return true;
            if (connectorType == ConnectorType.Right && dir == Direction.Left)
                return true;
            if (connectorType == ConnectorType.Top && dir == Direction.Bottom)
                return true;
            if (connectorType == ConnectorType.Bottom && dir == Direction.Top)
                return true;

            return false;
        }
Ejemplo n.º 46
0
 public ConnectorViewModel(string name, ConnectorType connectorType)
 {
     this.Name = name;
     this.Type = connectorType;
 }
Ejemplo n.º 47
0
 /// <summary>
 /// returns connector at index in list of connectors of special type
 /// </summary>
 /// <param name="index">index of connector in list of connectors of the same type</param>
 /// <param name="type">type of connector to search</param>
 /// <returns></returns>
 public NodeGraphConnector GetConnector(int index, ConnectorType type)
 {
     for (int i = 0; i < Connectors.Count; i++)
     {
         if(Connectors[i].Type == type)
             index--;
         if (index < 0)
             return Connectors[i];
     }
     return null;
 }
Ejemplo n.º 48
0
        /// <summary>
        /// 计算连接点位置
        /// </summary>
        /// <param name="rc"></param>
        /// <param name="connectorType"></param>
        /// <returns></returns>
        public static Point GetConnectorPosition(this Rect rc, ConnectorType connectorType)
        {
            switch (connectorType)
            {
                case ConnectorType.Left:
                    return rc.LeftCenter();

                case ConnectorType.Right:
                    return rc.RightCenter();

                case ConnectorType.Top:
                    return rc.TopCenter();

                case ConnectorType.Bottom:
                    return rc.BottomCenter();

                default:
                    throw new ApplicationException("UnSupport Connection Point Type:" + connectorType);
            }
        }
Ejemplo n.º 49
0
		static void RenderConnector(Graphics graphics, RectangleF bounds, RenderState state, ConnectorType type, NodeConnector connector=null, bool collapsed=false)
		{
            if (collapsed)
            {
                using (var brush = new SolidBrush(GetArrowLineColor(state)))
                    graphics.FillEllipse(brush, bounds);
                return;
            }

            var cornerSize = GraphConstants.ConnectorCornerSize;

			using (var brush = new SolidBrush(GetArrowLineColor(state)))
			{
                using (var path = new GraphicsPath(FillMode.Winding))
                {
                    Rectangle statusRect;
                    RectangleF clientRect;

                    if (type == ConnectorType.Input)
                    {
                        path.AddLine(bounds.Right, bounds.Top, bounds.Left + cornerSize, bounds.Top);
                        path.AddArc(bounds.Left, bounds.Top, cornerSize, cornerSize, 270, -90);
                        path.AddLine(bounds.Left, bounds.Top + cornerSize, bounds.Left, bounds.Bottom - cornerSize);
                        path.AddArc(bounds.Left, bounds.Bottom - cornerSize, cornerSize, cornerSize, 180, -90);
                        path.AddLine(bounds.Left + cornerSize, bounds.Bottom, bounds.Right, bounds.Bottom);

                        int width = (int)(bounds.Bottom - bounds.Top - 8);
                        statusRect = new Rectangle((int)(bounds.Left + 4), (int)(bounds.Top + 4), width, (int)(bounds.Height - 8));
                        clientRect = new RectangleF(bounds.Left + 8 + width, bounds.Top + 4, bounds.Width - 12 - width, bounds.Height - 8);
                    }
                    else
                    {
                        path.AddLine(bounds.Left, bounds.Top, bounds.Right - cornerSize, bounds.Top);
                        path.AddArc(bounds.Right - cornerSize, bounds.Top, cornerSize, cornerSize, 270, 90);
                        path.AddLine(bounds.Right, bounds.Top + cornerSize, bounds.Right, bounds.Bottom - cornerSize);
                        path.AddArc(bounds.Right - cornerSize, bounds.Bottom - cornerSize, cornerSize, cornerSize, 0, 90);
                        path.AddLine(bounds.Right - cornerSize, bounds.Bottom, bounds.Left, bounds.Bottom);

                        int width = (int)(bounds.Bottom - bounds.Top - 8);
                        statusRect = new Rectangle((int)(bounds.Right - 4 - width), (int)(bounds.Top + 4), width, (int)(bounds.Height - 8));
                        clientRect = new RectangleF(bounds.Left + 4, bounds.Top + 4, bounds.Width - 12 - width, bounds.Height - 8);
                    }

                    graphics.FillPath(((state & RenderState.Hover)!=0) ? HoverBrush : NormalBrush , path);
                    graphics.DrawPath(BorderPen, path);
                    graphics.FillEllipse(brush, statusRect);

                    if (connector!=null)
                    {
                        connector.Item.RenderConnector(graphics, clientRect);
                    }
                }
			}
		}
 public YttriumConnector(IModel site, ConnectorType type)
     : base(site)
 {
     _connectorType = type;
 }
Ejemplo n.º 51
0
 public DataConnector(ConnectorType type, bool allTag)
 {
     _type = type;
     _allTag = allTag;
     _childs = new QueryNodeCollection(this);
 }
Ejemplo n.º 52
0
 /// <summary>
 /// 获取扩展点
 /// </summary>
 /// <param name="pt"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 private static Point GetExtensionPoint(Point pt, ConnectorType type)
 {
     Point extPoint = pt;
     switch (type)
     {
         case ConnectorType.Left: extPoint.Offset(-20, 0); break;
         case ConnectorType.Right: extPoint.Offset(20, 0); break;
         case ConnectorType.Top: extPoint.Offset(0, -20); break;
         case ConnectorType.Bottom: extPoint.Offset(0, 20); break;
     }
     return extPoint;
 }
Ejemplo n.º 53
0
        /// <summary>
        /// Creates the connector
        /// </summary>
        /// <param name="host">The host name</param>
        /// <param name="port">The port</param>
        /// <param name="databaseName">The database name</param>
        /// <param name="username">The username</param>
        /// <param name="password">The password</param>
        /// <param name="connectionType">The connector type</param>
        public void CreateConnector(string host, string port, string databaseName, string username, string password, ConnectorType connectionType = ConnectorType.Postgresql)
        {
            this.Credentials = new DatabaseCredentials
            {
                Host = host,
                Port = port,
                DatabaseName = databaseName,
                Username = username,
                Password = password
            };

            switch (connectionType)
            {
                case ConnectorType.Postgresql:
                    this.Connector = new PostgresDatabaseConnector();
                    break;
                case ConnectorType.Mysql:
                    this.Connector = new MySQLDatabaseConnector();
                    break;
            }
        }
Ejemplo n.º 54
0
 public DiagramConnector(ConnectorType type,
     DiagramConnectorNode startConnector, DiagramConnectorNode endConnector)
 {
     this.type = type;
     this.start = startConnector;
     this.end = endConnector;
 }
Ejemplo n.º 55
0
 private void SetConnectorType(object parameters)
 {
     if (parameters.ToString() == "BEZIER")
     {
         connectorType = ConnectorType.BEZIER;
     }
     else
     {
         connectorType = ConnectorType.POLYLINE;
     }
 }
Ejemplo n.º 56
0
 public Connector GetConnector(ConnectorType type)
 {
     return Connectors[(int)type];
 }
		/// <summary>
		/// Opens an IL connector of type connectorType declaration at the current indent level and increases the indent level.
		/// <code>
		/// [connectorType]
		/// {
		/// </code>
		/// </summary>
		/// <param name="connectorType">The IL connector type to declare</param>
		/// <returns>The TransformationILWriter instance for use in concatenated output.</returns>
		public TransformationILWriter OpenILConnector(ConnectorType connectorType)
		{
			return OpenILConnectorRaw(connectorType.ToString());
		}
Ejemplo n.º 58
0
 /// <summary>
 /// 计算点集合
 /// </summary>
 /// <param name="startPoint"></param>
 /// <param name="startType"></param>
 /// <param name="endPoint"></param>
 /// <param name="endType"></param>
 /// <returns></returns>
 private static Point[] CalcInterPoints(Point startPoint, ConnectorType startType,
     Point endPoint, ConnectorType endType)
 {
     Direction horzDir = CalcHorzDirection(startPoint, endPoint);
     Direction vertDir = CalcVertDirection(startPoint, endPoint);
     if (!IsConflitDirection(horzDir, startType) && !IsConflitDirection(vertDir, endType))
     {
         Point[] points = new Point[1];
         points[0] = new Point(endPoint.X, startPoint.Y);
         return points;
     }
     else if (!IsConflitDirection(horzDir, endType) && !IsConflitDirection(vertDir, startType))
     {
         Point[] points = new Point[1];
         points[0] = new Point(startPoint.X, endPoint.Y);
         return points;
     }
     else
         return new Point[0];
 }