Ejemplo n.º 1
0
        /// <summary>
        /// Attach the view
        /// </summary>
        /// <param name="pView">The view to be loaded</param>
        /// <param name="pPage">The Page to be loaded</param>
        public void LoadView(RunTimeView pView, Page pPage)
        {
            #region Input Validation
            if (view == null)
            {
                throw new ArgumentNullException("view");
            }
            #endregion Input validation

            Epi.Windows.Controls.ViewNode viewNode = new Epi.Windows.Controls.ViewNode(pView.View);
            viewTree.Nodes.Clear();
            viewNode.ImageIndex = 76;
            viewNode.SelectedImageIndex = 76;
            viewTree.Nodes.Add(viewNode);

            foreach (PageNode page in viewTree.Nodes[0].Nodes)
            {
                page.ImageIndex = 17;
                page.SelectedImageIndex = 17;
            }

            viewTree.ExpandAll();
            this.view = pView;

            for (int i = 0; i < viewTree.Nodes[0].Nodes.Count; i++)
            {
                PageNode page = (PageNode) viewTree.Nodes[0].Nodes[i];
                if (page.Text == pPage.Name)
                {
                    viewTree.SelectedNode = viewTree.Nodes[0].Nodes[i];
                    break;
                }
            }/**/
        }
Ejemplo n.º 2
0
        public void OpenViewHandler(object sender, OpenViewEventArgs e)
        {
            Epi.View view = mCurrentProject.Views.GetViewById(e.ViewId);
            if (this.mCurrentView.Count == 0)
            {
                this.mCurrentView.Push(new RunTimeView(e.EnterCheckCodeInterface, view));
            }
            else
            {
                if (
                    this.mCurrentProject.FilePath != view.GetProject().FilePath ||
                    view.ParentView == null ||
                    view.ParentView.Name != this.mCurrentView.Peek().View.Name
                    )
                {
                    while (this.mCurrentView.Count > 0)
                    {
                        this.mCurrentView.Pop().CloseView(this, new RunCheckCodeEventArgs(EventActionEnum.CloseView, ""));
                    }

                    this.mCurrentView.Push(new RunTimeView(e.EnterCheckCodeInterface, view));
                }
                else
                {
                    RunTimeView runTimeView           = this.mCurrentView.Peek();
                    int         CurrentRecordId       = runTimeView.View.CurrentRecordId;
                    string      CurrentGlobalRecordId = runTimeView.View.CurrentGlobalRecordId;

                    EpiInfo.Plugin.IScope scope = runTimeView.EpiInterpreter.Context.GetNewScope(runTimeView.View.Name, runTimeView.EpiInterpreter.Context.Scope);

                    foreach (Epi.Fields.Field field in runTimeView.View.Fields)
                    {
                        if (field is EpiInfo.Plugin.IVariable)
                        {
                            PluginVariable pluginVariable = new PluginVariable();
                            pluginVariable.VariableScope = EpiInfo.Plugin.VariableScope.Standard;
                            pluginVariable.Name          = field.Name;
                            pluginVariable.DataType      = ((EpiInfo.Plugin.IVariable)field).DataType;

                            if (field is Epi.Fields.CheckBoxField || field is Epi.Fields.YesNoField)
                            {
                                if (((Epi.Fields.IDataField)field).CurrentRecordValueString == "1")
                                {
                                    pluginVariable.Expression = "true";
                                }
                                else if (((Epi.Fields.IDataField)field).CurrentRecordValueString == "0")
                                {
                                    pluginVariable.Expression = "false";
                                }
                                else
                                {
                                    pluginVariable.Expression = null;
                                }
                            }
                            else
                            {
                                pluginVariable.Expression = ((Epi.Fields.IDataField)field).CurrentRecordValueString;
                            }

                            scope.Define(pluginVariable);
                        }
                    }

                    this.mCurrentView.Push(new RunTimeView(e.EnterCheckCodeInterface, view, CurrentRecordId, CurrentGlobalRecordId, scope));
                }
            }

            this.mCurrentView.Peek().OpenViewHandler(sender, e);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Attach the view
        /// </summary>
        /// <param name="view">The view to be loaded</param>
        public void LoadView(RunTimeView view)
        {
            #region Input Validation
            if (view == null)
            {
                throw new ArgumentNullException("view");
            }
            #endregion Input validation

            Epi.Windows.Controls.ViewNode viewNode = new Epi.Windows.Controls.ViewNode(view.View);
            viewNode.ImageIndex = 76;
            viewNode.SelectedImageIndex = 76;
            viewTree.Nodes.Add(viewNode);

            foreach (PageNode page in viewTree.Nodes[0].Nodes)
            {
                page.ImageIndex = 17;
                page.SelectedImageIndex = 17;
            }

            viewTree.ExpandAll();
            this.view = view;
        }