private void DataGridView1_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
        {
            for (int i = 0; i < dataGridView1.Columns.Count; i++)
            {
                var column = dataGridView1.Columns[i];
                contents.Columns[i].ColumnWidth = column.Width;
            }

            TableContents.SaveContents(contents);
        }
        private void addButton_Click(object sender, EventArgs e)
        {
            var content = new TableContent
            {
                FileName = this.fileNameTextBox.Text ?? "",
                Referer  = this.refererTextBox.Text ?? "",
                Url      = this.urltextBox.Text ?? ""
            };

            if (content.FileName.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
            {
                errorLabel.Text = "File name invalid";
            }
            else
            {
                MainWindow.contents.TableData.Add(content);
                TableContents.SaveContents(MainWindow.contents);

                this.Close();
            }
        }
 private void MainWindow_ResizeEnd(object sender, EventArgs e)
 {
     contents.Size = this.ClientSize;
     TableContents.SaveContents(contents);
 }