public void refresh()
        {
            IEnumerable items = target.value as IEnumerable;

            menu = new aceMenu();

            menu.menuTitle       = "Inside " + target.pi.DeclaringType.Name + "->" + target.displayName + " collection";
            menu.menuDescription = "Collection type [" + target.pi.PropertyType.ToString() + "]";

            pageManager = new textPageManager <aceMenuItem>(10, 100, 1);

            itemSettings = null;

            Int32 c = 0;

            foreach (var t in items)
            {
                if (itemSettings == null)
                {
                    itemSettings = new settingsEntriesForObject(t);
                }
                var mi = new aceMenuItem(t.ToString(), c.ToString(), t.GetType().Name, "", t);
                menu.setItem(mi);
            }
        }
Example #2
0
        /// <summary>
        /// Izvrsava se svaki put kad treba azurirati strukturu sadrzaja prema DataModel izvoru
        /// </summary>
        public void refresh()
        {
            if (String.IsNullOrEmpty(path))
            {
                path = "";
            }

            if (File.Exists(path))
            {
                filename = Path.GetFileName(path);
                path     = Path.GetDirectoryName(path);
            }

            files = new fileSystemList(path, selectMode, extension);

            menu = new aceMenu();

            switch (selectMode)
            {
            case dialogSelectFileMode.selectPath:
                menu.menuTitle = "Select directory path";
                //items.AddRange(Directory.EnumerateDirectories(path));
                break;

            case dialogSelectFileMode.selectFileToOpen:
                menu.menuTitle = "Select file to load (".add(files.pattern, " ").add(")", " ");
                //items.AddRange(Directory.EnumerateDirectories(path, "*", SearchOption.TopDirectoryOnly));
                //items.AddRange(Directory.EnumerateFiles(path, pattern, SearchOption.TopDirectoryOnly));
                break;

            case dialogSelectFileMode.selectFileToSave:
                menu.menuTitle = "Select file or type filename (*".add(extension, ".") + ")";
                //items.AddRange(Directory.EnumerateDirectories(path, "*", SearchOption.TopDirectoryOnly));
                //items.AddRange(Directory.EnumerateFiles(path, pattern, SearchOption.TopDirectoryOnly));
                break;
            }

            foreach (var di in files.directories)
            {
                String      nm       = "";
                aceMenuItem menuItem = null;
                if (files.rootDirectory.Parent != null)
                {
                    if (di.FullName == files.rootDirectory.Parent.FullName)
                    {
                        nm                = "..";
                        menuItem          = new aceMenuItem(nm, "", "<dir>", "<lock>", di);
                        menuItem.helpLine = "Move to parent";
                    }
                }

                if (files.rootDirectory != null)
                {
                    if (di.FullName == files.rootDirectory.FullName)
                    {
                        nm                = ".";
                        menuItem          = new aceMenuItem(nm, "", "<dir>", "<lock>", di);
                        menuItem.helpLine = "This directory";
                    }
                }

                if (String.IsNullOrEmpty(nm))
                {
                    nm                = di.FullName.Replace(files.rootDirectory.FullName, "");
                    menuItem          = new aceMenuItem(nm, "", "<dir>", "<lock>", di);
                    menuItem.helpLine = di.FullName;
                }

                menu.setItem(menuItem);

                //if (path == di.FullName)
                //{
                //    menu.selected = menuItem;
                //}
            }

            foreach (var di in files.files)
            {
                aceMenuItem menuItem = new aceMenuItem(di.Name, "", di.LastWriteTime.ToShortDateString(), "", di);
                menuItem.helpLine = di.FullName;
                menu.setItem(menuItem);

                //if (path == di.FullName)
                //{
                //    menu.selected = menuItem;
                //}
            }

            pageManager = new textPageManager <aceMenuItem>(10);
            pageManager.refresh(menu);
        }