예제 #1
0
        public void CloseViewHandler(object returnHome, EventArgs e)
        {
            this.canvas.UnsubscribeControlEventHandlers();
            this.SetFieldData();

            if (SaveRecord() == false)
            {
                return;
            }

            RunTimeView RTV = this.EnterCheckCodeEngine.CurrentView;

            this.IsClosingRelatedView = RTV.View.IsRelatedView;
            EpiInfo.Plugin.IScope scope = RTV.EpiInterpreter.Context.Scope.GetEnclosingScope();
            this.EnterCheckCodeEngine.CheckCodeHandler(this, new RunCheckCodeEventArgs(EventActionEnum.CloseView, ""));

            if (returnHome is Boolean && (bool)returnHome)
            {
                while (this.EnterCheckCodeEngine.CurrentView.View.IsRelatedView)
                {
                    this.EnterCheckCodeEngine.CheckCodeHandler(this, new RunCheckCodeEventArgs(EventActionEnum.CloseView, ""));
                }
            }

            if (this.EnterCheckCodeEngine.CurrentView != null)
            {
                view = this.EnterCheckCodeEngine.CurrentView.View;

                this.Reset();
                this.canvas.CurrentView = this.view;
                this.mainForm.OpenView(this.view);

                this.viewExplorer.LoadView(this.EnterCheckCodeEngine.CurrentView, this.EnterCheckCodeEngine.CurrentView.CurrentPage);

                // *** populate view data with any changes from child - begin
                if (scope != null && this.view.Name.Equals(scope.Name, StringComparison.OrdinalIgnoreCase))
                {
                    foreach (Epi.Fields.Field field in this.view.Fields)
                    {
                        if (field is EpiInfo.Plugin.IVariable)
                        {
                            EpiInfo.Plugin.IVariable iVariable = scope.Resolve(field.Name, this.view.Name);

                            if (iVariable != null && (field is Epi.Fields.ImageField == false))
                            {
                                if (field is Epi.Fields.CheckBoxField || field is Epi.Fields.YesNoField)
                                {
                                    if (((Epi.Fields.IDataField)field).CurrentRecordValueString == "true" || ((Epi.Fields.IDataField)field).CurrentRecordValueString == "1")
                                    {
                                        //v.Expression = "true";
                                        ((Epi.Fields.IDataField)field).CurrentRecordValueString = "1";
                                    }
                                    else if (((Epi.Fields.IDataField)field).CurrentRecordValueString == "false" || ((Epi.Fields.IDataField)field).CurrentRecordValueString == "0")
                                    {
                                        //v.Expression = "false";
                                        ((Epi.Fields.IDataField)field).CurrentRecordValueString = "0";
                                    }
                                    else
                                    {
                                        ((Epi.Fields.IDataField)field).CurrentRecordValueString = null;
                                    }
                                }
                                else
                                {
                                    string value = iVariable.Expression;

                                    if (value != ((EpiInfo.Plugin.IVariable)field).Expression)
                                    {
                                        ((Epi.Fields.IDataField)field).CurrentRecordValueString = value;
                                    }
                                }
                            }
                        }
                    }
                }
                // *** populate view data with any changes from child - end

                this.Render();
                this.IsClosingRelatedView = false;
            }
            else
            {
                this.view              = null;
                this.currentPage       = null;
                this.mainForm.View     = this.view;
                this.viewExplorer.View = this.EnterCheckCodeEngine.CurrentView;
                this.Reset();
                this.Render();
                this.canvas.CurrentView = this.view;
            }
        }
예제 #2
0
 public SymbolTable(string pName, EpiInfo.Plugin.IScope parent)
 {
     _name       = pName;
     _parent     = parent;
     _symbolList = new Dictionary <string, EpiInfo.Plugin.IVariable>(StringComparer.OrdinalIgnoreCase);
 }
예제 #3
0
 public SymbolTable(string pName, EpiInfo.Plugin.IScope parent)
 {
     _name = pName;
     _parent = parent;
     _symbolList = new Dictionary<string, EpiInfo.Plugin.IVariable>(StringComparer.OrdinalIgnoreCase);
 }
 public cSymbolTable(EpiInfo.Plugin.IScope pParent)
 {
     this._name       = null;
     this._parent     = pParent;
     this._SymbolList = new Dictionary <string, EpiInfo.Plugin.IVariable>(StringComparer.OrdinalIgnoreCase);
 }