Example #1
0
        /// <summary>
        /// Loads a folder in the hard drive as the root line
        /// </summary>
        /// <param name="path">Path to load items from</param>
        /// <param name="device">Direct3D Device to use to load the root items</param>
        public void CreateRoot(string path, Device device)
        {
            try
            {
                // make sure we're empty
                this.RemoveLine(0);

                OrbitItem[] newItemRegistry;
                if (Global.Configuration.Behavior.ShowTasksOnly)
                {
                    // load just tasks :P
                    // this is just for testing as a task switcher :P just joking hehehe
                    newItemRegistry = TasksFolderItem.GetTasks(device);

                    // take screenshots if available and selected
                    if (Global.Configuration.Appearance.ShowImageThumbnails)
                    {
                        ThumbnailSync TS = new ThumbnailSync(newItemRegistry, 0);
                    }
                }
                else
                {
                    // load new
                    newItemRegistry = OrbitItemLoader.LoadOrbitFolder(device, path);
                }

                foreach (OrbitItem item in newItemRegistry)
                {
                    item.Paint += new EventHandler(PreviewableItem_Paint);
                    ItemRegistry.Add(item);
                }

                RegisterNewLine(ItemRegistry.Length, Global.Configuration.Locations.ItemsPath, 0);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
        /// <summary>
        /// Loads a dir (a line) resizing the registry only once and filling the items
        /// </summary>
        /// <param name="parentItem">Item in the registry to expand the registry from</param>
        public void ExpandFrom(OrbitItem parentItem)
        {
            // bail out if not the right type of item
            // TODO: block non IEnumeratorItem objects
            //if(!ParentItem.GetType().i)
            //throw new InvalidCastException("Not IEnumeratorItem");

            try
            {
                // get the items for that folder
                OrbitItem[] NewItems = ((IEnumeratorItem)parentItem).GetItems();

                // bail out if returned null
                if (NewItems == null)
                {
                    return;
                }

                // allocate space and move to that spot
                int AllocOffset = AllocateItem(NewItems.Length);

                // add the new items to the registry
                int i = 0;
                while (i < NewItems.Length)
                {
                    // set some properties
                    NewItems[i].Line   = this.LineRegistry.Length;
                    NewItems[i].Parent = parentItem.Name;
                    NewItems[i].Paint += new EventHandler(PreviewableItem_Paint);

                    // add
                    ItemRegistry[AllocOffset + i] = NewItems[i];
                    i++;
                }

                // registering new line
                // find out the next level
                // task folder items don't
                string Path = Global.Configuration.Locations.ItemsPath;
                if (parentItem is StoredLoaderItem || parentItem is FileSystemDirectoryItem)
                {
                    // get the path
                    if (parentItem.GetType() == typeof(FolderItem))
                    {
                        Path = ((StoredOrbitItem)parentItem).ItemPath;
                    }

                    /*if(parentItem.GetType()==typeof(TasksFolderItem))
                     *      Path=Global.Configuration.Runtime.CurrentLevel;*/

                    // assign the level
                    if (Path.LastIndexOf("\\") == Path.Length - 1)
                    {
                        Global.Configuration.Runtime.CurrentLevel = Path.Substring(0, Path.Length - 1);
                    }
                    else
                    {
                        Global.Configuration.Runtime.CurrentLevel = Path;
                    }
                }
                this.RegisterNewLine(NewItems.Length, Path, parentItem.RotationOffset);

                // take screenshots if available and selected
                if (Global.Configuration.Appearance.ShowImageThumbnails)
                {
                    ThumbnailSync TS = new ThumbnailSync(NewItems, this.LineRegistry.Length - 1);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }