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(); }); }
public DiscoverCoreAssembliesBehavior(ExportExampleViewModel target, ISchedulerContext schedulerContext) : base(target) { Target.LibrariesPath = ExportExampleHelper.TryAutomaticallyFindAssemblies(); Target.WhenPropertyChanged(x => x.LibrariesPath) .Where(x => !string.IsNullOrEmpty(x)) .Select(ExportExampleHelper.SearchForCoreAssemblies) .ObserveOn(schedulerContext.Dispatcher) .Subscribe(b => Target.IsAssemblyOk = b) .DisposeWith(this); }