Esempio n. 1
0
        public List <Malt> Parse(string content)
        {
            List <Malt> results = new List <Malt>();

            string        maltEbcContent = content.Substring("malt_ebcs", ");");
            List <string> maltEbcValues  = maltEbcContent.Substrings("\"", "\"");

            List <string> maltSelectItems = content.Substring("do_drop('malt',0", "</select>").Substrings("<option ", "</option>");

            foreach (string maltItem in maltSelectItems)
            {
                string name  = maltItem.Substring(">");
                int    value = int.Parse(maltItem.Substring("value=\"", "\""));
                if (value > 0 && !string.IsNullOrEmpty(name))
                {
                    Malt malt = new Malt();
                    malt.MaltIndexValue = value;
                    malt.MaltName       = name;
                    string ebcValue = maltEbcValues[value];
                    if (!string.IsNullOrEmpty(ebcValue))
                    {
                        malt.EBC = int.Parse(ebcValue);
                    }

                    results.Add(malt);
                }
            }

            return(results);
        }
Esempio n. 2
0
        public List<Malt> Parse(string content)
        {
            List<Malt> results = new List<Malt>();

            string maltEbcContent = content.Substring("malt_ebcs", ");");
            List<string> maltEbcValues = maltEbcContent.Substrings("\"", "\"");

            List<string> maltSelectItems = content.Substring("do_drop('malt',0", "</select>").Substrings("<option ", "</option>");
            foreach (string maltItem in maltSelectItems)
            {
                string name = maltItem.Substring(">");
                int value = int.Parse(maltItem.Substring("value=\"", "\""));
                if (value > 0 && !string.IsNullOrEmpty(name))
                {
                    Malt malt = new Malt();
                    malt.MaltIndexValue = value;
                    malt.MaltName = name;
                    string ebcValue = maltEbcValues[value];
                    if (!string.IsNullOrEmpty(ebcValue))
                    {
                        malt.EBC = int.Parse(ebcValue);
                    }

                    results.Add(malt);
                }
            }

            return results;
        }
Esempio n. 3
0
 public Beer(List <Hops> hops, Malt malt, Barley barley, Water water, Yeast yeast, List <Extras> extras)
 {
     this.hops   = hops;
     this.malt   = malt;
     this.barley = barley;
     base.water  = water;
     this.yeast  = yeast;
     this.extras = extras;
 }
Esempio n. 4
0
 public Beer(List<Hops> hops, Malt malt, Barley barley, Water water, Yeast yeast, List<Extras> extras )
 {
     this.hops = hops;
     this.malt = malt;
     this.barley = barley;
     base.water = water;
     this.yeast = yeast;
     this.extras = extras;
 }
Esempio n. 5
0
        public EditMalt()
        {
            InitializeComponent();

            //load the hops varities for the dropdown and set them
            this._MaltVarities           = Malt.loadMaltVarities();
            this._SelectedItem           = this._MaltVarities.Keys.First();
            maltVarityPicker.ItemsSource = this._MaltVarities.Keys;

            this.DataContext = this;

            this._MaltItem = PhoneApplicationService.Current.State["EditItem"] as Malt;

            float PPG = this._MaltItem.PPG; //othwise will be overwritten by seting slectedItem

            this._SelectedItem = this._MaltItem.Name;
            NotifyPropertyChanged("SelectedItem");

            this._MaltItem.PPG = PPG;
            NotifyPropertyChanged("Amount");
            NotifyPropertyChanged("PPG");
        }