private static void Main(string[] args) { // Load all classes and instantiate each correctly defined class in the config file ExampleFactory.LoadAllExamples(); // Run Startup() on all IExampleRoot defined class instantiations ExampleFactory.StartAllExamples(); // Wait 1 second Thread.Sleep(1000); // Run Shutdown() on all IExampleRoot defined class instantiations ExampleFactory.ShutdownAllExamples(); }
/// <summary> /// Handles the Click event of the RecalculateRegressionTreeButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void RecalculateRegressionTreeButton_Click(object sender, RoutedEventArgs e) { try { ExampleFactory factory = new ExampleFactory(this.GetDimension()); this.tree = new MyRegressionTree(factory.GetCarExamples()); IGardener gardener = new ReducedErrorPruningForRegressionTrees((MyRegressionTree)tree, 7); this.Split(tree, gardener, factory.GetCarTestSet()); } catch (DecisionTree.Implementation.Exceptions.TreeException ex) { MessageBox.Show(ex.Message); } }
public async Task <int> AddNewWord(TranslateResultDto translateResult, string userName) { var userID = await GetUserId(userName); var word = new Word() { Text = translateResult.Original.Trim(), Level = LevelType.First, Phonetic = translateResult.Phonetic, SuperMemory = new SuperMemory(), UserId = userID, Translates = new List <Translate>(), Examples = new List <Example>(), Sound = translateResult.UrlSound }; foreach (var pair in translateResult.Translate) { WordType wordType = string.IsNullOrEmpty(pair.Key) ? WordType.Definition : pair.Key.GetEnumValue <WordType>(); foreach (var translation in pair.Value) { var t = new Translate() { Text = translation.Trim(), WordType = wordType }; word.Translates.Add(t); } } word.Examples.Add(new Example() { Text = translateResult.Sentence.Trim() }); CoreExamplesProvider examplesProvider = null; if (!string.IsNullOrEmpty(translateResult.Provider) && (examplesProvider = ExampleFactory.GetProvider(translateResult.Original, translateResult.Provider, GetLogger())) != null) { var examples = await examplesProvider.GetExamples(); if (examples != null && examples.Examples.Any()) { examples.Examples.ForEach(e => word.Examples.Add(new Example() { Text = e.Trim() })); } } _unitOfWork.Repository <Word>().Insert(word); return(await _unitOfWork.SaveChangesAsync()); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); examplesContainer.LoadDemos(ExampleFactory.GetExamples()); }