public TaxTable()
 {
     Breaks.Add(150);
     Breaks.Add(350);
     Percents.Add(.1);
     Percents.Add(.2);
     Percents.Add(.3);
 }
        public MarcovitsConfig copy()
        {
            MarcovitsConfig copy = new MarcovitsConfig(pathOfDataBase, interval);

            copy.NotifyObservers           = NotifyObservers;
            copy.NumberOfPurcharedLicenses = (double[])NumberOfPurcharedLicenses.Clone();
            copy.Percents          = (double[])Percents.Clone();
            copy.UnicSoftwareNames = (string[])UnicSoftwareNames.Clone();
            return(copy);
        }
        public ModelingConfig copy()
        {
            ModelingConfig copy = new ModelingConfig(pathOfDataBase, interval);

            copy.setWithKovar(withKovar);
            copy.setNumberOfStartsModeling(numberOfStartsModeling);
            copy.setRollbackReport(rollbackReport);
            copy.NotifyObservers           = NotifyObservers;
            copy.NumberOfPurcharedLicenses = (double[])NumberOfPurcharedLicenses.Clone();
            copy.Percents          = (double[])Percents.Clone();
            copy.UnicSoftwareNames = (string[])UnicSoftwareNames.Clone();

            return(copy);
        }
Example #4
0
 /// <summary>
 /// Gets whether the Pass Count result object contains data.
 /// </summary>
 /// <remarks>
 /// It's not enough to check the coverage area, if the Percents array contains non zero data then that affects the result.
 /// </remarks>
 /// <returns></returns>
 public bool HasData() => Math.Abs(this.TotalCoverageArea) > 0.001 || (Percents?.Any(d => Math.Abs(d) > 0.001) ?? false);
Example #5
0
        private async Task run()
        {
            if (Clipboard.ContainsText())
            {
                string   clipboard = Clipboard.GetText();
                string[] lines     = clipboard.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
                prgrssbr.Maximum = lines.Length;

                for (int i = 0; i < lines.Length; i++)
                {
                    string line = lines[i].Trim();
                    prgrssbr.Value = i;
                    string ip = IPUtilities.ExtractFirstIpFromLine(line);
                    if (ip != null)
                    {
                        IPInfo info = await getinfo(ip);//long operation

                        VisualIPData vpdt = new VisualIPData(info.Data, lines[i]);
                        visualIPData_.Add(vpdt);
                    }
                }

                var query = visualIPData_.GroupBy(x => x.Organisation)
                            .Select(g => new { Value = g.Key, Count = g.Count() })
                            .OrderByDescending(x => x.Count);

                //generate percents and colors
                Random random = new Random();
                foreach (var field in query)
                {
                    Percents prcnts = new Percents();
                    prcnts.Field   = field.Value;
                    prcnts.Percent = (int)((double)field.Count / (double)visualIPData_.Count * 100);

                    int colorR = random.Next(130, 255);
                    int colorG = random.Next(130, 255);
                    int colorB = random.Next(130, 255);

                    prcnts.BackgroundColor = new SolidColorBrush(Color.FromRgb((byte)colorR, (byte)colorG, (byte)colorB));
                    percents_.Add(prcnts);
                }

                //assign colors based on field.Value
                foreach (VisualIPData data in visualIPData_)
                {
                    foreach (Percents percents in percents_)
                    {
                        if (data.Organisation == percents.Field)
                        {
                            data.BackgroundColor = percents.BackgroundColor;
                        }
                    }
                }

                lstw.ItemsSource         = visualIPData_;
                lstwPercents.ItemsSource = percents_;
                lstw.Visibility          = System.Windows.Visibility.Visible;
                lstwPercents.Visibility  = System.Windows.Visibility.Visible;

                prgrssbr.Visibility = System.Windows.Visibility.Collapsed;
            }
        }