/// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void FillCVInSearchItem(IPACharacterType charType, string srchItem, int rowIndex)
        {
            m_chartHasBeenAutoFilled = true;

            // Save the original search item pattern.
            m_origSrchItems[rowIndex] = srchItem;

            int    startIndex = rowIndex;
            string fmt        = srchItem.Replace((charType == IPACharacterType.Consonant ?
                                                  kAutoFillConMarker : kAutoFillVowMarker), "{0}");

            // Get a phone list sorted by MOA
            List <string> phoneList = GetSortedPhones(charType == IPACharacterType.Consonant ?
                                                      IPACharacterType.Consonant : IPACharacterType.Vowel);

            foreach (string phone in phoneList)
            {
                if (rowIndex > startIndex)
                {
                    m_xyGrid.Rows.InsertCopy(rowIndex - 1, rowIndex);
                    m_xyGrid[0, rowIndex].Value = string.Format(fmt, phone);
                    m_addedRows.Add(m_xyGrid.Rows[rowIndex]);
                }

                m_xyGrid[0, rowIndex++].Value = string.Format(fmt, phone);
            }
        }
        ///// ------------------------------------------------------------------------------------
        ///// <summary>
        /////
        ///// </summary>
        ///// ------------------------------------------------------------------------------------
        //void m_xyGrid_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        //{
        //    try
        //    {
        //        if (m_chartHasBeenAutoFilled)
        //        {
        //            RestoreMarkersMessageDlg.Show(true);
        //            RemoveAutoFilledRowsAndColumns();
        //            e.Cancel = true;
        //        }
        //    }
        //    catch { }
        //}

        ///// ------------------------------------------------------------------------------------
        ///// <summary>
        /////
        ///// </summary>
        ///// ------------------------------------------------------------------------------------
        //void m_xyGrid_ColumnRemoved(object sender, DataGridViewColumnEventArgs e)
        //{
        //    if (m_chartHasBeenAutoFilled)
        //        PaApp.MsgMediator.PostMessage("AfterXYGridRowColumnRemoved_AddOn", null);
        //}

        ///// ------------------------------------------------------------------------------------
        ///// <summary>
        /////
        ///// </summary>
        ///// ------------------------------------------------------------------------------------
        //void m_xyGrid_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e)
        //{
        //    if (m_chartHasBeenAutoFilled)
        //        PaApp.MsgMediator.PostMessage("AfterXYGridRowColumnRemoved_AddOn", null);
        //}

        ///// ------------------------------------------------------------------------------------
        ///// <summary>
        /////
        ///// </summary>
        ///// ------------------------------------------------------------------------------------
        //protected bool OnAfterXYGridRowColumnRemoved_AddOn(object args)
        //{
        //    try
        //    {
        //        //RestoreMarkersMessageDlg.Show(true);
        //        OnResetAutoFilledChart(null);
        //    }
        //    catch { }

        //    return true;
        //}

        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private List <string> GetSortedPhones(IPACharacterType charType)
        {
            SortedDictionary <string, string> sortedPhonesDict = new SortedDictionary <string, string>();

            foreach (KeyValuePair <string, IPhoneInfo> kvp in PaApp.PhoneCache)
            {
                if (kvp.Value.CharType == charType)
                {
                    sortedPhonesDict[kvp.Value.MOAKey] = kvp.Key;
                }
            }

            return(new List <string>(sortedPhonesDict.Values));
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void FillCVInEnvironment(IPACharacterType charType, string environment, int colIndex)
        {
            m_chartHasBeenAutoFilled = true;

            // Save the original environment pattern.
            m_origEnvironments[colIndex] = environment;

            int    startIndex = colIndex;
            string fmt        = environment.Replace((charType == IPACharacterType.Consonant ?
                                                     kAutoFillConMarker : kAutoFillVowMarker), "{0}");

            // Get a phone list sorted by MOA
            List <string> phoneList = GetSortedPhones(charType == IPACharacterType.Consonant ?
                                                      IPACharacterType.Consonant : IPACharacterType.Vowel);

            SearchQuery query = m_xyGrid.Columns[colIndex].Tag as SearchQuery;

            foreach (string phone in phoneList)
            {
                if (colIndex == startIndex)
                {
                    query.Pattern = string.Format(fmt, phone);
                }
                else
                {
                    m_xyGrid.Columns.Insert(colIndex, SilGrid.CreateTextBoxColumn(string.Empty));
                    m_xyGrid[colIndex, 0].Value = string.Format(fmt, phone);
                    SearchQuery newQuery = query.Clone();
                    newQuery.Pattern = m_xyGrid[colIndex, 0].Value as string;
                    m_xyGrid.Columns[colIndex].Tag = newQuery;
                    m_addedColumns.Add(m_xyGrid.Columns[colIndex]);
                }

                m_xyGrid[colIndex++, 0].Value = string.Format(fmt, phone);
            }
        }