Exemple #1
0
        public ChunkBuilder Build()
        {
            var timer = new Stopwatch();

            timer.Start();

            if (providerKeys.Count > 0)
            {
                var providerIds = VocabularyManager.GetProviderIds(providerKeys.Keys.ToArray());
                foreach (var keyValuePair in providerIds)
                {
                    if (keyValuePair.Value != -1)
                    {
                        providerKeys[keyValuePair.Key] = keyValuePair.Value;
                    }
                    else
                    {
                        Logger.Write(chunk.Id, LogMessageTypes.Warning,
                                     string.Format("ProviderIds does not contains key = '{0}'", keyValuePair.Key));
                    }
                }
            }

            var opt = new ParallelOptions {
                MaxDegreeOfParallelism = 1
            };

            Parallel.ForEach(personBuilders, opt, cd => cd.Value.Build());

            timer.Stop();
            Logger.Write(chunk.Id, LogMessageTypes.Info, string.Format("Built - {0} ms", timer.ElapsedMilliseconds));
            Logger.Write(chunk.Id, LogMessageTypes.Info, string.Format("Built - {0} Mb", (GC.GetTotalMemory(false) / 1024f) / 1024f));

            return(this);
        }
Exemple #2
0
 public DictionaryController(
     IDataRepository <Topic> _TopicManager,
     IDataRepository <Vocabulary> _VocabularyManager,
     IDataRepository <TestCategory> _TestCategoryManager)
 {
     this._TopicManager        = _TopicManager as TopicManager;
     this._VocabularyManager   = _VocabularyManager as VocabularyManager;
     this._TestCategoryManager = _TestCategoryManager as TestCategoryManager;
 }
Exemple #3
0
        private void FlushProvidersToCommonVocab()
        {
            if (providerConcepts.Lookup.Count > 1)
            {
                var providers = new List <KeyValuePair <string, long> >(providerConcepts.Lookup.Count);
                providers.AddRange(
                    providerConcepts.Lookup.Select(value => new KeyValuePair <string, long>(value.Key, value.Value.Id)));

                VocabularyManager.AddProviders(providers.ToArray());
                providers.Clear();
                providerConcepts.Lookup.Clear();
            }
        }
Exemple #4
0
        /// <summary>
        /// Will fill the combobox that shows available picklist for selected theme
        /// </summary>
        private void FillPicklistCombobox()
        {
            //Get the current project type
            string fieldworkType = string.Empty;

            if (localSettings.GetSettingValue(Dictionaries.DatabaseLiterals.FieldUserInfoFWorkType) != null)
            {
                fieldworkType = localSettings.GetSettingValue(Dictionaries.DatabaseLiterals.FieldUserInfoFWorkType).ToString();
            }

            //Retrieve list of picklist from user selected theme
            VocabularyManager vocManager      = new VocabularyManager();
            List <object>     vocabManagerRaw = accessData.ReadTable(vocManager.GetType(), null);
            IEnumerable <VocabularyManager> vocManagerTable = vocabManagerRaw.Cast <VocabularyManager>(); //Cast to proper list type
            IEnumerable <VocabularyManager> vocThemeID      = from vm in vocManagerTable where vm.ThemeTable.ToLower().Contains(picklistTheme) && vm.ThemeEditable == Dictionaries.DatabaseLiterals.boolYes && (vm.ThemeProjectType == fieldworkType || vm.ThemeProjectType == "") select vm;

            //Special case for mineral table
            if (picklistTheme == Dictionaries.DatabaseLiterals.KeywordMineral)
            {
                vocThemeID = from vm in vocManagerTable where vm.ThemeTable.ToLower().Contains(picklistTheme) && !vm.ThemeTable.ToLower().Contains(Dictionaries.DatabaseLiterals.KeywordMA) && vm.ThemeEditable == Dictionaries.DatabaseLiterals.boolYes && (vm.ThemeProjectType == fieldworkType || vm.ThemeProjectType == "") select vm;
            }

            //Add theme list to dialog or a default NA value if nothing is available yet
            if (vocThemeID.Count() > 0)
            {
                foreach (VocabularyManager themeID in vocThemeID)
                {
                    Themes.ComboBoxItem picklistTheme = new Themes.ComboBoxItem();
                    picklistTheme.itemName  = themeID.ThemeNameDesc;
                    picklistTheme.itemValue = themeID.ThemeName;
                    _picklists.Add(picklistTheme);
                }
            }
            else
            {
                ResourceLoader appResources = ResourceLoader.GetForCurrentView();
                string         emptyTheme   = appResources.GetString("PicklistDialogEmptyList/Text");

                Themes.ComboBoxItem emptyPicklist = new Themes.ComboBoxItem();
                emptyPicklist.itemName  = emptyTheme;
                emptyPicklist.itemValue = string.Empty;
                _picklists.Add(emptyPicklist);
            }

            RaisePropertyChanged("Picklists");
        }
        private void Build()
        {
            if (!Settings.Current.Builder.IsLead && !Building.LookupCreated)
            {
                return;
            }
            if (Building.BuildingComplete)
            {
                return;
            }
            if (Builder.State == BuilderState.Error)
            {
                return;
            }

            using (var host = VocabularyManager.CreateServiceHost())
            {
                if (!Building.LookupCreated)
                {
                    UpdateDate("CreateLookupStart");
                }

                builderController.CreateLookup();

                if (!Building.LookupCreated)
                {
                    UpdateDate("CreateLookupEnd");
                }

                if (Building.LookupCreated)
                {
                    if (!Building.BuildingStarted)
                    {
                        UpdateDate("BuildingStart");
                    }

                    builderController.Build();

                    if (builderController.AllChunksComplete)
                    {
                        UpdateDate("BuildingEnd");
                    }
                }
            }
        }
Exemple #6
0
 public PatternMemory()
 {
     Vocabulary         = new VocabularyManager();
     RecognizedPatterns = new Dictionary <string, Pattern>();
     LoadPatterns();
 }
Exemple #7
0
 public QuickTest(IDataRepository <Vocabulary> _VocabularyManager)
 {
     this._VocabularyManager = _VocabularyManager as VocabularyManager;
 }