コード例 #1
0
ファイル: ListBuilder.cs プロジェクト: aata/szotar
        public void ScrollToResult(ListSearchResult result)
        {
            if (result.PositionHint.HasValue)
            {
                var hint = result.PositionHint.Value;
                if (hint >= 0 && hint < list.Count && list[hint].Phrase == result.Phrase && list[hint].Translation == result.Translation)
                {
                    ScrollToPosition(hint);
                    return;
                }
            }

            for (int i = 0; i < list.Count; i++)
            {
                var item = list[i];
                if (item.Phrase == result.Phrase && item.Translation == result.Translation)
                {
                    ScrollToPosition(i);
                    return;
                }
            }

            // Couldn't find the item... just scroll to where it was last
            if (result.PositionHint.HasValue)
            {
                ScrollToPosition(result.PositionHint.Value);
            }
        }
コード例 #2
0
ファイル: ListBuilder.cs プロジェクト: dbremner/szotar
		public void ScrollToResult(ListSearchResult result) {
			if (result.PositionHint.HasValue) {
				var hint = result.PositionHint.Value;
				if (hint >= 0 && hint < WordList.Count && WordList[hint].Phrase == result.Phrase && WordList[hint].Translation == result.Translation) {
					ScrollToPosition(hint);
					return;
				}
			}

			for (int i = 0; i < WordList.Count; i++) {
				var item = WordList[i];
				if (item.Phrase == result.Phrase && item.Translation == result.Translation) {
					ScrollToPosition(i);
					return;
				}
			}

			// Couldn't find the item... just scroll to where it was last
			if(result.PositionHint.HasValue)
				ScrollToPosition(result.PositionHint.Value);
		}