Esempio n. 1
0
        /// <summary>
        /// Background task work method.
        /// Computes values and updates fields.
        /// </summary>
        private void DoComputeRadicalAvailability(object sender, DoWorkEventArgs e)
        {
            // Lock to allow only one of these operations at a time.
            lock (_updateLock)
            {
                // Apply filter and select the distinct radicals from the resulting kanji.
                RadicalEntity[] availableRadicals =
                    _radicalBusiness.GetAvailableRadicals(_filter)
                    .ToArray();

                foreach (FilteringRadical radical in _radicals)
                {
                    radical.IsRelevant = radical.Reference.DoesMatch(availableRadicals);
                }

                // Sort if wanted.
                if (_comparer.SortByRelevance)
                {
                    DispatcherHelper.Invoke(() =>
                    {
                        Radicals.Refresh();
                    });
                }
            }
        }
Esempio n. 2
0
 public override bool IsEmpty()
 {
     return(string.IsNullOrWhiteSpace(MainFilter) &&
            string.IsNullOrWhiteSpace(TextFilter) &&
            JlptLevel > Levels.MaxJlptLevel &&
            WkLevel < Levels.MinWkLevel &&
            !Radicals.Any());
 }
Esempio n. 3
0
        /// <summary>
        /// Called when the sort mode is changed.
        /// </summary>
        /// <param name="value">New sort mode value.</param>
        private void OnSetRadicalSortMode(RadicalSortModeEnum value)
        {
            if (RadicalSortMode != value)
            {
                RadicalSortMode    = value;
                _comparer.SortMode = value;
                Kanji.Interface.Properties.Settings.Default.RadicalSortMode = value;

                DispatcherHelper.InvokeAsync(() =>
                {
                    Radicals.Refresh();
                });
            }
        }