Exemple #1
0
 private void AddItem2cmp()
 {
     foreach (var x in FooList.SelectedItems)
     {
         FOOD_DES fr = (FOOD_DES)x;
         if (fr == null)
         {
             return;
         }
         Add2cmpList(fr);
     }
 }
Exemple #2
0
        private void RemoveSelectedItem()
        {
            if (cmp.SelectedItem == null)
            {
                return;
            }

            ListBoxItem lbi = cmp.SelectedItem as ListBoxItem;
            FOOD_DES    sr  = (FOOD_DES)lbi.Tag;

            cmp.Items.Remove(lbi);

            UpdateCount();
        }
Exemple #3
0
        private async void z_show_click(object sender, RoutedEventArgs e)
        {
            ListBoxItem lbi = cmp.SelectedItem as ListBoxItem;

            if (cmp == null)
            {
                return;
            }

            FOOD_DES si = (FOOD_DES)lbi.Tag;

            if (si != null)
            {
                await RenderNuts4(si.NDB_No);
            }
        }
Exemple #4
0
        private void Add2cmpList(FOOD_DES fr)
        {
            foreach (ListBoxItem li in cmp.Items)
            {
                if (li.Tag.Equals(fr) == true)
                {
                    MessageBox.Show("Items already in comparison table");
                    return;
                }
            }
            ListBoxItem lbi = new ListBoxItem();

            lbi.Tag     = fr;
            lbi.Content = fr.Long_Desc;
            cmp.Items.Add(lbi);
            //z_cmp_count.Content = string.Format("{0} Items To Compare.", cmp.Items.Count);
            UpdateCount();
        }
Exemple #5
0
        private async Task Compare()
        {
            if (_selected.Count <= 0)
            {
                return;
            }

            // the progress steps from the iterations number.
            double pv = (double)((double)200.0 / (double)_selected.Count);


            for (int i = 0; i < _selected.Count; i++)
            {
                FOOD_DES lbi = _selected[i];
                AddFoodRow(lbi);
                //bgw.ReportProgress((int)pv);
            }
            await Task.Delay(100);
        }
Exemple #6
0
        private void AddFoodRow(FOOD_DES fr)
        {
            //if (foo.ndata.Rows.Count == 0)
            //{
            //    //Title = string.Format("lazy loader busy .. Loading data before  .. {0}", fr.NDB_No);
            //    Sr25DataSetTableAdapters.ndataTableAdapter ddda = new Sr25DataSetTableAdapters.ndataTableAdapter();
            //    ddda.Fill(foo.ndata);
            //    ddda.Dispose();
            //}

            var nuts4foo = App.db.NUT_DATA.Where(f => f.NDB_No == fr.NDB_No).ToDictionary(nno => nno.Nutr_No);


            DataRow dr = TheResTab.NewRow();

            float v = 0F;

            dr[0] = fr.Long_Desc;


            for (int i = 1; i < TheResTab.Columns.Count; i++)
            {
                short _nut_no = short.Parse(TheResTab.Columns[i].Caption);

                Title = DateTime.Now.ToLongTimeString();

                try
                {
                    var _nut_val = nuts4foo[_nut_no];
                    dr[i] = _nut_val.Nutr_Val;
                }
                catch
                {
                    dr[i] = v;
                }
            }

            TheResTab.Rows.Add(dr);
        }