Ejemplo n.º 1
0
        public void populateSearch(string result)
        {
            PurgeCells();
            Views = new List <ViewCell>();
            printHeader();
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            if (dictionary.Count > 0)
            {
                for (int i = 0; i < dictionary["IDKey"].Count; i++)
                {
                    string[] s     = new string[] { dictionary["Desc1"][i], dictionary["Desc2"][i], "$" + dictionary["Price"][i], "$" + dictionary["PriceSale"][i] };
                    int      count = 4;
                    if (BrandPicker.SelectedIndex == -1 || !BrandPicker.SelectedItem.Equals("Additives"))
                    {
                        count++;
                        s = new string[] { dictionary["Brand"][i], s[0], s[1], s[2], s[3] };
                    }
                    if (TypePicker.SelectedIndex == -1)
                    {
                        count++;
                        if (count == 6)
                        {
                            s = new string[] { dictionary["ItemType"][i], s[0], s[1], s[2], s[3], s[4] };
                        }
                        else
                        {
                            s = new string[] { dictionary["ItemType"][i], s[0], s[1], s[2], s[3] };
                        }
                    }
                    int[] Spacing = new int[] { 1, 1, 1, 1, 1, 1 };
                    if (s.Length == 5)
                    {
                        Spacing = new int[] { 1, 2, 1, 1, 1 };
                    }
                    else if (s.Length == 4)
                    {
                        Spacing = new int[] { 2, 2, 1, 1 };
                    }
                    GridFiller.rapidFillSpaced(s, TSection, Spacing);
                }
            }
        }
Ejemplo n.º 2
0
        public void populateSearch(string result)
        {
            PurgeCells();
            printHeader();
            TSection.Background = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            if (dictionary.Count > 0)
            {
                EditDict = new Dictionary <int, List <UIElement> >();
                for (int i = 0; i < dictionary["IDKey"].Count; i++)
                {
                    if (!(bool)EditMode.IsChecked)
                    {
                        string[] s     = new string[] { dictionary["Desc1"][i], dictionary["Desc2"][i], "$" + dictionary["Price"][i], "$" + dictionary["PriceSale"][i] };
                        int      count = 4;
                        if (BrandPicker.SelectedIndex == -1 || !BrandPicker.SelectedItem.Equals("Additives"))
                        {
                            count++;
                            s = new string[] { dictionary["Brand"][i], s[0], s[1], s[2], s[3] };
                        }
                        if (TypePicker.SelectedIndex == -1)
                        {
                            count++;
                            if (count == 6)
                            {
                                s = new string[] { dictionary["ItemType"][i], s[0], s[1], s[2], s[3], s[4] };
                            }
                            else
                            {
                                s = new string[] { dictionary["ItemType"][i], s[0], s[1], s[2], s[3] };
                            }
                        }
                        int[] Spacing = new int[] { 1, 1, 1, 1, 1, 1 };
                        if (s.Length == 5)
                        {
                            Spacing = new int[] { 1, 2, 1, 1, 1 };
                        }
                        else if (s.Length == 4)
                        {
                            Spacing = new int[] { 2, 2, 1, 1 };
                        }
                        GridFiller.rapidFillSpaced(s, TSection, Spacing);
                    }
                    else
                    {
                        int[]     Spacing = new int[] { 1, 1, 1, 1, 1, 1 };
                        DataEntry Desc1   = new DataEntry(int.Parse(dictionary["IDKey"][i]), dictionary["Desc1"][i])
                        {
                            Text = dictionary["Desc1"][i]
                        };
                        DataEntry Desc2 = new DataEntry(int.Parse(dictionary["IDKey"][i]), dictionary["Desc2"][i])
                        {
                            Text = dictionary["Desc2"][i]
                        };
                        DataEntry Price = new DataEntry(int.Parse(dictionary["IDKey"][i]), dictionary["Price"][i])
                        {
                            Text = dictionary["Price"][i]
                        };
                        DataEntry PriceSale = new DataEntry(int.Parse(dictionary["IDKey"][i]), dictionary["PriceSale"][i])
                        {
                            Text = dictionary["PriceSale"][i]
                        };
                        DataEntry Brand = new DataEntry(int.Parse(dictionary["IDKey"][i]), dictionary["Brand"][i])
                        {
                            Text = dictionary["Brand"][i]
                        };
                        DataEntry ItemType = new DataEntry(int.Parse(dictionary["IDKey"][i]), dictionary["ItemType"][i])
                        {
                            Text = dictionary["ItemType"][i]
                        };
                        List <UIElement> list = new List <UIElement>()
                        {
                            Desc1, Desc2, Price, PriceSale, Brand, ItemType
                        };
                        EditDict.Add(int.Parse(dictionary["IDKey"][i]), list);
                        GridFiller.rapidFillSpacedPremadeObjects(list, TSection, Spacing, new bool[] { false, false, false, false, false, false });
                    }
                }
            }
        }