public MainWindow() { InitializeComponent(); var assembly = Assembly.GetExecutingAssembly(); var path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var fullpath = String.Format("{0}\\{1}", path, assembly.GetName().Name); try { if (!Directory.Exists(fullpath)) Directory.CreateDirectory(fullpath); } catch (Exception e) { MessageBox.Show(String.Format("Unable to create {0}. Exception {1}", fullpath, e)); } HopsRepo = new HopsRepository(); MaltRepo = new FermentableRepository(); Grist = new ObservableCollection<GristPart>(); MaltsListView.ItemsSource = Grist; BoilHops = new ObservableCollection<HopAddition>(); HopsListView.ItemsSource = BoilHops; MashProfileList = new ObservableCollection<Domain.MashProfileStep>(); MashStepListView.ItemsSource = MashProfileList; OtherIngredientsList = new ObservableCollection<OtherIngredient>(); OtherIngredientsListView.ItemsSource = OtherIngredientsList; OriginalGravity = 1.05; BoilTime = 60; Volumes = new BrewVolumes(); Volumes.BoilOffLoss = GrainfatherCalculator.CalcBoilOffVolume(BoilTime); Volumes.FinalBatchVolume = 25; Volumes.BoilerToFermentorLoss = GrainfatherCalculator.GRAINFATHER_BOILER_TO_FERMENTOR_LOSS; Volumes.PreBoilTapOff = 0; TopUpMashWater = 0; gfc = new GrainfatherCalculator(); gfc.MashEfficiency = (double)WpfApplication1.Properties.Settings.Default["MashEfficiency"]; updateGuiTextboxes(); GrainBrainMenuItem.IsEnabled = false; dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); dispatcherTimer.Interval = new TimeSpan(0, 0, 5); dispatcherTimer.Start(); MashProfileList.CollectionChanged += this.OnCollectionChanged; }
public SelectGrain(FermentableRepository aRepo, double aCurrentPercentage) { InitializeComponent(); CurrentPercentage = aCurrentPercentage; var grainsRepo = aRepo; var grains = grainsRepo.Get(); comboBox.ItemsSource = grains; StageComboBox.ItemsSource = Enum.GetValues(typeof(FermentableStage)).Cast<FermentableStage>(); StageComboBox.SelectedIndex = 1; }
public SelectGrain(FermentableRepository aRepo, double aCurrentPercentage, GristPart aInitalGristPart) { InitializeComponent(); CurrentPercentage = aCurrentPercentage; var grainsRepo = aRepo; var grains = grainsRepo.Get(); comboBox.ItemsSource = grains; comboBox.SelectedValue = grains.FirstOrDefault(x => x.Name.Equals(aInitalGristPart.FermentableAdjunct.Name)); textBox.Text = aInitalGristPart.Amount.ToString(); StageComboBox.ItemsSource = Enum.GetValues(typeof(FermentableStage)).Cast<FermentableStage>(); StageComboBox.SelectedItem = aInitalGristPart.Stage; }
public AlterMaltsWindow(FermentableRepository aRepo) { InitializeComponent(); Repo = aRepo; Fermentables = new ObservableCollection<FermentableAdjunct>(); var fList = Repo.Get(); foreach (FermentableAdjunct x in fList) Fermentables.Add(x); listView.ItemsSource = Fermentables; CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(listView.ItemsSource); view.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending)); }
public TCW(string aBSExportFilename, FermentableRepository aMaltRepo, HopsRepository aHopsRepo) { InitializeComponent(); this.MaltsRepo = aMaltRepo; this.HopsRepo = aHopsRepo; FermentablesObservableList = new ObservableCollection<FermentableAdjunct>(aMaltRepo.Get()); HopsObservableList = new ObservableCollection<Hops>(aHopsRepo.Get()); BeersmithImporter = new BSImporter(aBSExportFilename); RecipeNameCombobox.ItemsSource = BeersmithImporter.GetAllRecipes(); RecipeNameCombobox.SelectedIndex = 0; HopsListView.ItemsSource = HopsObservableList; MaltsListView.ItemsSource = FermentablesObservableList; WorkRecepie = new Recepie(); }