public PartialViewResult _AccountLanguages()
        {
            var model = new LanguageSelectionViewModel
            {
                CurrentLanguage = _languageManager.CurrentLanguage,
                Languages       = _languageManager.GetLanguages().Where(l => !l.IsDisabled).ToList()
                                  .Where(l => !l.IsDisabled)
                                  .ToList(),
                CurrentUrl = Request.Path
            };

            return(PartialView("_AccountLanguages", model));
        }
Exemplo n.º 2
0
        public PartialViewResult _AccountLanguages()
        {
            var model = new LanguageSelectionViewModel
            {
                CurrentLanguage = _languageManager.CurrentLanguage.AutoMapTo <Abp.Localization.LanguageInfo>(),
                Languages       = _languageManager.GetLanguages().Where(l => !l.IsDisabled)
                                  .AutoMapTo <List <Abp.Localization.LanguageInfo> >()
                ,
                CurrentUrl = Request.Path
            };

            return(PartialView("_AccountLanguages", model));
        }
Exemplo n.º 3
0
        public PartialViewResult _LeftSideColumnPartial()
        {
            LanguageSelectionViewModel model = new LanguageSelectionViewModel
            {
                CurrentLanguage = _languageManager.CurrentLanguage,
                Languages       = _languageManager.GetLanguages().Where(l => !l.IsDisabled).ToList()
                                  .Where(l => !l.IsDisabled)
                                  .ToList(),
                CurrentUrl = Request.Path
            };

            return(PartialView("_LanguagesPartial", model));
        }
Exemplo n.º 4
0
        //Edited just for the sample
        public PartialViewResult LanguageSelection(string partialView = "")
        {
            var model = new LanguageSelectionViewModel
            {
                CurrentLanguage = _languageManager.CurrentLanguage,
                Languages       = _languageManager.GetLanguages()
            };

            if (partialView.IsNullOrEmpty())
            {
                return(PartialView("_LanguageSelection", model));
            }

            return(PartialView(partialView, model));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Called from ViewModels, who should be completely-agnostic of View types.
        /// </summary>
        /// <returns>Null if cancelled, otherwise the selected culture</returns>
        public CultureInfo ShowLanguageSelectionDialog()
        {
            LanguageSelectionViewModel viewModel = new LanguageSelectionViewModel(_localizationService);
            //get our view from the factory method:
            IView view = _languageSelectionViewFactory();

            //can grab other windows from Application.Current.Windows collection if you have child of a child...
            //this is a UI dependency - should be factored out for testability like the Views were:
            Window parentWindow = Application.Current.MainWindow;
            string windowTitle  = _localizationService.GetLocalizedString("LanguageSelection");

            _dialogService.ShowDialog(view, viewModel, windowTitle, true, parentWindow);

            //could probably have a DialogViewModelBase, could also use eventaggregator/messenger/mediator to throw event from the child window
            if (viewModel.Result == Result.Ok)
            {
                return(viewModel.SelectedCulture);
            }

            return(null);
        }
Exemplo n.º 6
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var commandLineArguments = CommandLine.Parse(e.Args);

            IGameFactory gameFactory = new GameFactory();
            IGameService gameService = new GameService(gameFactory, commandLineArguments.DisableBotTimeout);
            IApplicationSettingsRepository applicationSettingsRepository = new ApplicationSettingsRepository();

            CultureManager.CurrentCulture  = new CultureInfo(applicationSettingsRepository.SelectedLanguageCode);
            CultureManager.CultureChanged += () =>
            {
                applicationSettingsRepository.SelectedLanguageCode = CultureManager.CurrentCulture.ToString();
            };

            var boardViewModel              = new BoardViewModel(gameService);
            var boardPlacementViewModel     = new BoardPlacementViewModel(gameService, gameFactory);
            var languageSelectionViewModel  = new LanguageSelectionViewModel();
            var progressFileVerifierFactory = new ProgressFileVerifierFactory();

            var mainWindowViewModel = new MainWindowViewModel(boardViewModel,
                                                              boardPlacementViewModel,
                                                              languageSelectionViewModel,
                                                              gameService,
                                                              applicationSettingsRepository,
                                                              progressFileVerifierFactory,
                                                              commandLineArguments.DisableClosingDialogs);

            if (!string.IsNullOrWhiteSpace(commandLineArguments.BotPath))
            {
                var dllPath = commandLineArguments.BotPath;
                mainWindowViewModel.DllPathInput = dllPath;

                if (string.IsNullOrWhiteSpace(commandLineArguments.ProgressFilePath))
                {
                    if (mainWindowViewModel.Start.CanExecute(null))
                    {
                        mainWindowViewModel.Start.Execute(null);
                    }
                    else
                    {
                        MessageBox.Show("startup-error");
                        return;
                    }
                }
                else
                {
                    if (mainWindowViewModel.StartWithProgress.CanExecute(commandLineArguments.ProgressFilePath))
                    {
                        mainWindowViewModel.StartWithProgress.Execute(commandLineArguments.ProgressFilePath);
                    }
                    else
                    {
                        MessageBox.Show("startup-error");
                        return;
                    }
                }
            }

            var mainWindow = new MainWindow
            {
                DataContext = mainWindowViewModel
            };

            mainWindow.ShowDialog();

            gameService.StopGame();
        }