Example #1
0
        public void Execute()
        {
            InitializationStarted?.Invoke(this, null);
            var graph    = CreateClusteringGraph();
            var ilouvain = new ILouvain(graph, _clusteringAttributes);

            ilouvain.DataUpdateEvent += (s, e) => RunDataUpdate?.Invoke(this, e);
            InitializationFinished?.Invoke(this, null);

            ClusteringStarted?.Invoke(this, null);
            ilouvain.Execute();
            ClusteringFinished?.Invoke(this, null);

            DistributingStarted?.Invoke(this, null);
            List <UserSuspicion> userSuspicionLevel = CreateUserSuspicionLevels(ilouvain.ILouvainExecutionResult);

            DistributingFinished?.Invoke(this, null);

            LatestRunResults = new AlgorithmResultsEventArgs()
            {
                Partition                   = ilouvain.ILouvainExecutionResult,
                UsersSuspicionLevel         = userSuspicionLevel,
                AttributesRarityMeasurement = _attributesRarityMeasurement,
                ClusteringAttributes        = _clusteringAttributes,
                DistributionAttributes      = _distributionAttributes
            };
        }
Example #2
0
        private void Initialize()
        {
            if (_isInitialized)
            {
                return;
            }

            InitializationStarted?.Invoke(this, EventArgs.Empty);

            using (var com = new ComObjectManager())
            {
                var outlook           = com.Get(() => new OutlookApplication());
                var session           = com.Get(() => outlook.Session);
                var globalAddressList = com.Get(() => session.GetGlobalAddressList());
                var addressEntries    = com.Get(() => globalAddressList.AddressEntries);

                var people = new List <Person>(3000);
                people.AddRange(addressEntries
                                .Cast <AddressEntry>()
                                .Select(ae => com.Get(() => ae))
                                .Select(ae => GetPerson(com, ae))
                                .Where(p => p != null));

                foreach (var group in people.GroupBy(p => p.LastName))
                {
                    PeopleByLastName.Add(group.Key, group.ToList());
                }

                foreach (var group in people.GroupBy(p => p.EmailAddress))
                {
                    PeopleByEmailAddress.Add(group.Key, group.ToList());
                }
            }

            InitializationCompleted?.Invoke(this, EventArgs.Empty);

            _isInitialized = true;
        }