Ejemplo n.º 1
0
        private IUsage AskUserForCorrectUsage(string term, List <IUsage> usages)
        {
            IUsage usageFromHistory;

            if (_history.TryGetValue(term, out usageFromHistory))
            {
                return(usageFromHistory);
            }

            var usageSelectionDialog = new SelectUsageDialog(term, usages);
            var dialogResult         = usageSelectionDialog.ShowDialog(this);

            if (dialogResult == DialogResult.Cancel)
            {
                _history[term] = null;
                return(null);
            }
            _history[term] = usageSelectionDialog.SelectedUsage;

            return(usageSelectionDialog.SelectedUsage);
        }
Ejemplo n.º 2
0
        private IUsage AskUserForCorrectUsage(string term, List<IUsage> usages)
        {
            IUsage usageFromHistory;
            if ( _history.TryGetValue( term, out usageFromHistory ) )
            {
                return usageFromHistory;
            }

            var usageSelectionDialog = new SelectUsageDialog( term, usages );
            var dialogResult = usageSelectionDialog.ShowDialog( this );
            if ( dialogResult == DialogResult.Cancel )
            {
                _history[term] = null;
                return null;
            }
            _history[term] = usageSelectionDialog.SelectedUsage;

            return usageSelectionDialog.SelectedUsage;
        }