public void SelectNamespace(string namespaceName)
 {
     SubEntries.Clear();
     foreach (var type in cycle.TypesReferencingOutOf(namespaceName))
     {
         SubEntries.Add(new TypeReferenceVM(type));
     }
 }
Exemple #2
0
 private void AddSubEntry(CourseSubEntry e)
 {
     SubEntries.Add(e);
     SubEntries.Sort((c1, c2) =>
     {
         return((int)c1.DayOfWeek * 10 + c1.CourseTime - (int)c2.DayOfWeek * 10 - c2.CourseTime);
     });
 }
        /// <summary>
        /// Add prototype of this name to the subentries
        /// </summary>
        public void AddPrototype(string prototypeName)
        {
            var prototype   = Entry.GetPrototype(prototypeName).Instantiate();
            var prototypeVm = new EntryViewModel(prototype);

            SubEntries.Add(prototypeVm);

            UpdateParent(prototypeVm);
        }
        public void LoadSubdirectories(Settings settings)
        {
            if (FolderPath == settings.SaveInLinksFolderPath || FolderPath == null || FolderPath == string.Empty)
            {
                return;
            }

            try
            {
                string[] subdirectoryEntries = Directory.GetDirectories(FolderPath);

                if (subdirectoryEntries.Length > 0)
                {
                    for (int i = 0; i < subdirectoryEntries.Length; i++)
                    {
                        SubEntries.Add(new MenuEntry()
                        {
                            FolderPath = subdirectoryEntries[i], Name = Path.GetFileName(subdirectoryEntries[i]), Deepness = this.Deepness + 1
                        });
                        SubEntries[i].LoadSubdirectories(settings);
                    }

                    if (!settings.DisableLinkBack)
                    {
                        string insertName = settings.BackLinkStartText + this.Name + settings.BackLinkEndText;


                        if (settings.IncludeNameInBackLink)
                        {
                            insertName = settings.BackLinkStartText + this.Name + settings.BackLinkEndText;
                        }
                        else
                        {
                            insertName = settings.BackLinkStartText + settings.BackLinkEndText;
                        }

                        MenuEntry entry = new MenuEntry()
                        {
                            FolderPath = this.FolderPath, Name = insertName, Deepness = this.Deepness + 1
                        };

                        if (settings.LinkBackOnBottom)
                        {
                            SubEntries.Add(entry);
                        }
                        else
                        {
                            SubEntries.Insert(0, entry);
                        }
                    }
                }
                else if (!settings.DisableLinkBack && settings.ForceLinkBack && Deepness > 0)
                {
                    string insertName = settings.BackLinkStartText + this.Name + settings.BackLinkEndText;


                    if (settings.IncludeNameInBackLink)
                    {
                        insertName = settings.BackLinkStartText + this.Name + settings.BackLinkEndText;
                    }
                    else
                    {
                        insertName = settings.BackLinkStartText + settings.BackLinkEndText;
                    }

                    MenuEntry entry = new MenuEntry()
                    {
                        FolderPath = this.FolderPath, Name = insertName, Deepness = this.Deepness + 1
                    };


                    SubEntries.Add(entry);
                }
            }
            catch (UnauthorizedAccessException)
            {
                return;
            }
            catch (DirectoryNotFoundException) // Probably a broken link within the path, in this context..
            {
                return;
            }
            //TODO: Should probably give some feedback.
            catch (PathTooLongException)
            {
                return;
            }
        }