Example #1
0
        public MainForm(string[] args)
        {
            // Save command-line arguments for later use.
            _commandLineArgs = args;

            WindowSerializer windowSerializer = new WindowSerializer(this);

            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            Images = new DirectoryImageCollection();
            Navigator = new ImageNavigator();

            LoadPreference();
        }
Example #2
0
        public DirectoryImageCollection FindNextCollection(int direction)
        {
            // Get all sibling directory.
            DirectoryInfo dirCur = new DirectoryInfo(Directory);
            DirectoryInfo dirParent = dirCur.Parent;

            if (dirParent == null)
            {
                return null; // it is root directory already.
            }

            DirectoryInfo[] dirs = dirParent.GetDirectories();

            int startIndex = 0;
            for ( int i = 0; i < dirs.Length; i++)
            {
                if (dirs[i].FullName == Directory)
                {
                    startIndex = i;
                    break;
                }
            }

            for ( int i = NextIndex( startIndex + direction, dirs.Length); i != startIndex; )
            {
                DirectoryImageCollection collection = new DirectoryImageCollection();
                collection.Collect(dirs[i]);
                if (collection.Count > 0) // if this folder contains any image files.
                {
                    return collection;
                }

                i = NextIndex( i + direction, dirs.Length);
            }

            return null;
        }