public OneEnsembleAlgVisualizer(Tree atree)
     : this()
 {
     try
     {
         this.Tree = atree;
         Init();
     }
     catch (Exception _ex)
     {
         GeneralTools.Tools.WriteToLog(_ex);
     }
 }
        public static void UpdateTree(IOneVisualizer aIOV, Tree aTree)
        {
            List<ClusterEnsemble.DataStructures.Property> _parameters = aTree.Value.InProperties;
            aIOV.Init();

            if (!aTree.Value.IsAbstract && _parameters != null)
            {
                for (int i = 0; i < _parameters.Count; i++)
                {
                    Grid _grid = aIOV.CreateGrid(_parameters[i].Name, _parameters[i]);
                    if (_grid != null)
                        aIOV.StackPanel.Children.Add(_grid);
                }
                aIOV.ButtonSelect.Visibility = Visibility.Visible;
            }
            else
                aIOV.ButtonSelect.Visibility = Visibility.Hidden;
        }
        private GroupBox CreateGroupBox(Tree aTree)
        {
            try
            {
                GroupBox _result = new GroupBox();
                _result.Header = aTree.Value.Name;
                _result.Margin = new Thickness(10, 5, 10, 5);

                StackPanel _content = new StackPanel();
                _content.Orientation = Orientation.Vertical;

                foreach (Property _p in aTree.Value.InProperties)
                {
                    Grid _temp = CreateGrid(_p.Name, _p);
                    if (_temp != null)
                        _content.Children.Add(_temp);
                }

                _result.Content = _content;

                return _result;
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
                return null;
            }
        }
 public void UpdateTree(Tree aTree)
 {
     try
     {
         Utils_IOneVisualizer.UpdateTree(this, aTree);
     }
     catch (Exception _ex)
     {
         GeneralTools.Tools.WriteToLog(_ex);
     }
 }
        public static string VerifyErrors(IOneVisualizer aIOV, Tree aTree, out bool aOk)
        {
            string _errors = "";
            aOk = true;
            for (int i = 0; i < aIOV.InControls.Count; i++)
            {
                object _value;
                string _parameter = null;
                ClusterEnsemble.DataStructures.Property _propertyIn = null;

                if (aIOV.InControls[i].ControlType == ControlType.TextBox)
                {
                    _parameter = aIOV.InControls[i].TextBox.Text;
                    _propertyIn = (ClusterEnsemble.DataStructures.Property)aIOV.InControls[i].TextBox.Tag;
                }
                else
                {
                    _parameter = ((Value_Converter)aIOV.InControls[i].ComboBox.SelectedItem).Value;
                    _propertyIn = (ClusterEnsemble.DataStructures.Property)aIOV.InControls[i].ComboBox.Tag;

                    _propertyIn.Converter = ((Value_Converter)aIOV.InControls[i].ComboBox.SelectedItem).Converter;
                }

                if (!_propertyIn.Converter.TryConvert(_parameter, out _value))
                {
                    aOk = false;
                    _errors += "Wrong Parameter: " + _propertyIn.Name + ", from algorithm: " + aTree.Value.Name + "\r\n";
                }
                else
                    _propertyIn.Value = _value;
            }

            return _errors;
        }
        private void UpdateProximities(Tree aTree)
        {
            try
            {
                if (!aTree.Value.IsAbstract)
                {
                    List<Proximity> _dissTemp = (CurrentProximities != null) ? CurrentProximities : new List<Proximity>();

                    ClusterAlgorithm _ClusterAlgorithm = ReflectionTools.GetInstance<ClusterAlgorithm>(aTree.Value.FullName);

                    List<Proximity> _source = new List<Proximity>();

                    foreach (Proximity _prox in _dissTemp)
                        if (_ClusterAlgorithm.ProximityType == ProximityType.Both || VerifyProximity(_ClusterAlgorithm.ProximityType, _prox))
                            _source.Add(_prox);

                    this.cb_Proximities.ItemsSource = null;
                    this.cb_Proximities.ItemsSource = _source;
                    this.cb_Proximities.DisplayMemberPath = "Name";
                    if (_source.Count > 0)
                        this.cb_Proximities.SelectedIndex = 0;
                    else
                        Enviroment.Proximity = null;

                    this.cb_Proximities.IsEnabled = _ClusterAlgorithm.ProximityType != ProximityType.None; 
                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
Exemplo n.º 7
0
 public NewEnsembleAlgorithmEventArgs(Tree aNewEnsembleAlgorithm)
 {
     this.fNewEnsembleAlgorithm = aNewEnsembleAlgorithm;
 }
Exemplo n.º 8
0
 public NewClusterAlgorithmEventArgs(Tree aNewClusterAlgorithm)
 {
     this.fNewClusterAlgorithm = aNewClusterAlgorithm;
 }