Пример #1
0
        private void initializeType()
        {
            int chickenCount = context.orders.Where(e => e.type.Equals("Chicken")).Count();
            int porkCount    = context.orders.Where(e => e.type.Equals("Pork")).Count();
            int mixedCount   = context.orders.Where(e => e.type.Equals("Mixed")).Count();

            TypeCollection.Clear();
            TypeCollection.Add(new PieSeries
            {
                Title  = Application.Current.FindResource("Pork") as string,
                Values = new ChartValues <ObservableValue> {
                    new ObservableValue(porkCount)
                },
                DataLabels = true
            });
            TypeCollection.Add(new PieSeries
            {
                Title  = Application.Current.FindResource("Chicken") as string,
                Values = new ChartValues <ObservableValue> {
                    new ObservableValue(chickenCount)
                },
                DataLabels = true
            });

            TypeCollection.Add(
                new PieSeries
            {
                Title  = Application.Current.FindResource("Mixed") as string,
                Values = new ChartValues <ObservableValue> {
                    new ObservableValue(mixedCount)
                },
                DataLabels = true
            });
        }
Пример #2
0
        /// <summary>
        /// This method is binded to the Unchecked event of the CheckBox control.
        /// This method removes unchecked types of the sculpture from the collection of types related to that Sculpture.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void TypeCheckBox_OnUnchecked(object sender, RoutedEventArgs e)
        {
            var checkBox = (CheckBox)sender;
            var type     = checkBox.Tag.ToString();

            var collection =
                PassedSculpture.SculptureTypes.Where(type1 => type1 != type).ToList();

            PassedSculpture.SculptureTypes.Clear();
            TypeCollection.Clear();
            collection.ForEach(type1 => PassedSculpture.SculptureTypes.Add(type1));
            collection.ForEach(type1 => TypeCollection.Add(type1));
        }