Example #1
0
        private async Task OpenDictionary(string path)
        {
            try
            {
                SetIsBusy(true);
                var spellChecker = await SpellChecker.FromFileAsync(path);

                mainContent.Content = new Views.DictionaryEditor(spellChecker);
                _canSave            = true;
                _filePath           = path;
                _title = $"Dictionary Editor - '{LimitString(_filePath, 30)}'";
                Title  = _title;
                _preferences.AddPathToRecentFiles(path);
                ReloadRecentFileMenuItems();

                var viewModel = (mainContent.Content as FrameworkElement).DataContext as DictionaryEditorViewModel;
                viewModel.PropertyChanged += ViewModel_PropertyChanged;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                MessageBox.Show(ex.Message);
            }
            finally
            {
                SetIsBusy(false);
            }
        }