Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        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"];
            EstAtten           = 78;
            updateGuiText();

            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;

            BatchSizeVolumeTextBox.Text         = Volumes.FinalBatchVolume.ToString();
            ExpectedOriginalGravityTextBox.Text = OriginalGravity.ToString();
            BoilTimeTextBox.Text             = BoilTime.ToString();
            TopUpMashWaterVolumeTextBox.Text = TopUpMashWater.ToString();
            PreBoilVolumeTextBox.Text        = Volumes.PreBoilTapOff.ToString();
        }