コード例 #1
0
ファイル: SelectHops.xaml.cs プロジェクト: rmcarlsson/wbc
        public SelectHops(HopsRepository aRepo, int aBoilTime)
        {
            InitializeComponent();

            var hopsRepo = aRepo;
            var hops     = hopsRepo.Get();

            HopsComboBox.ItemsSource    = hops;
            HopsComboBox.SelectedIndex  = 0;
            TimeDurationTextBox.Text    = aBoilTime.ToString();
            StageComboBox.ItemsSource   = Enum.GetValues(typeof(HopAdditionStage)).Cast <HopAdditionStage>();
            StageComboBox.SelectedIndex = 0;

            UnitCheckBox.IsChecked = false;
        }
コード例 #2
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();
        }
コード例 #3
0
        public AlterHopsWindow(HopsRepository aRepo)
        {
            InitializeComponent();

            Repo   = aRepo;
            Hopses = new ObservableCollection <Hops>();
            var fList = Repo.Get();

            foreach (Hops x in fList)
            {
                Hopses.Add(x);
            }

            listView.ItemsSource = Hopses;

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(listView.ItemsSource);

            view.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
        }
コード例 #4
0
ファイル: SelectHops.xaml.cs プロジェクト: rmcarlsson/wbc
        public SelectHops(HopsRepository aRepo, HopAddition aHopAddition)
        {
            InitializeComponent();

            var hopsRepo = aRepo;
            var hops     = hopsRepo.Get();

            HopsComboBox.ItemsSource = hops;

            HopsComboBox.SelectedValue = hops.FirstOrDefault(x => x.Name.Equals(aHopAddition.Hop.Name));

            TimeDurationTextBox.Text   = aHopAddition.Duration.ToString();
            StageComboBox.ItemsSource  = Enum.GetValues(typeof(HopAdditionStage)).Cast <HopAdditionStage>();
            StageComboBox.SelectedItem = (HopAdditionStage)aHopAddition.Stage;

            if (aHopAddition.AmountUnit == HopAmountUnitE.IBU)
            {
                UnitCheckBox.IsChecked = false;
                AmountLabel.Content    = "Bitterness [IBU] :";
                AmountTextBox.Text     = aHopAddition.Bitterness.ToString();
            }
            else
            {
                UnitCheckBox.IsChecked = true;
                AmountLabel.Content    = "Amount [g/L] :";
                AmountTextBox.Text     = aHopAddition.Amount.ToString();
            }
            if (aHopAddition.AlphaAcid != null)
            {
                AlphaAcidTextBox.Text = aHopAddition.AlphaAcid.GetAphaAcid().ToString();
            }
            else
            {
                AlphaAcidTextBox.Text = "-";
            }
        }
コード例 #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();
        }