/// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="TranslatablePhrase"/> class.
 /// </summary>
 /// <param name="questionInfo">Information about the original question</param>
 /// <param name="category">The category (e.g. Overview vs. Detail question).</param>
 /// <param name="seqNumber">The sequence number (used to sort and/or uniquely identify
 /// a phrase within a particular category and reference).</param>
 /// ------------------------------------------------------------------------------------
 public TranslatablePhrase(QuestionKey questionInfo, int category, float seqNumber)
     : this(questionInfo.Text)
 {
     m_questionInfo = questionInfo;
     m_category     = category;
     m_seqNumber    = seqNumber;
 }
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Gets the index of the (first) phrase in the (filtered) collection that matches the
 /// given key.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public int FindPhrase(QuestionKey phraseKey)
 {
     for (int i = 0; i < FilteredSortedPhrases.Count; i++)
     {
         TranslatablePhrase phrase = FilteredSortedPhrases[i];
         if (phrase.PhraseKey.Matches(phraseKey))
         {
             return(i);
         }
     }
     return(-1);
 }
Пример #3
0
 public bool Matches(QuestionKey other)
 {
     return(StartRef == other.StartRef && EndRef == other.EndRef && Text == other.Text);
 }
Пример #4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Gets the index of the (first) phrase in the (filtered) collection that matches the
		/// given key.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public int FindPhrase(QuestionKey phraseKey)
		{
			for (int i = 0; i < FilteredSortedPhrases.Count; i++)
			{
				TranslatablePhrase phrase = FilteredSortedPhrases[i];
				if (phrase.PhraseKey.Matches(phraseKey))
					return i;
			}
			return -1;
		}
Пример #5
0
		public bool Matches(QuestionKey other)
		{
			return StartRef == other.StartRef && EndRef == other.EndRef && Text == other.Text;
		}
Пример #6
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Reloads the specified f force save.
		/// </summary>
		/// <param name="fForceSave">if set to <c>true</c> [f force save].</param>
		/// <param name="key">The key of the question to try to select after reloading.</param>
		/// <param name="fallBackRow">the index of the row to select if a question witht the
		/// given key cannot be found.</param>
		/// ------------------------------------------------------------------------------------
		private void Reload(bool fForceSave, QuestionKey key, int fallBackRow)
		{
			using (new WaitCursor(this))
			{
				int iCol = dataGridUns.CurrentCell.ColumnIndex;
				Save(fForceSave);

				int iSortedCol = -1;
				bool sortAscending = true;
				for (int i = 0; i < dataGridUns.Columns.Count; i++)
				{
					switch (dataGridUns.Columns[i].HeaderCell.SortGlyphDirection)
					{
						case SortOrder.Ascending: iSortedCol = i; break;
						case SortOrder.Descending: iSortedCol = i; sortAscending = false; break;
						default:
							continue;
					}
					break;
				}

				m_helper.TranslationsChanged -= m_helper_TranslationsChanged;
				dataGridUns.RowCount = 0;
				LoadTranslations(null);
				ApplyFilter();
				if (iSortedCol >= 0)
					SortByColumn(iSortedCol, sortAscending);
				if (key != null)
				{
					int iRow = m_helper.FindPhrase(key);
					if (iRow < 0)
						iRow = fallBackRow;
					if (iRow < dataGridUns.Rows.Count)
						dataGridUns.CurrentCell = dataGridUns.Rows[iRow].Cells[iCol];
				}
			}
		}