/// ------------------------------------------------------------------------------------
        /// <summary>
        /// This method will initialize the values in the column we added in this add-on
        /// (i.e. the column allowing the user to specify whether or not they want to skip
        /// loading one or more data sources in the current project).
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected bool OnInitializeLoadColumn(object args)
        {
            if (m_skippedList == null)
            {
                return(true);
            }

            m_grid.CellValueChanged -= m_grid_CellValueChanged;
            bool wasDirty = m_grid.IsDirty;

            foreach (DataGridViewRow row in m_grid.Rows)
            {
                row.Cells[kLoadColName].Value =
                    !m_skippedList.SkipDataSource(row.Cells["sourcefiles"].Value as string);
            }

            m_grid.IsDirty           = wasDirty;
            m_grid.CellValueChanged += m_grid_CellValueChanged;

            // For some reason, the selected row's check box doesn't get painted
            // after being set. This seems to take care of the problem.
            m_grid.EndEdit();

            return(true);
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// This message (i.e. BeforeLoadingDataSources) gets called right before PA loads all
        /// the data sources in the current project. This specific version of the message
        /// handler will do is find all data sources that match the ones this add-on saves
        /// in the DataSourceLoadInfo list (saved in a file in the project folder) and remove
        /// them from the project's data source list. The data sources that are removed are
        /// stored in a temporary list so that they can be re-added to the project's list
        /// after the data sources are read.
        /// </summary>
        /// <remarks>
        /// Concerning the reason for setting the last modification date on each skipped
        /// data source to tomorrow (i.e. DateTime.Now.AddDays(1)), is so that every time
        /// PA gains focus and it determines if any of the data sources have been updated
        /// since it lost focus, PA will determine that all skipped data sources have not
        /// been updated. Normally, the last modification date on a data source is set when
        /// the data source is read. But if the data source is skipped, then the last
        /// modification date will not get set properly and will cause PA to keep re-reading
        /// data sources each time the program becomes active. Hence setting the data to
        /// tomorrow.
        /// </remarks>
        /// ------------------------------------------------------------------------------------
        protected bool OnBeforeLoadingDataSources(object args)
        {
            PaProject project = args as PaProject;

            if (project == null)
            {
                return(false);
            }

            m_skippedDataSources = null;

            // Get the list of data sources that were marked for not loading.
            SkippedDataSourceList sdsl = SkippedDataSourceList.Load(project);

            if (sdsl == null || sdsl.Count == 0)
            {
                return(false);
            }

            // Create our list to temporarily store the skipped data sources. Make it
            // a sorted list so we can insert them back in the list in the same place
            // they were when we removed them. This is so they will appear in the
            // project settings dialog in the same order in which the user added them.
            m_skippedDataSources = new SortedDictionary <int, PaDataSource>();

            // Go through the project's data sources and remove any that are to be skipped.
            for (int i = project.DataSources.Count - 1; i >= 0; i--)
            {
                PaDataSource ds = project.DataSources[i];
                if (sdsl.SkipDataSource(ds.ToString(true)))
                {
                    // Set the skipped data sources date to tomorrow (see comment in
                    // header of this method), save it to our temp. list and remove
                    // it from the project's list of data sources.
                    ds.LastModification     = DateTime.Now.AddDays(1);
                    m_skippedDataSources[i] = ds;
                    project.DataSources.RemoveAt(i);
                }
            }

            if (m_skippedDataSources.Count == 0)
            {
                m_skippedDataSources = null;
            }

            return(false);
        }