Example #1
0
        public FitFunctionNameAndCategoryController(FitFunctionScript doc)
        {
            _doc             = doc;
            _tempName        = _doc.FitFunctionName;
            _tempCategory    = _doc.FitFunctionCategory;
            _tempDescription = _doc.FitFunctionDescription;

            _controllerName                 = (ISingleValueController)Current.Gui.GetControllerAndControl(new object[] { _tempName }, typeof(ISingleValueController));
            _controllerCategory             = (ISingleValueController)Current.Gui.GetControllerAndControl(new object[] { _tempCategory }, typeof(ISingleValueController));
            _controllerDescription          = (ISingleValueController)Current.Gui.GetControllerAndControl(new object[] { _tempDescription }, typeof(ISingleValueController));
            _controllerShouldSaveInUserData = (IBooleanValueController)Current.Gui.GetControllerAndControl(new object[] { _tempShouldSave }, typeof(IBooleanValueController));


            _controllerName.DescriptionText                 = "Enter fit function name:";
            _controllerCategory.DescriptionText             = "Enter fit function category:";
            _controllerDescription.DescriptionText          = "Enter fit function description:";
            _controllerShouldSaveInUserData.DescriptionText = "Save in user fit functions directory?";

            base.Initialize(new ControlViewElement[] {
                new ControlViewElement(null, _controllerName, _controllerName.ViewObject),
                new ControlViewElement(null, _controllerCategory, _controllerCategory.ViewObject),
                new ControlViewElement(null, _controllerDescription, _controllerDescription.ViewObject),
                new ControlViewElement(null, _controllerShouldSaveInUserData, _controllerShouldSaveInUserData.ViewObject)
            },
                            false);
        }
        public void EhView_NewFitFunction()
        {
            FitFunctionScript script = new FitFunctionScript();

            object scriptAsObject = script;

            if (Current.Gui.ShowDialog(ref scriptAsObject, "Create fit function"))
            {
                script = (FitFunctionScript)scriptAsObject;

                Current.Gui.ShowDialog(new FitFunctionNameAndCategoryController(script), "Name your script");

                Current.Project.FitFunctionScripts.Add(script);

                Select(script);
                _funcselController.Refresh();
                _view.SwitchToFitEnsemblePage();
            }
        }