Ejemplo n.º 1
0
 private void ButtonDeletion_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Do you make sure?", "Confirmation", MessageBoxButtons.OKCancel) == DialogResult.OK)
     {
         var fileProcessor = new FileProcessor();
         fileProcessor.DeletionSuccess += (file) =>
         {
             DataAccessHelper.Delete(file.FullName);
             var selected = ResultDataSource.Where(it => it.FilePath == file.FullName);
             for (int i = 0; i < selected.Count(); i++)
             {
                 ResultDataSource.Remove(selected.ElementAt(i));
             }
         };
         fileProcessor.NewMessageArrived += (o) =>
         {
             Library.Message message;
             if (o.TryDequeue(out message))
             {
                 DataAccessHelper.Add(new DataAccess.Message()
                 {
                     FolderPath = message.FolderPath, FilePath = message.FilePath, ExceptionMessage = message.Exception?.Message, ExceptionLog = message.Exception?.ToString(), MessageType = MessageType.Deletion
                 });
             }
         };
         fileProcessor.Delete(GeneratorFileInfos(ResultDataSource.Where(it => it.Checked)));
         DataGridViewResult.Refresh();
     }
 }
Ejemplo n.º 2
0
        private void ButtonDeletion_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Do you make sure?", "Confirmation", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                var selected = ResultDataSource.Where(it => it.Checked);
                DataAccessHelper.Delete(selected.ForEach <List <DataAccess.Message>, MessageView, DataAccess.Message>(it => it.ToMessage()));

                for (int i = 0; i < selected.Count(); i++)
                {
                    ResultDataSource.Remove(selected.ElementAt(i));
                }
                DataGridViewResult.Refresh();
            }
        }
Ejemplo n.º 3
0
        private void ResultForm_Load(object sender, EventArgs e)
        {
            DataGridViewResult.AutoGenerateColumns     = false;
            DataGridViewResult.ColumnHeaderMouseClick += (o, e2) =>
            {
                var column = DataGridViewResult.SortedColumn;
                if (column.HeaderCell.SortGlyphDirection == SortOrder.Ascending)
                {
                    column.HeaderCell.SortGlyphDirection = SortOrder.Descending;

                    DataGridViewResult.Sort(column, ListSortDirection.Ascending);
                }
                else
                {
                    column.HeaderCell.SortGlyphDirection = SortOrder.Ascending;
                    DataGridViewResult.Sort(column, ListSortDirection.Descending);
                }
            };
            ButtonRefresh_Click(null, null);
        }
Ejemplo n.º 4
0
        private void CheckBoxAll_CheckedChanged(object sender, EventArgs e)
        {
            ResultDataSource.ForEach(it => it.Checked = CheckBoxAll.Checked);

            DataGridViewResult.Refresh();
        }