Exemple #1
0
        private static List <SizeViewModel> LoadXML(SizeKeyType feedObjectType)
        {
            SizeViewModel sizes = new SizeViewModel(feedObjectType == SizeKeyType.Dimension ? "Dimensions" : "Metrics");

            XDocument xDocument = Analytics.Data.Query.GetSizeCollectionAsXML(feedObjectType);

            foreach (XElement element in xDocument.Root.Elements("Category"))
            {
                SizeViewModel category = new SizeViewModel(element.Attribute("name").Value);

                foreach (XElement subElement in element.Elements(feedObjectType == SizeKeyType.Dimension ? "Dimension" : "Metric"))
                {
                    string        paramValue = subElement.Attribute("value").Value;
                    SizeViewModel size       = new SizeViewModel(subElement.Attribute("name").Value, paramValue);
                    category.Children.Add(size);
                }
                category.IsInitiallyExpanded = false;
                sizes.Children.Add(category);
            }
            sizes.IsInitiallyExpanded = true;
            sizes.Initialize();
            return(new List <SizeViewModel> {
                sizes
            });
        }
Exemple #2
0
        private void UncheckAll_Click(object sender, RoutedEventArgs e)
        {
            SizeViewModel root = this.tree.Items[0] as SizeViewModel;

            root.IsChecked = false;
        }
        private Dictionary<string, string> GetCheckedItems(SizeViewModel customTreeItems)
        {
            Dictionary<string, string> checkedSizes = new Dictionary<string, string>();
            foreach (SizeViewModel item in (customTreeItems).Children)
                foreach (SizeViewModel subItem in item.Children)
                {
                    if (subItem.IsChecked == true)
                    {
                        checkedSizes.Add(subItem.Name, subItem.Value);
                    }
                }

            return checkedSizes;
        }
 private void EnableAllMetrics(SizeViewModel metCategories)
 {
     foreach (SizeViewModel metrics in metCategories.Children)
     {
         foreach (SizeViewModel metric in metrics.Children)
         {
             metric.IsEnabled = true;
         }
     }
 }
 private void EnableAllDimenions(SizeViewModel dimCategories)
 {
     foreach (SizeViewModel dimensions in dimCategories.Children)
     {
         foreach (SizeViewModel dimension in dimensions.Children)
         {
             dimension.IsEnabled = true;
         }
     }
 }
 private void SetCheckedItems(Dictionary<string, string> sizeColl, SizeViewModel customTreeItems)
 {
     foreach (SizeViewModel category in customTreeItems.Children)
         foreach (SizeViewModel size in category.Children)
             if (sizeColl.Keys.Contains(size.Name))
                 size.IsChecked = true;
 }
        private static List<SizeViewModel> LoadXML(SizeKeyType feedObjectType)
        {
            SizeViewModel sizes = new SizeViewModel(feedObjectType == SizeKeyType.Dimension ? "Dimensions" : "Metrics");
            try
            {
                XDocument xDocument = Analytics.Data.Query.GetSizeCollectionAsXML(feedObjectType);
                foreach (XElement element in xDocument.Root.Elements("Category"))
                {
                    SizeViewModel category = new SizeViewModel(element.Attribute("name").Value);

                    foreach (XElement subElement in element.Elements(feedObjectType == SizeKeyType.Dimension ? "Dimension" : "Metric"))
                    {
                        string paramValue = subElement.Attribute("value").Value;
                        SizeViewModel size = new SizeViewModel(subElement.Attribute("name").Value, paramValue);
                        /*   if (size.Name.Contains("hour"))
                           {
                               size.IsChecked = true;
                           }*/
                        category.Children.Add(size);
                    }
                    category.IsInitiallyExpanded = false;

                    sizes.Children.Add(category);
                }
                sizes.IsInitiallyExpanded = true;
                sizes.Initialize();
            }
            catch { }
            return new List<SizeViewModel> { sizes };
        }