Beispiel #1
0
 /// <summary>
 /// Raises an event when a new client is connected.
 /// </summary>
 /// <param name="e">Contains the connection link.</param>
 protected virtual void OnNewLink(LinkEventArgs e)
 {
     lock (e.lnk._OnEventLink_ThreadLock)
     {
         NewLink?.Invoke(this, e);
     }
 }
        public DiagramBaseView()
        {
            GridCellSize = Assets.Diagram.Base.GridCellSize;
            GridStyle    = GoViewGridStyle.Dot;
            GridSnapDrag = GoViewSnapStyle.Jump;

            AllowCopy = false;

            NewLinkPrototype = new NewLink();
            PortGravity      = Assets.Diagram.Base.PortGravity; // controls the distance within a port to be linked is snapped

            GoToolContext tool = FindMouseTool(typeof(GoToolContext)) as GoToolContext;

            tool.SingleSelection = false;

            MouseMoveTools.Insert(0, new CustomZooming(this));
            MouseMoveTools.Insert(0, new CustomRubberBanding(this));

            ReplaceMouseTool(typeof(GoToolLinkingNew), new CustomLinkingTool(this));


            ScrollBar hScrollBar = HorizontalScrollBar;
            ScrollBar vScrollBar = VerticalScrollBar;

            hScrollBar.Scroll += (o, e) => this.DoWithinExceptionHandler(() => onScroll(o, e));
            vScrollBar.Scroll += (o, e) => this.DoWithinExceptionHandler(() => onScroll(o, e));
        }
        public async Task <IActionResult> AddLink([FromBody] NewLink IncomingLink)
        {
            Project project = await _context.Projects.FirstOrDefaultAsync(x => x.Id == IncomingLink.ProjectId);

            if (IncomingLink == null || IncomingLink.Link == null || project == null)
            {
                return(NotFound());
            }
            Uri    uri      = new Uri(IncomingLink.Link);
            string LinkMask = _linkMasker.MaskLink(uri);
            Link   link     = new Link()
            {
                Mask = LinkMask, LinkText = IncomingLink.Link, Project = project
            };
            await _context.Links.AddAsync(link);

            await _context.SaveChangesAsync();

            return(PartialView("~/Views/Shared/ProjectManagerPartialViews/EditPartialViews/EditLinkView.cshtml", link));
        }