Beispiel #1
0
        /// <summary></summary>
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g(this, "Image Name"), 70);

            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            string wikiPath = "";

            try {
                wikiPath = WikiPages.GetWikiPath();
            }
            catch (Exception ex) {
                MessageBox.Show(this, ex.Message);
                DialogResult = DialogResult.Cancel;
                return;
            }
            List <string> listFileNames = FileAtoZ.GetFilesInDirectory(wikiPath);         //All files from the wiki file path, including images and other files.

            ImageNamesList = new List <string>();
            for (int i = 0; i < listFileNames.Count; i++)
            {
                //If the user has entered a search keyword, then only show file names which contain the keyword.
                if (textSearch.Text != "" && !Path.GetFileName(listFileNames[i]).ToLower().Contains(textSearch.Text.ToLower()))
                {
                    continue;
                }
                //Only add image files to the ImageNamesList, not other files such at text files.
                if (ImageHelper.HasImageExtension(listFileNames[i]))
                {
                    ImageNamesList.Add(listFileNames[i]);
                }
            }
            for (int i = 0; i < ImageNamesList.Count; i++)
            {
                ODGridRow row = new ODGridRow();
                row.Cells.Add(Path.GetFileName(ImageNamesList[i]));
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            labelImageSize.Text  = Lan.g(this, "Image Size") + ":";
            picturePreview.Image = null;
            picturePreview.Invalidate();
        }