Exemplo n.º 1
0
        private async void InitMainWindowData()
        {
            Translation = new MainWindowTranslation();

            SetUiElements();

            IsTxtSearchEnabled = false;
            LoadIconVisibility = Visibility.Visible;

            var isItemListLoaded = await ItemController.GetItemListFromJsonAsync().ConfigureAwait(true);

            if (!isItemListLoaded)
            {
                MessageBox.Show(LanguageController.Translation("ITEM_LIST_CAN_NOT_BE_LOADED"), LanguageController.Translation("ERROR"));
            }

            if (isItemListLoaded)
            {
                await ItemController.GetItemInformationListFromLocalAsync();

                IsFullItemInformationCompleteCheck();
                LoadIconVisibility = Visibility.Hidden;
                IsTxtSearchEnabled = true;

                _mainWindow.Dispatcher?.Invoke(() =>
                {
                    _mainWindow.TxtSearch.Focus();
                });
            }

            ShowInfoWindow();
            TextBoxGoldModeNumberOfValues = "10";
        }
Exemplo n.º 2
0
        public MainWindowViewModel(ISettingsManager settingsManager, IInteractionInvoker interactionInvoker, IUserGuideHelper userGuideHelper,
                                   IVersionHelper versionHelper, DragAndDropEventHandler dragAndDrop, WelcomeCommand welcomeCommand, ApplicationNameProvider applicationNameProvider, MainWindowTranslation mainWindowTranslation, ITranslationFactory translationFactory)
        {
            _settingsManager         = settingsManager;
            _interactionInvoker      = interactionInvoker;
            _userGuideHelper         = userGuideHelper;
            _versionHelper           = versionHelper;
            _applicationNameProvider = applicationNameProvider;
            _translationFactory      = translationFactory;

            ApplicationSettingsCommand = new DelegateCommand(ExecuteApplicationSettingsCommand);
            ProfileSettingsCommand     = new DelegateCommand(ExecuteProfileSettings);
            WelcomeCommand             = welcomeCommand;
            Translation        = mainWindowTranslation;
            AboutWindowCommand = new DelegateCommand(ExecuteAboutWindow);
            HelpCommand        = new DelegateCommand <KeyEventArgs>(ExecuteHelpCommand);

            DragEnterCommand = new DelegateCommand <DragEventArgs>(dragAndDrop.HandleDragEnter);
            DragDropCommand  = new DelegateCommand <DragEventArgs>(dragAndDrop.HandleDropEvent);

            _settingsProvider          = _settingsManager.GetSettingsProvider();
            ApplicationSettingsEnabled = _settingsProvider.GpoSettings?.DisableApplicationSettings == false;
        }