コード例 #1
0
ファイル: CheckCode.cs プロジェクト: NALSS/epiinfo-82474
        /// <summary>
        /// Constructor for the class
        /// </summary>
        /// <param name="view">The View to load check code for</param>
        /// <param name="frm">The main form</param>
        public CheckCode(View currentview, MakeViewMainForm frm)
        {
            mainForm = frm;
            if(currentview!=null)
            currentview.MustRefreshFieldCollection = true;
            view = currentview;
            Construct();
            EpiInfo.Plugin.IEnterInterpreter MR = mainForm.EpiInterpreter;
            MR.Context.RemoveVariablesInScope(VariableScope.Standard);

            if (!string.IsNullOrEmpty(view.CheckCode))
            {
                try
                {
                    mainForm.EpiInterpreter.Execute(view.CheckCode);
                }
                catch
                {

                }
            }

            foreach (Field field in view.Fields)
            {
                if (field is IDataField)
                {
                    EpiInfo.Plugin.IVariable definedVar = (EpiInfo.Plugin.IVariable)field;
                    MR.Context.DefineVariable(definedVar);
                }
                else if (field is Epi.Fields.LabelField)
                {
                    PluginVariable p = new PluginVariable();
                    p.Name = field.Name;
                    p.Prompt = ((Epi.Fields.LabelField)field).PromptText;
                    p.VariableScope = EpiInfo.Plugin.VariableScope.DataSource;
                    p.DataType = EpiInfo.Plugin.DataType.Text;
                    MR.Context.DefineVariable(p);
                }
                else
                {
                }
            }

            BuildComboBox();

            this.codeText.SelectionStart = 0;
            this.codeText.SelectionLength = 0;
        }
コード例 #2
0
ファイル: Rule_Context.cs プロジェクト: NALSS/epiinfo-82474
 public static void LoadPermanentVariables(IScope pScope)
 {
     Configuration config = Configuration.GetNewInstance();
     foreach (Epi.DataSets.Config.PermanentVariableRow row in config.PermanentVariables)
     {
         EpiInfo.Plugin.IVariable var = new PluginVariable(row.Name, (EpiInfo.Plugin.DataType)row.DataType, VariableScope.Permanent, row.DataValue);
         pScope.Define(var);
     }
 }