Ejemplo n.º 1
0
 public ResourceVerifierForm()
 {
     InitializeComponent();
     _workingDataSet = new MessagesDataSet();
     _errorsDataSet = new ErrorsDataSet();
     _languageFilesList = new List<LanguageFilesFolder>();
     _restrictedWords = new List<string>();
     _allowedSimilarWords = new List<string>();
 }
Ejemplo n.º 2
0
        private void BackgroundRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            // First, handle the case where an exception was thrown.
            if (e.Error != null)
            {
                // There was an error during the operation.
                var msg = string.Format("An error occurred: {0}", e.Error.Message);
                MessageBox.Show(msg);
            }
            else if (e.Cancelled)
            {
                // Next, handle the case where the user canceled
                // the operation.
                // Note that due to a race condition in
                // the DoWork event handler, the Cancelled
                // flag may not have been set, even though
                // CancelAsync was called.
                resultLabel.Text = "Отменён";
            }
            else
            {
                // Finally, handle the case where the operation
                // succeeded.
                _errorsDataSet = new ErrorsDataSet();
                _errorsDataSet.CreateFromMessagesSet(_workingDataSet);
                errorsGridView.DataSource = _errorsDataSet;
                errorsGridView.DataMember = "Errors";
                errorsGridView.Sort(errorsGridView.Columns[0], ListSortDirection.Ascending);
                errorsGridView.Columns[0].Visible = false;
                errorsGridView.AdjustColumnsWidth();
                resultLabel.Text = "Завершён";
            }

            // Enabling controls back
            messagesGridView.Enabled = true;
            analyzeDataButton.Enabled = true;
            resetButton.Enabled = true;
            menuStrip.Enabled = true;
            cancelButton.Visible = false;
            clearErrorsButton.Visible = true;
        }
Ejemplo n.º 3
0
 private void ResetForm(object sender, EventArgs e)
 {
     messagesGridView.DataSource = null;
     _workingDataSet = new MessagesDataSet();
     errorsGridView.DataSource = null;
     _errorsDataSet = new ErrorsDataSet();
     _workingFolder = null;
     _languageFilesList = new List<LanguageFilesFolder>();
     if (_filesFinder != null)
         _filesFinder.Reset();
     _restrictedWords = new List<string>();
     languageToolStripMenuItem.DropDownItems.Clear();
     languageToolStripMenuItem.DropDownItems.Add(loadLanguagesFromSettingsToolStripMenuItem);
     _languageMenu = null;
     selectAllLanguagesToolStripMenuItem.Checked = false;
     analyzeDataButton.Enabled = false;
 }
Ejemplo n.º 4
0
 private void ClearErrors(object sender, EventArgs e)
 {
     errorsGridView.DataSource = null;
     _errorsDataSet = new ErrorsDataSet();
     if (_workingDataSet == null || _workingDataSet.Tables.Count < 1 || _workingDataSet.Tables[0].Rows.Count < 1)
         return;
     _workingDataSet.ErrorsCount = 0;
     foreach (DataRow row in _workingDataSet.Tables[0].Rows)
     {
         foreach (var cell in row.ItemArray)
         {
             if (cell.GetType() != typeof(MessagesDataSetItem)) continue;
             ((MessagesDataSetItem)cell).ErrorText = string.Empty;
             ((MessagesDataSetItem)cell).ErrorId = 0;
             ((MessagesDataSetItem)cell).ErrorType = ErrorTypes.NoError;
         }
     }
     messagesGridView.HighlightErrors();
 }