Пример #1
0
        public HomeScreen()
        {
            InitializeComponent();
            Era1Button.Enabled         = false;
            Era2Button.Enabled         = false;
            Era3Button.Enabled         = false;
            Era4Button.Enabled         = false;
            Era5Button.Enabled         = false;
            BeerNameBox.Enabled        = false;
            BeerStyleBox.Enabled       = false;
            BeerDescriptionBox.Enabled = false;

            //Set the statistical information
            //  currentRecipe.beerStatistics.PPGPoints = 0;
            //  currentRecipe.beerStatistics.SRM = 0;
            //  currentRecipe.beerStatistics.CurrentOG = 0;
            //  currentRecipe.beerStatistics.CurrentFG = 0;
            //  currentRecipe.beerStatistics.CurrentABV = 0;
            //  currentRecipe.beerStatistics.KitEfficiency = 0.70;//for now....
            //  currentRecipe.beerStatistics.IntoFermenterVolume = 5;//for now...


            RegistryKey adsfa = Registry.CurrentUser.OpenSubKey("SOFTWARE/Brewmeister");

            if (adsfa != null)
            {
                dataurl          = "" + adsfa.GetValue("dataurl");
                currentRecipeKey = "" + adsfa.GetValue("LastOpenedRecipe");
                try
                {
                    LastOpenedFileLocation = "" + adsfa.GetValue("LastOpenedFileLocation");
                    //openFile(LastOpenedFileLocation);
                    adsfa.Close();
                    loadRecipe();
                    populateMainScreen();
                }
                catch (Exception esdjjs)
                {
                }
            }
            else
            {
                API_URL_Settings settings = new API_URL_Settings();
                settings.ShowDialog();
                dataurl = settings.restAPIURL;
                adsfa   = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("SOFTWARE/Brewmeister");
                adsfa.SetValue("dataurl", dataurl);
                adsfa.SetValue("LastOpenedRecipe", "");
                adsfa.Close();
            }
            if (currentRecipeKey != null && currentRecipeKey != "")
            {
                Era1Button.Enabled = true;
            }
        }
Пример #2
0
        /*
         * Sets all the f*****g shit for the grids and shit.
         * */
        public Recipe_Creator()
        {
            APIHandler handler = new APIHandler();

            //List<fermentable2> fermentableList = handler.getFermentables();
            //DataGridViewComboBoxColumn maltColumn = new DataGridViewComboBoxColumn();
            //maltColumn.DataSource = fermentableList;
            //maltColumn.DisplayMember = "name";
            // maltColumn.ValueMember = "id";
            //currentRecipe = currentRecipeFromMainScreen;
            //Malt Grid Stuff
            InitializeComponent();
            //MaltGrid.Columns.Add(maltColumn);
            MaltGrid.Columns.Add("Name", "Name");
            MaltGrid.Columns[0].ReadOnly = true;
            MaltGrid.Columns.Add("Weight", "Weight");
            MaltGrid.Columns.Add("PPG", "PPG");
            MaltGrid.Columns[2].ReadOnly = true;
            MaltGrid.Columns.Add("Color", "Color");
            MaltGrid.Columns[3].ReadOnly = true;
            DataGridViewCheckBoxColumn ExtractColumn = new DataGridViewCheckBoxColumn();

            ExtractColumn.ReadOnly   = true;
            ExtractColumn.Name       = "Extract";
            ExtractColumn.HeaderText = "Extract";
            MaltGrid.Columns.Add(ExtractColumn);
            MaltGrid.Columns[0].Width   = 150;
            MaltGrid.Columns[1].Width   = 50;
            MaltGrid.Columns[2].Width   = 50;
            MaltGrid.Columns[3].Width   = 50;
            MaltGrid.Columns[4].Width   = 50;
            KitEfficiencyBox.Text       = "" + KitEfficiency;
            IntoFermenterVolumeBox.Text = "" + IntoFermenterVolume;

            //Hop Grid Stuff
            HopGrid.Columns.Add("Name", "Name");
            HopGrid.Columns[0].ReadOnly = true;
            DataGridViewComboBoxColumn typeColumn = new DataGridViewComboBoxColumn();

            typeColumn.Name = "Type";
            typeColumn.Items.Add("Boil");
            typeColumn.Items.Add("Dry Hop");
            typeColumn.Items.Add("Whirlpool");
            typeColumn.DisplayStyle = DataGridViewComboBoxDisplayStyle.ComboBox;
            HopGrid.Columns.Add(typeColumn);
            //HopGrid.Columns.Add("Type", "Type");
            HopGrid.Columns.Add("Amount", "Amount");
            HopGrid.Columns.Add("AAU", "AAU");
            HopGrid.Columns[3].ReadOnly = true;
            HopGrid.Columns.Add("Time", "Time");
            HopGrid.Columns[0].Width = 150;
            HopGrid.Columns[1].Width = 100;
            HopGrid.Columns[2].Width = 50;
            HopGrid.Columns[3].Width = 50;
            HopGrid.Columns[4].Width = 50;

            //Yeast Grid Stuff
            YeastGrid.Columns.Add("Lab", "Lab");
            YeastGrid.Columns[0].ReadOnly = true;
            YeastGrid.Columns.Add("Product", "Product");
            YeastGrid.Columns[1].ReadOnly = true;
            YeastGrid.Columns.Add("Attenuation", "Attenuation");
            YeastGrid.Columns[2].ReadOnly = true;
            YeastGrid.Columns[0].Width    = 100;
            YeastGrid.Columns[1].Width    = 100;
            YeastGrid.Columns[2].Width    = 100;
            RefreshStatistics();

            //Other Ingredients Grid Stuff
            OtherIngredientsGrid.Columns.Add("Name", "Name");
            OtherIngredientsGrid.Columns.Add("Amount", "Amount");
            OtherIngredientsGrid.Columns.Add("Unit", "Unit");
            OtherIngredientsGrid.Columns.Add("Time", "Time");
            OtherIngredientsGrid.Columns.Add("TimeUnit", "TimeUnit");
            OtherIngredientsGrid.Columns.Add("Type", "Type");


            RegistryKey adsfa = Registry.CurrentUser.OpenSubKey("SOFTWARE/Brewmeister");

            if (adsfa != null)
            {
                if (adsfa.GetValue("DataProvider").ToString() == "True")
                {
                    dataurl = "" + adsfa.GetValue("BeerNetAddress");
                }
                else
                {
                    dataurl = "" + adsfa.GetValue("DeploydAddress");
                }
                string currentRecipeKey = "" + adsfa.GetValue("LastOpenedRecipe");
                try
                {
                    //LastOpenedFileLocation = "" + adsfa.GetValue("LastOpenedFileLocation");
                    //openFile(LastOpenedFileLocation);
                    adsfa.Close();
                    currentRecipe = handler.loadRecipe(currentRecipeKey);
                    populateGrids();
                    RefreshStatistics();
                }
                catch (Exception esdjjs)
                {
                }
            }
            else
            {
                API_URL_Settings settings = new API_URL_Settings();
                settings.ShowDialog();
                dataurl = settings.restAPIURL;
                adsfa   = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("SOFTWARE/Brewmeister");
                adsfa.SetValue("dataurl", dataurl);
                adsfa.SetValue("LastOpenedRecipe", "");
                adsfa.Close();
            }

            //  populateGrids();
            //  RefreshStatistics();
            //  updateStyleSliders();
        }