public void SetLinkForSubstrings(string[] substrings, LinkHandler handler)
 {
     foreach (var item in substrings)
     {
         SetLinkForSubstring(item, handler);
     }
 }
Esempio n. 2
0
 private void ForEachLink(LinkHandler linkHandler)
 {
     foreach (Transform linkTransform in transform)
     {
         GameObject link = linkTransform.gameObject;
         linkHandler(link);
     }
 }
        public void SetLinkForRange(NSRange range, UIStringAttributes attributes, LinkHandler handler)
        {
            CheckIfShouldDoAttribute();
            var newAttribute = new NSMutableAttributedString(AttributedText);

            newAttribute.AddAttributes(attributes, range);
            if (handler != null)
            {
                _handlerDictionary.TryAdd(range, handler);
            }
            AttributedText = newAttribute;
        }
Esempio n. 4
0
        public IActionResult Index(string url, int depth)
        {
            var lh    = new LinkHandler(url, depth);
            var links = lh.Visit(1, new List <string>()
            {
                url
            }, new List <DBTable>());

            ViewBag.Data = links;

            return(View("~/Views/Home/Links.cshtml"));
        }
    protected void btnOk_Click(object sender, EventArgs e)
    {
        if (copyProfileParameter.SelectedUserId.Trim().Length == 0)
        {
            copyProfileParameter.IsValid = false;
            return;
        }

        CopyProfileToSelectedUsers();

        LinkHandler linkHandler = new LinkHandler(Page);
        linkHandler.RedirectToNewGroupDetail(_selUsers);

        this.OnClosing();
    }
Esempio n. 6
0
    protected void btnOk_Click(object sender, EventArgs e)
    {
        if (copyProfileParameter.SelectedUserId.Trim().Length == 0)
        {
            copyProfileParameter.IsValid = false;
            return;
        }

        CopyProfileToSelectedUsers();

        LinkHandler linkHandler = new LinkHandler(Page);

        linkHandler.RedirectToNewGroupDetail(_selUsers);

        this.OnClosing();
    }
        public AssemblyParser(
            string assemblyPath,
            string projectPath,
            string parentName,
            Action <NodeData> nodeCallback,
            Action <LinkData> linkCallback,
            bool isReadSymbols)
        {
            ProjectPath       = projectPath;
            this.assemblyPath = assemblyPath;
            this.parentName   = parentName;
            this.nodeCallback = nodeCallback;

            XmlDocParser xmlDockParser = new XmlDocParser(assemblyPath);

            linkHandler = new LinkHandler(linkCallback);

            assemblyReferencesParser = new AssemblyReferencesParser(linkHandler, nodeCallback);
            typeParser   = new TypeParser(linkHandler, xmlDockParser, nodeCallback);
            memberParser = new MemberParser(linkHandler, xmlDockParser, nodeCallback);

            assembly = new Lazy <AssemblyDefinition>(() => GetAssembly(isReadSymbols));
        }
Esempio n. 8
0
    private void CopySelectedUsers(IList<string> targetUserIds)
    {
        var ums = ApplicationContext.Current.Services.Get<IUserManagementService>();
        IList<IUser> newUserList = new List<IUser>();

        var userManagementSvc = ApplicationContext.Current.Services.Get<IUserManagementService>();

        try
        {

            foreach (string id in targetUserIds)
            {
                IUser existingUser = EntityFactory.GetById<IUser>(id);
                if (existingUser != null && existingUser.UserInfo != null)
                {
                    if (existingUser.Type == UserType.Retired)
                        throw new ApplicationException(GetLocalResourceObject("ErrorCannotCopyRetiredUser").ToString());

                    AddUserOptions options = SetAddUserOptions(existingUser);

                    // create the new user with default data
                    IUser newUser = ums.AddUser("", options);

                    // sometimes the copy of... name is too long for the data type
                    string nameFormat = " {0}, {1}";
                    if (string.IsNullOrEmpty(existingUser.UserInfo.FirstName))
                        nameFormat = " {0}{1}";
                    string fullNameFormat = string.Concat("<", GetLocalResourceObject("CopyOfNameTemplate").ToString(), nameFormat, ">");
                    string newName = string.Format(fullNameFormat, existingUser.UserInfo.LastName, existingUser.UserInfo.FirstName);

                    /* the following could be used to improve the user experience, but it doesn't match the lan product */
                    //string copyOfTemplate = GetLocalResourceObject("CopyOfNameTemplate").ToString();
                    //string fullNameFormat = string.Concat("<", copyOfTemplate, nameFormat, ">");
                    //string newLastName = existingUser.UserInfo.LastName;
                    //if (newLastName.Contains(string.Concat("<", copyOfTemplate)))
                    //{
                    //    Match match = Regex.Match(newLastName, string.Concat("<", copyOfTemplate, "(.*)", ">"), RegexOptions.IgnoreCase);
                    //    if (match.Groups.Count > 0)
                    //        newLastName = match.Groups[1].Value;
                    //}
                    //string newName = string.Format(fullNameFormat, newLastName, existingUser.UserInfo.FirstName);

                    newUser.UserInfo.LastName = newName.Length > 32 ? newName.Substring(0, 32) : newName;
                    newUser.UserInfo.UserName = newName.Length > 64 ? newName.Substring(0, 64) : newName;

                    string userTemplate = existingUser.UserInfo.UserName;
                    newUser.UserTemplate = userTemplate.Length > 30 ? userTemplate.Substring(0, 30) : userTemplate;

                    newUser.Save();

                    if (newUser != null)
                        newUserList.Add(newUser);

                }

                if (newUserList.Count > 0)
                {
                    LinkHandler linkHandler = new LinkHandler(Page);
                    linkHandler.RedirectToNewGroupDetail(newUserList);
                }

            }

        }
        catch (Exception exp)
        {
            // need this to replace the dialog for copy user.
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("{0}  ", exp.Message);
            while (exp.InnerException != null)
            {
                sb.AppendFormat("{0}  ", exp.InnerException.Message);
                exp = exp.InnerException;
            }
            DialogService.ShowMessage(sb.ToString(), GetLocalResourceObject("ErrorMessageTitle").ToString());
        }
    }
 public void SetLinkForSubstring(string substring, LinkHandler handler)
 {
     SetLinkForSubstring(substring, LinkAttributeDefault, handler);
 }
        public void SetLinkForSubstring(string substring, UIStringAttributes attributes, LinkHandler handler)
        {
            var range = Text.IndexOf(substring, StringComparison.CurrentCulture);

            if (range < 0)
            {
                return;
            }
            SetLinkForRange(new NSRange(range, substring.Length), attributes, handler);
        }
 public void SetLinkForRange(NSRange range, LinkHandler handler)
 {
     SetLinkForRange(range, LinkAttributeDefault, handler);
 }
Esempio n. 12
0
    private void CopySelectedUsers(IList <string> targetUserIds)
    {
        var           ums         = ApplicationContext.Current.Services.Get <IUserManagementService>();
        IList <IUser> newUserList = new List <IUser>();

        var userManagementSvc = ApplicationContext.Current.Services.Get <IUserManagementService>();

        try
        {
            foreach (string id in targetUserIds)
            {
                IUser existingUser = EntityFactory.GetById <IUser>(id);
                if (existingUser != null && existingUser.UserInfo != null)
                {
                    if (existingUser.Type == UserType.Retired)
                    {
                        throw new Sage.Platform.Application.ValidationException(GetLocalResourceObject("ErrorCannotCopyRetiredUser").ToString());
                    }

                    AddUserOptions options = SetAddUserOptions(existingUser);

                    // create the new user with default data
                    IUser newUser = ums.AddUser("", options);

                    // sometimes the copy of... name is too long for the data type
                    string nameFormat = " {0}, {1}";
                    if (string.IsNullOrEmpty(existingUser.UserInfo.FirstName))
                    {
                        nameFormat = " {0}{1}";
                    }
                    string fullNameFormat = string.Concat("(", GetLocalResourceObject("CopyOfNameTemplate").ToString(), nameFormat, ")");
                    string newName        = string.Format(fullNameFormat, existingUser.UserInfo.LastName, existingUser.UserInfo.FirstName);

                    /* the following could be used to improve the user experience, but it doesn't match the lan product */
                    //string copyOfTemplate = GetLocalResourceObject("CopyOfNameTemplate").ToString();
                    //string fullNameFormat = string.Concat("<", copyOfTemplate, nameFormat, ">");
                    //string newLastName = existingUser.UserInfo.LastName;
                    //if (newLastName.Contains(string.Concat("<", copyOfTemplate)))
                    //{
                    //    Match match = Regex.Match(newLastName, string.Concat("<", copyOfTemplate, "(.*)", ">"), RegexOptions.IgnoreCase);
                    //    if (match.Groups.Count > 0)
                    //        newLastName = match.Groups[1].Value;
                    //}
                    //string newName = string.Format(fullNameFormat, newLastName, existingUser.UserInfo.FirstName);

                    newUser.UserInfo.LastName = newName.Length > 32 ? newName.Substring(0, 32) : newName;
                    newUser.UserInfo.UserName = newName.Length > 64 ? newName.Substring(0, 64) : newName;

                    string userTemplate = existingUser.UserInfo.UserName;
                    newUser.UserTemplate = userTemplate.Length > 30 ? userTemplate.Substring(0, 30) : userTemplate;

                    newUser.Save();

                    if (newUser != null)
                    {
                        newUserList.Add(newUser);
                    }
                }

                if (newUserList.Count > 0)
                {
                    LinkHandler linkHandler = new LinkHandler(Page);
                    linkHandler.RedirectToNewGroupDetail(newUserList);
                }
            }
        }
        catch (ValidationException)
        {
            throw;
        }
        catch (Exception exp)
        {
            string sSlxErrorId = null;
            var    sMsg        = ErrorHelper.GetClientErrorHtmlMessage(exp, ref sSlxErrorId);
            if (!string.IsNullOrEmpty(sSlxErrorId))
            {
                log.Error(ErrorHelper.AppendSlxErrorId("The call to CopySelectedUsers() failed", sSlxErrorId), exp);
            }
            DialogService.ShowHtmlMessage(sMsg, GetLocalResourceObject("ErrorMessageTitle").ToString(),
                                          ErrorHelper.IsDevelopmentContext() ? 600 : -1,
                                          ErrorHelper.IsDevelopmentContext() ? 800 : -1);
        }
    }
Esempio n. 13
0
 public ResourceInfo(string filePath, Repository repository, LinkHandler handler)
 {
     FilePath   = filePath;
     Repository = repository;
     Handler    = handler;
 }
Esempio n. 14
0
        public WebClient fetchLink(Uri url, LinkHandler handler)
        {
            DateTime startTime = DateTime.Now;
            this.fetchCount += 1;
            if(this.verbose)
                System.Console.WriteLine("fetching content for: "+url.AbsoluteUri+" "+this.fetchCount);
            WebClient cl = new WebClient();

            cl.DownloadStringCompleted += delegate(object sender, DownloadStringCompletedEventArgs e) {
                if(this.verbose)
                    System.Console.WriteLine("got content for "+url.AbsoluteUri+" time: "+(DateTime.Now-startTime));
                this.fetchCount -= 1;
                handler(sender, new models.Link(url, e.Result));
            };

            cl.DownloadStringAsync(url);
            return cl;
        }
Esempio n. 15
0
    private void CopySelectedUsers(IList<string> targetUserIds)
    {
        var ums = ApplicationContext.Current.Services.Get<IUserManagementService>();
        IList<IUser> newUserList = new List<IUser>();

        var userManagementSvc = ApplicationContext.Current.Services.Get<IUserManagementService>();

        try
        {

            foreach (string id in targetUserIds)
            {
                IUser existingUser = EntityFactory.GetById<IUser>(id);
                if (existingUser != null && existingUser.UserInfo != null)
                {
                    if (existingUser.Type == UserType.Retired)
                        throw new Sage.Platform.Application.ValidationException(GetLocalResourceObject("ErrorCannotCopyRetiredUser").ToString());

                    AddUserOptions options = SetAddUserOptions(existingUser);

                    // create the new user with default data
                    IUser newUser = ums.AddUser("", options);

                    // sometimes the copy of... name is too long for the data type
                    string nameFormat = " {0}, {1}";
                    if (string.IsNullOrEmpty(existingUser.UserInfo.FirstName))
                        nameFormat = " {0}{1}";
                    string fullNameFormat = string.Concat("(", GetLocalResourceObject("CopyOfNameTemplate").ToString(), nameFormat, ")");
                    string newName = string.Format(fullNameFormat, existingUser.UserInfo.LastName, existingUser.UserInfo.FirstName);

                    /* the following could be used to improve the user experience, but it doesn't match the lan product */
                    //string copyOfTemplate = GetLocalResourceObject("CopyOfNameTemplate").ToString();
                    //string fullNameFormat = string.Concat("<", copyOfTemplate, nameFormat, ">");
                    //string newLastName = existingUser.UserInfo.LastName;
                    //if (newLastName.Contains(string.Concat("<", copyOfTemplate)))
                    //{
                    //    Match match = Regex.Match(newLastName, string.Concat("<", copyOfTemplate, "(.*)", ">"), RegexOptions.IgnoreCase);
                    //    if (match.Groups.Count > 0)
                    //        newLastName = match.Groups[1].Value;
                    //}
                    //string newName = string.Format(fullNameFormat, newLastName, existingUser.UserInfo.FirstName);

                    newUser.UserInfo.LastName = newName.Length > 32 ? newName.Substring(0, 32) : newName;
                    newUser.UserInfo.UserName = newName.Length > 64 ? newName.Substring(0, 64) : newName;

                    string userTemplate = existingUser.UserInfo.UserName;
                    newUser.UserTemplate = userTemplate.Length > 30 ? userTemplate.Substring(0, 30) : userTemplate;

                    newUser.Save();

                    if (newUser != null)
                        newUserList.Add(newUser);

                }

                if (newUserList.Count > 0)
                {
                    LinkHandler linkHandler = new LinkHandler(Page);
                    linkHandler.RedirectToNewGroupDetail(newUserList);
                }

            }

        }
        catch (ValidationException)
        {
            throw;
        }
        catch (Exception exp)
        {
            string sSlxErrorId = null;
            var sMsg = ErrorHelper.GetClientErrorHtmlMessage(exp, ref sSlxErrorId);
            if (!string.IsNullOrEmpty(sSlxErrorId))
            {
                log.Error(ErrorHelper.AppendSlxErrorId("The call to CopySelectedUsers() failed", sSlxErrorId), exp);
            }
            DialogService.ShowHtmlMessage(sMsg, GetLocalResourceObject("ErrorMessageTitle").ToString(),
                                          ErrorHelper.IsDevelopmentContext() ? 600 : -1,
                                          ErrorHelper.IsDevelopmentContext() ? 800 : -1);
        }
    }