public SingleInstanceChoiceController(SingleInstanceChoice doc)
		{
			_doc = doc;
			_types = Altaxo.Main.Services.ReflectionService.GetNonAbstractSubclassesOf(_doc.InstanceType);

			int selectedIndex = -1;
			string[] choices = new string[_types.Length];
			for (int i = 0; i < _types.Length; i++)
			{
				choices[i] = Current.Gui.GetUserFriendlyClassName(_types[i]);
				if (_doc.Instance != null && _doc.Instance.GetType() == _types[i])
					selectedIndex = i;
			}

			base.Initialize(choices, selectedIndex);
		}
        public SingleInstanceChoiceController(SingleInstanceChoice doc)
        {
            _doc   = doc;
            _types = Altaxo.Main.Services.ReflectionService.GetNonAbstractSubclassesOf(_doc.InstanceType);

            int selectedIndex = -1;

            string[] choices = new string[_types.Length];
            for (int i = 0; i < _types.Length; i++)
            {
                choices[i] = Current.Gui.GetUserFriendlyClassName(_types[i]);
                if (_doc.Instance != null && _doc.Instance.GetType() == _types[i])
                {
                    selectedIndex = i;
                }
            }

            base.Initialize(choices, selectedIndex);
        }
    public void EhView_ChooseErrorFunction(int idx)
    {
      SingleInstanceChoice choice = new SingleInstanceChoice(typeof(IVarianceScaling),_doc.ErrorEvaluation(idx));

      object choiceAsObject = choice;
      if(Current.Gui.ShowDialog(ref choiceAsObject, "Select error norm"))
      {
        choice = (SingleInstanceChoice)choiceAsObject;
        _doc.SetErrorEvaluation(idx,(IVarianceScaling)choice.Instance);
        _view.Refresh();
      }
    }