void OnShowMasterActionList() { if (_actionWindow == null) { var finder = new ItemFinderViewModel(); _actionWindow = new AllItemsWindow(); _actionWindow.DataContext = finder; _actionWindow.Closing += (s, e) => { e.Cancel = true; _actionWindow.Hide(); ActionListIsActive = false; }; } if (ActionListIsActive) { _actionWindow.Hide(); } else { _actionWindow.Show(); } ActionListIsActive = !ActionListIsActive; }
void OnShowProcessingList() { var analyzer = new ProfitabilityAnalyzer(); var recipes = DomainObjectRepositories.RecipeRepository.Get().Where(p => p.Type == RecipeType.Processing); var results = analyzer.AnalyzeProcessing(recipes); var finder = new ItemFinderViewModel(new Item[] {}); finder.OrderByName = false; foreach (var i in results.Entries.Select(p => p.Item)) { finder.Collection.Add(new ItemViewModel(i)); } var win = new AllItemsWindow(); win.DataContext = finder; win.Show(); }
void OnShowTopTwenty() { var allItems = CollectionHelper.AllItems; var analyzer = new ProfitabilityAnalyzer(); var results = analyzer.Analyze(allItems); var items = results.Entries.Take(20).Select(p => p.Item); var finder = new ItemFinderViewModel(new Item[] {}); finder.OrderByName = false; foreach (var i in items) { finder.Collection.Add(new ItemViewModel(i)); } var win = new AllItemsWindow(); win.DataContext = finder; win.Show(); }