Ejemplo n.º 1
0
        public override string ToString()
        {
            var linkText = LinkText;
            var linkPage = LinkPage.ToString();

            return("Page " + linkPage + (linkPage == linkText ? "" : " (" + linkText + ")") + (IsRequestedPage ? " Is Requested" : ""));
        }
Ejemplo n.º 2
0
        public void Initialize()
        {
            InitBrowser(BrowserType.Firefox);
            driver.Navigate().GoToUrl(LinkPage.BaseUrl);
            Methods.Methods.ImplicitWaitForSeconds(driver, 3);

            LinksPage = new LinkPage(driver);
        }
        public IActionResult Delete(int id, int page)
        {
            linkRepo.Delete(id);
            LinkPage linkPage = new LinkPage();
            double   temp     = Convert.ToDouble(linkRepo.Read().Count());

            linkPage.maxPage     = ((int)Math.Ceiling(temp / 20.0) - 1) >= 0 ? ((int)Math.Ceiling(temp / 20.0) - 1) : 0;
            linkPage.currentPage = page;
            linkPage.items       = linkRepo.Read().OrderByDescending((theLink) => theLink.id).Skip(20 * page).Take(20);
            return(Ok(linkPage));
        }
        public IActionResult AddLink(string longLink, int page)
        {
            Link link = new Link();

            link.setLongLink(longLink);
            link.setShortLink(link.shortenIt().Replace("https://goo.gl/", ""));
            linkRepo.Create(link);
            LinkPage linkPage = new LinkPage();
            double   temp     = Convert.ToDouble(linkRepo.Read().Count());

            linkPage.maxPage     = ((int)Math.Ceiling(temp / 20.0) - 1) >= 0 ? ((int)Math.Ceiling(temp / 20.0) - 1) : 0;
            linkPage.currentPage = page;
            linkPage.items       = linkRepo.Read().OrderByDescending((theLink) => theLink.id).Skip(20 * page).Take(20);

            return(Ok(linkPage));
        }
Ejemplo n.º 5
0
        public LinkPage getLinkPage(string linkPageUrl)
        {
            LinkPage parentLinkPage = new LinkPage()
            {
                Url = linkPageUrl
            };
            LinkPage currentLinkPage = parentLinkPage;

            while (currentLinkPage != parentLinkPage && currentLinkPage.IsDeadEnd != true)
            {
                List <string> childLinks = getChildLinks(currentLinkPage.Url);
                currentLinkPage.ChildLinkPages = new List <LinkPage>(childLinks.Count);
                for (int i = 0; i < childLinks.Count; i++)
                {
                    currentLinkPage.ChildLinkPages[i].Url = childLinks[i];
                }

                if (childLinks.Count == 0)
                {
                    currentLinkPage.IsDeadEnd = true;
                    currentLinkPage.MidiLink  = getMidiLink(currentLinkPage.Url);
                    currentLinkPage           = currentLinkPage == parentLinkPage ? currentLinkPage : currentLinkPage.ParentLink;
                    continue;
                }
                else if (childLinks.Count > 0)
                {
                    for (int i = 0; i < childLinks.Count; i++)
                    {
                        string   link     = childLinks[i];
                        LinkPage linkPage = new LinkPage()
                        {
                            Url = link
                        };
                        currentLinkPage = linkPage;
                        getLinkPage(childLinks[i]);
                    }
                }
            }

            return(null);
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (AnnotationLayout != null)
         {
             hashCode = hashCode * 59 + AnnotationLayout.GetHashCode();
         }
         hashCode = hashCode * 59 + LinkType.GetHashCode();
         hashCode = hashCode * 59 + LinkPage.GetHashCode();
         if (LinkUri != null)
         {
             hashCode = hashCode * 59 + LinkUri.GetHashCode();
         }
         hashCode = hashCode * 59 + ShowBorder.GetHashCode();
         if (Color != null)
         {
             hashCode = hashCode * 59 + Color.GetHashCode();
         }
         return(hashCode);
     }
 }
        /// <summary>
        /// Returns true if LinkAnnotationParameters instances are equal
        /// </summary>
        /// <param name="input">Instance of LinkAnnotationParameters to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(LinkAnnotationParameters input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     AnnotationLayout == input.AnnotationLayout ||
                     (AnnotationLayout != null &&
                      AnnotationLayout.Equals(input.AnnotationLayout))
                     ) &&
                 (
                     LinkType == input.LinkType ||
                     LinkType.Equals(input.LinkType)
                 ) &&
                 (
                     LinkPage == input.LinkPage ||
                     LinkPage.Equals(input.LinkPage)
                 ) &&
                 (
                     LinkUri == input.LinkUri ||
                     (LinkUri != null &&
                      LinkUri.Equals(input.LinkUri))
                 ) &&
                 (
                     ShowBorder == input.ShowBorder ||
                     ShowBorder.Equals(input.ShowBorder)
                 ) &&
                 (
                     Color == input.Color ||
                     (Color != null &&
                      Color.Equals(input.Color))
                 ));
        }
Ejemplo n.º 8
0
 public void LinkPageForm(object tTag)
 {
     try
     {
         Assembly aAssembly = Assembly.GetEntryAssembly();
         string   strPath   = aAssembly.GetName().ToString();
         string   strForm   = strPath.Substring(0, strPath.IndexOf(",")) + "." + LinkPage.Trim();
         Type     tType     = aAssembly.GetType(strForm);
         Form     frm       = ((Form)Activator.CreateInstance(tType));
         frm.Tag = tTag;
         frm.ShowDialog();
     }
     catch (Exception eException)
     {
         System.Windows.Forms.MessageBox.Show(eException.Message);
     }
 }
Ejemplo n.º 9
0
 public Form LinkPageForm()
 {
     try
     {
         Assembly aAssembly = Assembly.GetEntryAssembly();
         string   strPath   = aAssembly.GetName().ToString();
         string   strForm   = strPath.Substring(0, strPath.IndexOf(",")) + "." + LinkPage.Trim();
         Type     tType     = aAssembly.GetType(strForm);
         return((Form)Activator.CreateInstance(tType));
     }
     catch (Exception eException)
     {
         System.Windows.Forms.MessageBox.Show(eException.Message);
         return(null);
     }
 }