private void bt_Run_Click(object sender, RoutedEventArgs e) { try { if (HasSelectedAlgorithm) { string _Error = ""; if (!Enviroment.CanRunAlgorithm(out _Error, AlgorithmType.Clustering)) { MessageBox.Show(_Error, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } ReflectionTools _rct = new ReflectionTools(); ClusterAlgorithm _ClusterAlg = ReflectionTools.GetInstance <ClusterAlgorithm>(Tree.Value.FullName); foreach (CEDS.Property _p in Tree.Value.InProperties) { _rct.SetProperty(Tree.Value.FullName, _ClusterAlg, _p); } if (!VisualUtils.SetGlobalInProperties(_rct, _ClusterAlg, Tree, out _Error, this.chbx_AttrRnd.IsChecked.Value)) { MessageBox.Show(_Error, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } Run _run = RunMethod; _run.BeginInvoke(_ClusterAlg, RunFinish, new DataThread() { Run = _run, ClusterAlgorithm = _ClusterAlg }); } else { MessageBox.Show("You must first select a Clustering algorithm.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } catch (Exception _ex) { GeneralTools.Tools.WriteToLog(_ex); } }
private void bt_Run_Click(object sender, RoutedEventArgs e) { try { if (HasSelectedAlgorithm) { string _Error = ""; if (!Enviroment.CanRunAlgorithm(out _Error, AlgorithmType.Ensemble)) { MessageBox.Show(_Error, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } ReflectionTools _rcet = new ReflectionTools(); ConsensusFunction _EnsembleAlg = ReflectionTools.GetInstance <ConsensusFunction>(Tree.Value.FullName); foreach (CEDS.Property _p in Tree.Value.InProperties) { _rcet.SetProperty(Tree.Value.FullName, _EnsembleAlg, _p); } List <Structuring> _structuringsParams = GetSelectedStructurings(); if (_structuringsParams == null || _structuringsParams.Count == 0) { MessageBox.Show("You must select at least one Structuring to apply an Ensemble algorithm.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } VisualUtils.SetGlobalInProperties(_rcet, _EnsembleAlg, Tree, _structuringsParams); #region OLD CODE //Structuring _structuring = _EnsembleAlg.BuildStructuring(); //PartitionInfo _partInfo = new PartitionInfo() //{ // AlgorithmName = this.tb_SelectEnsembleAlg.Text, // ConsensusFunction = _EnsembleAlg, // Partition = _structuring, // AlgorithmType = AlgorithmType.Ensemble, // Index = -1 //}; //this.uctrl_ListClusterAlgVisualizerEnsemble.AddPartitionInfo(_partInfo); //if (NewStructuringEventHandler != null) //{ // NewStructuringEventHandler(this, new NewStructuringEventArgs(_partInfo)); //} #endregion Run _run = RunMethod; _run.BeginInvoke(_EnsembleAlg, RunFinish, new DataThread() { ConsensusFunction = _EnsembleAlg, Run = _run }); } else { MessageBox.Show("You must first select an Ensemble algorithm.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } catch (Exception _ex) { GeneralTools.Tools.WriteToLog(_ex); } }