Beispiel #1
0
        public SWFileStatus getStatus()
        {
            SWFileStatus s;

            if (!File.Exists(Path.Combine(project.workDir, file)))
            {
                s = new SWFileStatus("FILE MISSING", Color.Red, SWFileStatusType.FILE_MISSING);
            }
            else if (updatePending)
            {
                s = new SWFileStatus("READING DATA", Color.Blue, SWFileStatusType.READING_DATA);
            }
            else
            {
                s = new SWFileStatus("OK", Color.Green, SWFileStatusType.OK);
            }
            return(s);
        }
Beispiel #2
0
        public void update()
        {
            string filter = filterTextBox.Text.ToLower();

            dataGridView1.Columns[nameColumn.Name].HeaderText = Settings.Default.propertyName;
            dataGridView1.Rows.Clear();
            List <SWFile> files_s = project.files.OrderBy <SWFile, int>(x => x.number).Where(
                x => x.name.ToLower().Contains(filter) || SWFile.fourDigit(x.number).Contains(filter) ||
                x.prefix.ToLower().Contains(filter) || x.suffix.ToLower().Contains(filter) ||
                x.file.ToLower().Contains(filter)
                ).ToList <SWFile>();

            countLabel.Text = String.Format("Count: {0}", files_s.Count);
            int n = 0;

            foreach (SWFile f in files_s)
            {
                n++;
                while (f.number < n)
                {
                    n--;
                }
                DataGridViewRow row = new DataGridViewRow();
                SWFileStatus    s   = f.getStatus();
                f.lastShownStatus = s;
                if (Settings.Default.showEmptyRows && filter == "")
                {
                    while (f.number > n)
                    {
                        this.createEmptyRow(n);
                        n++;
                    }
                }
                row.CreateCells(dataGridView1, f.typeString, f.prefix, SWFile.fourDigit(f.number), f.suffix, f.name, f.file, s.ToString());
                if (row.Cells.Count == 0)
                {
                    // Happens when updating closed form
                    continue;
                }
                row.Tag = f;
                row.Cells[dataGridView1.Columns["statusColumn"].Index].Style.ForeColor = s.Color;
                dataGridView1.Rows.Add(row);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Updates file's name, path and status in grid view. Use only from thread that created the UI !!!
        /// </summary>
        /// <param name="f">File to update</param>
        public void updateFile(SWFile f)
        {
            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                if (row.Tag == f)
                {
                    row.Cells[typeColumn.Index].Value = f.typeString;
                    row.Cells[nameColumn.Index].Value = f.name;
                    row.Cells[filepath.Index].Value   = f.file;

                    SWFileStatus s = f.getStatus();
                    if (s != f.lastShownStatus)
                    {
                        row.Cells[statusColumn.Index].Value = s.ToString();
                        row.Cells[dataGridView1.Columns["statusColumn"].Index].Style.ForeColor = s.Color;
                    }
                    f.lastShownStatus = s;
                    break;
                }
            }
        }