public ExampleViewModel(IModule module)
        {
            SelectedExample = module.CurrentExample;

            _exportExampleCommand = new ActionCommand(() =>
            {
                ExportExampleViewModel.IsExportVisible = true;
            });

            _sendSmileCommand = new ActionCommand(() =>
            {
                SmileFrownViewModel.SmileVisible = !SmileFrownViewModel.SmileVisible;
                SmileFrownViewModel.IsSmile      = SmileFrownViewModel.SmileVisible;
            });

            _sendFrownCommand = new ActionCommand(() =>
            {
                SmileFrownViewModel.FrownVisible = !SmileFrownViewModel.FrownVisible;
                SmileFrownViewModel.IsFrown      = SmileFrownViewModel.FrownVisible;
            });

            _closeHelpCommand = new ActionCommand(() =>
            {
                IsShowingHelp = false;
            });

            SmileFrownViewModel    = new SmileFrownViewModel(this);
            ExportExampleViewModel = new ExportExampleViewModel(module, this);
            BreadCrumbViewModel    = new BreadCrumbViewModel(module, this);
            this.ShowExample       = true;
            this.IsShowingHelp     = true;
            this.IsInfoVisible     = true;
        }
Пример #2
0
        public MainWindowViewModel(IModule module, IUsageCalculator usageCalculator)
        {
            SearchText              = "";
            SearchResults           = new ObservableCollection <ISelectable>();
            _autoCompleteDataSource = module.Examples.Select(ex => ex.Value.Title).ToList();

            WithTrait <AutoCompleteSearchBehaviour>();
            WithTrait <InitializationBehaviour>();

            _hideSearchCommand = new ActionCommand(() =>
            {
                SearchText = null;
            });

            _showSettingsCommand = new ActionCommand(() =>
            {
                IsSettingsShow     = true;
                BlurOnSearchParams = _blurredParams;
            });

            _hideSettingsCommand = new ActionCommand(() =>
            {
                IsSettingsShow     = false;
                BlurOnSearchParams = _defaultParams;
            });

            _exportCommand = new ActionCommand(() =>
            {
                _hideSettingsCommand.Execute(null);
                DeveloperModManager.Manage.IsDeveloperMode = false;
                TimedMethod.Invoke(() => HtmlExportHelper.ExportExampleToHtml(SelectedExample)).After(1000).Go();
            }, () => SelectedExample != null);

            _exportAllHtmlCommand = new ActionCommand(() =>
            {
                _hideSettingsCommand.Execute(null);
                DeveloperModManager.Manage.IsDeveloperMode = false;
                TimedMethod.Invoke(() => HtmlExportHelper.ExportExamplesToHtml(module)).After(1000).Go();
            }, () => SelectedExample != null);

            _exportAllSolutionsCommand = new ActionCommand(() =>
            {
                _hideSettingsCommand.Execute(null);
                ExportExampleHelper.ExportExamplesToSolutions(module);
            }, () => SelectedExample != null);

            _gcCollectCommand = new ActionCommand(() =>
            {
                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
                GC.WaitForFullGCApproach();
            });
        }
Пример #3
0
        private Navigator()
        {
            _usageCalculator = ServiceLocator.Container.Resolve <IUsageCalculator>();
            _history         = new NavigationHistory();

            _mainFrame             = new MainFrame();
            _examplesFrame         = new ExamplesFrame();
            _goBackCommand         = new ActionCommand(GoBack, () => CanGoBack);
            _goForwardCommand      = new ActionCommand(GoForward, () => CanGoForward);
            _navigateToHomeCommand = new ActionCommand(() => Instance.GoToHome(), () => Instance.CurrentPage == null || Instance.CurrentPage.PageId != AppPage.HomePageId);
        }