예제 #1
0
 public CTokenFunction(string _str)
 {
     m_token = Token_Type.Token_Function;
     // _tblformalparameter = new tblFormalParameter();
     _tblfunction = new tblFunction();
     _tblvariable = new tblVariable();
 }
예제 #2
0
 private void listBoxFunctions_MouseClick(object sender, MouseEventArgs e)
 {
     try
     {
         _tblfunction      = (tblFunction)listBoxFunctions.SelectedItem;
         richTextBox1.Text = _tblfunction.Description;
         if (((tblFunction)listBoxFunctions.SelectedItem).Extensible)
         {
             numericUpDownNoOfInputs.Visible = true;
             label2.Visible = true;
         }
         else
         {
             numericUpDownNoOfInputs.Visible = false;
             label2.Visible = false;
         }
         if (IsFunction)
         {
             buttonOK.Enabled = true;
         }
         else
         {
             if (textBoxInstanceName.Text != "")
             {
                 buttonOK.Enabled = true;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #3
0
 private void SaveRibbon()
 {
     foreach (RibbonPage page in ribbonControl1.Pages)
     {
         var pageF = new tblFunction();
         pageF.Menu        = page.Name;
         pageF.Application = "AD";
         pageF.Description = page.Text;
         pageF.ParentMenu  = null;
         baobao.tblFunctions.AddOrUpdate(pageF);
         foreach (RibbonPageGroup pageGroup in page.Groups)
         {
             var pageGroupF = new tblFunction();
             pageGroupF.Menu        = pageGroup.Name;
             pageGroupF.Application = "AD";
             pageGroupF.Description = pageGroup.Text;
             pageGroupF.ParentMenu  = page.Name;
             baobao.tblFunctions.AddOrUpdate(pageGroupF);
             foreach (BarItemLink barItemLink in pageGroup.ItemLinks)
             {
                 var barItemLinkF = new tblFunction();
                 barItemLinkF.Menu        = barItemLink.Item.Name;
                 barItemLinkF.Application = "AD";
                 barItemLinkF.Description = barItemLink.Caption;
                 barItemLinkF.ParentMenu  = pageGroup.Name;
                 baobao.tblFunctions.AddOrUpdate(barItemLinkF);
             }
         }
         baobao.SaveChanges();
     }
 }
예제 #4
0
 //public DrawFunction(int x, int y, tblFunction _tblfunction/*, string _instanseName*/, int _noofextension, TemporayVariable _tempvar/*, long _selectedvarid, long _domainid, long _controllerid, long _pouid*/)
 public DrawFunction(PageList _parent, int x, int y, tblFunction _tblfunction, tblVariable _tblvariable)
     : base(_parent)
 {
     ShapeType              = STATIC_OBJ_TYPE.ID_FBDBoxFunction;
     tblvariable            = _tblvariable;
     tblfunction            = _tblfunction;
     tblvariable.VarNameID  = -1;
     tblfbdblock.FBDBlockID = -1;
     Initalize(x, y);
     GenerateGraphic();
 }
        public ActionResult Edit(FunctionModel Model)
        {
            UserId = USession.User_Id;
            try
            {
                tblFunction TCtable = Connection.tblFunctions.SingleOrDefault(x => x.FunctionId == Model.FunctionId);

                Connection.GDModifyFunction(Model.FunctionName, Model.FunctionId, UserId);
                Connection.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                Errorlog.ErrorManager.LogError(ex);
                return(View());
            }
        }
        public ActionResult Create(tblFunction Model)
        {
            UserId = USession.User_Id;
            try
            {
                Connection.GDsetFunction(Model.FunctionId, Model.FunctionName, UserId, "Y");
                Connection.SaveChanges();

                //return View();

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                Errorlog.ErrorManager.LogError(ex);
                return(View());
            }
        }
예제 #7
0
        private void advancedDataGridView_main_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex == -1)
                {
                }
                else
                {
                    string str1 = (string)this.advancedDataGridView_main.Rows[e.RowIndex].Cells[2].Value;
                    tblvariable.Type = tblSolution.m_tblSolution().StringVarTypeList[str1];

                    BindingList <tblFormalParameter> _combo = new BindingList <tblFormalParameter>();
                    comboBoxProperty.DataSource    = _combo;
                    comboBoxProperty.DisplayMember = "PinName";
                    comboBoxProperty.ValueMember   = "Type";
                    tblFunction tblfunction = tblSolution.m_tblSolution().GetFunctionbyType(tblvariable.Type);
                    for (int i = 0; i < tblfunction.m_tblFormalParameterCollection.Count; i++)
                    {
                        _combo.Add(tblfunction.m_tblFormalParameterCollection[i]);
                    }

                    tblvariable.VarName     = (string)this.advancedDataGridView_main.Rows[e.RowIndex].Cells[0].Value;
                    tblvariable.Description = (string)this.advancedDataGridView_main.Rows[e.RowIndex].Cells[1].Value;

                    //SelectedVarClass = (VarClass)this.advancedDataGridView_main.Rows[e.RowIndex].Cells[3].Value;
                    //TempVar.domainid = DomainID;
                    //TempVar.controllerid = ControllerID;
                    tblvariable.pouID  = (long)comboBoxPOU.SelectedValue;
                    tblformalparameter = (tblFormalParameter)comboBoxProperty.SelectedItem;
                    //TempVar.PropertyType = (int)comboBoxProperty.SelectedValue;
                    //tblformalparameter.PinName = ((tblFormalParameter)(comboBoxProperty.SelectedItem)).PinName;
                    //TempVar.PropertyNo = ((tblFormalParameter)(comboBoxProperty.SelectedItem)).oIndex;
                    str1 = (string)this.advancedDataGridView_main.Rows[e.RowIndex].Cells[4].Value;
                    tblvariable.VarNameID = long.Parse(str1);
                    buttonOK.Enabled      = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #8
0
        private void DeleteUD(TREE_NODE_TYPE _tree_node_type)
        {
            EWSTreeNode node         = (EWSTreeNode)treeViewControl.SelectedNode;
            string      name         = node.Text.ToUpper();
            tblFunction _tblfunction = null;
            tblPou      _tblpou      = null;

            if (node != null)
            {
                if (node.Nodetype == _tree_node_type)
                {
                    foreach (tblFunction tblfunction in tblSolution.m_tblSolution().m_tblFunctionCollection)
                    {
                        if (tblfunction.FunctionName.ToUpper() == name)
                        {
                            _tblfunction = tblfunction;
                            tblSolution.m_tblSolution().functionbyType.Remove(_tblfunction.Type);
                            tblSolution.m_tblSolution().functionbyName.Remove(_tblfunction.FunctionName);
                            break;
                        }
                    }
                    if (_tblfunction != null)
                    {
                        tblSolution.m_tblSolution().m_tblFunctionCollection.Remove(_tblfunction);
                        _tblfunction.Delete();
                    }
                    foreach (tblPou tblpou in tblSolution.m_tblSolution().Dummytblcontroller.m_tblPouCollection)
                    {
                        if (tblpou.pouName.ToUpper() == name)
                        {
                            _tblpou = tblpou;
                            break;
                        }
                    }
                    if (_tblpou != null)
                    {
                        //tblSolution.m_tblSolution().Dummytblcontroller.m_tblPouCollection.Remove(_tblpou);
                        _tblpou.Delete();
                    }
                }
                treeViewControl.Nodes.Remove(treeViewControl.SelectedNode);
            }
        }
예제 #9
0
 public UDFPinForm(bool _isfunction, string _pouname)
 {
     InitializeComponent();
     foreach (tblPou tblpou in tblSolution.m_tblSolution().Dummytblcontroller.m_tblPouCollection)
     {
         if (tblpou.pouName.ToUpper() == _pouname.ToUpper())
         {
             _tblpou = tblpou;
             break;
         }
     }
     foreach (tblFunction tblfunction in tblSolution.m_tblSolution().m_tblFunctionCollection)
     {
         if (tblfunction.FunctionName.ToUpper() == _pouname.ToUpper())
         {
             _tblfunction = tblfunction;
             break;
         }
     }
 }
        public ActionResult Edit(string Code)
        {
            try{
                string        url    = Request.Url.AbsoluteUri;
                FunctionModel TModel = new FunctionModel();

                tblFunction TCtable = Connection.tblFunctions.SingleOrDefault(x => x.FunctionId == Code);
                TModel.IsActive = TCtable.IsActive;

                TModel.FunctionId   = TCtable.FunctionId;
                TModel.FunctionName = TCtable.FunctionName;

                return(PartialView("EditView", TModel));
            }
            catch (Exception ex)
            {
                Errorlog.ErrorManager.LogError(ex);
                return(View());
            }
        }
예제 #11
0
        public static void SetPermission(decimal UserID, string FunctionName, TypeAudit audit)
        {
            if (!ntsSqlFunctions._IsRegis)
            {
                return;
            }
            UsersDataContext _vdata   = new UsersDataContext();
            tblFunction      function = _vdata.tblFunctions.Where(p => p.functionName == FunctionName).FirstOrDefault();

            if (function != null)
            {
                return;
            }
            tblUserPermiss permis = new tblUserPermiss();

            permis.maNguoidungpr_sd = UserID;
            permis.tblFunction      = function;
            permis.permission       = ntsSecurity._mEncrypt(UserID.ToString() + ";" + function.functionIDpr.ToString() + ";" + ((int)audit).ToString(), "rateAnd2012", true);
            _vdata.tblUserPermisses.InsertOnSubmit(permis);
            _vdata.SubmitChanges();
        }
예제 #12
0
        private void addUD(bool _isfunction, POUTYPE _poutype, POUEXECUTIONTYPE _pouexecutiontype, string _nodetreename)
        {
            AddUDPouForm addudpouform = new AddUDPouForm();

            if (DialogResult.OK == addudpouform.ShowDialog())
            {
                int _type = 0;
                if (_isfunction)
                {
                    _type = 0;
                }
                else
                {
                    _type = (int)VarType.USERDEFUNED;
                }
                foreach (tblFunction tblfunction in tblSolution.m_tblSolution().m_tblFunctionCollection)
                {
                    if (tblfunction.IsFunction == _isfunction)
                    {
                        if (tblfunction.Type > _type)
                        {
                            _type = tblfunction.Type;
                        }
                    }
                }

                if (CheckUDNameIsValid(addudpouform.pouname))
                {
                    tblPou tblpou = new tblPou();
                    tblpou.pouName       = addudpouform.pouname;
                    tblpou.Description   = addudpouform.poudescription;
                    tblpou.Type          = _poutype;
                    tblpou.Language      = addudpouform.pouLanguageType;
                    tblpou.executiontype = _pouexecutiontype;
                    tblpou.ControllerID  = tblSolution.m_tblSolution().Dummytblcontroller.ControllerID;
                    tblpou.Insert();
                    tblController tblcontroller = tblSolution.m_tblSolution().GetControllerFromID(tblpou.ControllerID);
                    tblcontroller.m_tblPouCollection.Add(tblpou);
                    tblcontroller.SavePouDB();
                    tblFunction _tblfunction = new tblFunction();
                    _tblfunction.FunctionName  = addudpouform.pouname;
                    _tblfunction.Description   = addudpouform.poudescription;
                    _tblfunction.Language      = (int)addudpouform.pouLanguageType;
                    _tblfunction.SolutionID    = tblSolution.m_tblSolution().SolutionID;
                    _tblfunction.FunctionGroup = (int)FunctionGroup.USER_DEFINED;
                    _tblfunction.IsFunction    = _isfunction;
                    _tblfunction.IsStandard    = false;
                    _tblfunction.Extensible    = false;
                    _tblfunction.Overloaded    = false;
                    _tblfunction.Width         = 4;
                    _tblfunction.Mode          = 3;
                    _tblfunction.Type          = _type + 1;
                    int ret = _tblfunction.Insert();
                    if (ret == 0)
                    {
                        //tblSolution.m_tblSolution().functionbyType.Add(_tblfunction.Type, _tblfunction);
                        //tblSolution.m_tblSolution().functionbyName.Add(_tblfunction.FunctionName, _tblfunction);
                        //EWSTreeNode _node;
                        foreach (TreeNode rootnode in treeViewControl.Nodes)
                        {
                            foreach (TreeNode _node in rootnode.Nodes)
                            {
                                //_node = (EWSTreeNode)node;
                                //while (_node.NextNode != null)
                                {
                                    if (_node.Text == _nodetreename)
                                    {
                                        EWSTreeNode node4 = new EWSTreeNode(tblpou.pouName);
                                        node4.NodeID = tblpou.pouID;
                                        if (_isfunction)
                                        {
                                            node4.Nodetype         = TREE_NODE_TYPE.FUNCTION;
                                            node4.ContextMenuStrip = contextMenuStripUDF;
                                        }
                                        else
                                        {
                                            node4.Nodetype         = TREE_NODE_TYPE.FUNCTIONBLOCK;
                                            node4.ContextMenuStrip = contextMenuStripUDFB;
                                        }
                                        switch ((PROGRAM_LANGUAGE)tblpou.Language)
                                        {
                                        case PROGRAM_LANGUAGE.ENUM_PROGRAM_LANGUAGE_FBD:
                                            node4.ImageIndex         = 4;
                                            node4.SelectedImageIndex = 5;
                                            break;

                                        case PROGRAM_LANGUAGE.ENUM_PROGRAM_LANGUAGE_ST:
                                            node4.ImageIndex         = 12;
                                            node4.SelectedImageIndex = 13;
                                            break;
                                        }


                                        _node.Nodes.Add(node4);
                                        return;
                                    }
                                    //   _node = (EWSTreeNode)_node.NextNode;
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #13
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            //bool closeCondition = false;

            //TempVar.PropertyType = (int)comboBoxProperty.SelectedValue;
            //TempVar.PropertyName = ((tblFormalParameter)(comboBoxProperty.SelectedItem)).PinName;
            //TempVar.PropertyNo = ((tblFormalParameter)(comboBoxProperty.SelectedItem)).oIndex;
            //tblformalparameter = (tblFormalParameter)comboBoxProperty.SelectedItem;

            string str = textBoxInstanceName.Text;

            string[]      words  = str.Split('.');
            List <string> tag    = new List <string>();
            int           len    = 0;
            bool          hasdot = false;

            len = words.GetLength(0);

            tblPou selectedpou;

            if (globalPOU.pouID == (long)comboBoxPOU.SelectedValue)
            {
                selectedpou = globalPOU;
            }
            else
            {
                selectedpou = localPOU;
            }

            for (int i = 0; i < len; i++)
            {
                if (words[i] != "")
                {
                    tag.Add(words[i]);
                }
                else
                {
                    hasdot = true;
                }
            }
            len = tag.Count;

            if (len == 0)
            {
                this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                Close();
            }
            else
            {
                if ((len == 1))
                {
                    if (hasdot)
                    {
                        TagType = GetTagType(tag[0]);
                    }
                    else
                    {
                        foreach (tblVariable _tblvar in selectedpou.m_tblVariableCollection)
                        {
                            if (_tblvar.VarName == tag[0])
                            {
                                tblvariable       = _tblvar;
                                _isobject         = true;
                                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                                Close();
                            }
                        }
                    }
                }
                else
                {
                    if ((len == 2))
                    {
                        _isextendedproperty = false;
                        //if (hasdot)
                        {
                            foreach (tblVariable _tblvar in selectedpou.m_tblVariableCollection)
                            {
                                if (_tblvar.VarName.ToUpper() == tag[0].ToUpper())
                                {
                                    tblvariable = _tblvar;
                                    break;
                                }
                            }
                            tblFunction _function = tblSolution.m_tblSolution().GetFunctionFromType(tblvariable.Type);
                            foreach (tblFormalParameter fp in _function.m_tblFormalParameterCollection)
                            {
                                if (fp.PinName == tag[1])
                                {
                                    tblformalparameter = fp;
                                    _isobject          = false;
                                    this.DialogResult  = System.Windows.Forms.DialogResult.OK;
                                    Close();
                                }
                            }
                        }
                    }
                    else
                    {
                        if (len == 3)
                        {
                            _isobject           = false;
                            _isextendedproperty = true;
                            stringproperty      = "";
                            foreach (tblVariable _tblvar in selectedpou.m_tblVariableCollection)
                            {
                                if (_tblvar.VarName.ToUpper() == tag[0].ToUpper())
                                {
                                    tblvariable = _tblvar;
                                    break;
                                }
                            }
                            tblFunction _function = tblSolution.m_tblSolution().GetFunctionFromType(tblvariable.Type);
                            foreach (tblFormalParameter fp in _function.m_tblFormalParameterCollection)
                            {
                                if (fp.PinName.ToUpper() == tag[1].ToUpper())
                                {
                                    tblformalparameter = fp;

                                    if (tag[1].ToUpper() == "MODE")
                                    {
                                        for (int i = 0; i < _function.Modes.Count; i++)
                                        {
                                            if (tag[2].ToUpper() == _function.Modes[i].ToUpper())
                                            {
                                                stringproperty    = tag[2];
                                                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                                                Close();
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if ((tag[1].ToUpper() == "ALS") ||
                                            (tag[1].ToUpper() == "ALA") ||
                                            (tag[1].ToUpper() == "ALB") ||
                                            (tag[1].ToUpper() == "AEB"))
                                        {
                                            for (int i = 0; i < _function.Statuses.Count; i++)
                                            {
                                                if (tag[2].ToUpper() == _function.Statuses[i].ToUpper())
                                                {
                                                    stringproperty    = tag[2];
                                                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                                                    Close();
                                                }
                                            }
                                        }
                                        else
                                        {
                                            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                                            Close();
                                        }
                                    }

                                    _isobject         = false;
                                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                                    Close();
                                }
                            }
                        }
                    }
                }
            }


            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }
예제 #14
0
        //    public CToken oprator( CToken param)
        //{
        //    return this;
        //}

        protected OPERAND GetFinalOperator(CToken _token)
        {
            OPERAND tempoperand = new OPERAND();

            switch (_token.m_token)
            {
            case Token_Type.Token_Constant:
                tempoperand.Index = ((CTokenOperand)_token).m_Index;
                tempoperand.Token = (byte)((CTokenOperand)_token).m_token;
                //tempoperand.type = ((CTokenOperand)_token).m_Type;
                break;

            case Token_Type.Token_String:
                tempoperand.Index = ((CTokenOperand)_token).m_Index;
                tempoperand.Token = (byte)((CTokenOperand)_token).m_token;
                //tempoperand.type = ((CTokenOperand)_token).m_Type;
                break;

            case Token_Type.Token_Variable:
                //_operand8[0].type = (VarType) ((CTokenVariable*)tok)->m_PropertyType ;
                tempoperand.Token = (byte)_token.m_token;
                //_operand8[0].Index = ((CTokenVariable*)tok)->m_Index;
                tblFunction tblfunction = tblSolution.m_tblSolution().GetFunctionbyType(((CTokenVariable)_token).tblvariable.Type);
                if (((CTokenVariable)_token).isrefernce)
                {
                    tempoperand.Index         = ((CTokenVariable)_token).tblvariable.VarNameID;
                    tempoperand.PropertyNo    = 0;
                    tempoperand.HasSubPropety = 0;
                    tempoperand.SubProperty   = 0;
                    tempoperand.IsReference   = 1;
                }
                else
                {
                    tempoperand.IsReference = 0;
                    if (Common.IsSimpleType(((CTokenVariable)_token).tblvariable.Type) ||
                        (tblfunction.IsStandard && !tblfunction.IsFunction))
                    {
                        tempoperand.Index         = ((CTokenVariable)_token).tblvariable.VarNameID;
                        tempoperand.PropertyNo    = (byte)((CTokenVariable)_token).tblformalparameter.oIndex;
                        tempoperand.HasSubPropety = ((CTokenVariable)_token).HasSubPropety;
                        tempoperand.SubProperty   = ((CTokenVariable)_token).SubProperty;
                    }
                    else
                    {
                        foreach (tblVariable _linktblvariable in ((CTokenVariable)_token).tblvariable.m_tblFInstanceVariableList)
                        {
                            if (_linktblvariable.ParentVarLinkName == ((CTokenVariable)_token).tblformalparameter.PinName)
                            {
                                tempoperand.Index      = _linktblvariable.VarNameID;
                                tempoperand.PropertyNo = 0;
                                break;
                            }
                        }
                    }
                }


                break;

            case Token_Type.Token_TempString:
            case Token_Type.Token_TempValue:
                tempoperand.Index = ((CTokenTempVariable)_token).m_Index;
                tempoperand.Token = (byte)((CTokenTempVariable)_token).m_token;
                tempoperand.type  = ((CTokenTempVariable)_token).m_Type;
                Compiler.FreeAssignedTempVar(tempoperand.type, (int)tempoperand.Index);
                break;

            case Token_Type.Token_FBDPin:
                tempoperand.Index         = ((CTokenFBDPin)_token).tblvariable.VarNameID;
                tempoperand.PinID         = ((CTokenFBDPin)_token).PinID;
                tempoperand.PropertyNo    = (byte)((CTokenFBDPin)_token).tblformalparameterVariable.oIndex;
                tempoperand.HasSubPropety = ((CTokenFBDPin)_token).HasSubPropety;
                tempoperand.SubProperty   = ((CTokenFBDPin)_token).SubProperty;
                tempoperand.PinNo         = (byte)((CTokenFBDPin)_token).tblformalparameterPin.oIndex;
                tempoperand.Token         = (byte)((CTokenOperand)_token).m_token;
                break;

            default:
                break;
            }
            return(tempoperand);
        }
예제 #15
0
 public DrawFBDBox(PageList _parent, int x, int y, tblFunction _tblfunction, int _noofextension, TemporayVariable _tempvar)
     : base(_parent)
 {
     tblfbdblock.FBDBlockID = -1;
     tblvariable.VarNameID  = -1;
 }
예제 #16
0
        private void textBoxInstanceName_TextChanged(object sender, EventArgs e)
        {
            string str = textBoxInstanceName.Text;

            string[]      words  = str.Split('.');
            List <string> tag    = new List <string>();
            int           len    = 0;
            bool          hasdot = false;

            len = words.GetLength(0);

            for (int i = 0; i < len; i++)
            {
                if (words[i] != "")
                {
                    tag.Add(words[i]);
                }
                else
                {
                    hasdot = true;
                }
            }
            len = tag.Count;

            if (len == 0)
            {
                autocompleteMenu1.SetAutocompleteItems(list);
            }
            else
            {
                if ((len == 1))
                {
                    if (hasdot)
                    {
                        TagType = GetTagType(tag[0]);
                        tblFunction _function = tblSolution.m_tblSolution().GetFunctionFromType(TagType);
                        autocompleteMenu1.AppendMode = true;
                        autocompleteMenu1.ClearAll();
                        for (int k = 0; k < _function.m_tblFormalParameterCollection.Count; k++)
                        {
                            autocompleteMenu1.AddItem(new TagObject(_function.m_tblFormalParameterCollection[k].PinName));
                        }
                    }
                    else
                    {
                        autocompleteMenu1.SetAutocompleteItems(list);
                    }
                }
                else
                {
                    if ((len == 2))
                    {
                        if (hasdot)
                        {
                            tblFunction _function = tblSolution.m_tblSolution().GetFunctionFromType(TagType);
                            autocompleteMenu1.AppendMode = true;
                            autocompleteMenu1.ClearAll();
                            if (tag[1].ToUpper() == "MODE")
                            {
                                int  i = 1;
                                MODE tmode;
                                for (int k = 0; k < 32; k++)
                                {
                                    tmode = (MODE)i;
                                    if ((_function.Mode & i) != 0)
                                    {
                                        autocompleteMenu1.AddItem(new TagObject(tmode.ToString()));
                                    }
                                    i *= 2;
                                }
                            }
                            if ((tag[1].ToUpper() == "ALS") ||
                                (tag[1].ToUpper() == "ALA") ||
                                (tag[1].ToUpper() == "ALB") ||
                                (tag[1].ToUpper() == "AEB"))
                            {
                                int         i = 1;
                                AlarmStatus tstatus;
                                for (int k = 0; k < 32; k++)
                                {
                                    tstatus = (AlarmStatus)i;
                                    if ((_function.Status & i) != 0)
                                    {
                                        autocompleteMenu1.AddItem(new TagObject(tstatus.ToString()));
                                    }
                                    i *= 2;
                                }
                            }
                        }
                    }
                    else
                    {
                        autocompleteMenu1.ClearAll();
                    }
                }
            }
        }
예제 #17
0
        private void PrepareChildRows(tblVariable tblvariable, string _area)
        {
            try
            {
                string      str;
                string      str1;
                int         mode;
                int         state;
                int         status;
                int         bitno;
                tblFunction tblfunction = tblSolution.m_tblSolution().GetFunctionbyType(tblvariable.Type);
                mode   = tblfunction.Mode;
                state  = tblfunction.state;
                status = tblfunction.Status;
                for (int i = 0; i < tblfunction.m_tblFormalParameterCollection.Count; i++)
                {
                    str = tblfunction.m_tblFormalParameterCollection[i].PinName;
                    switch (str)
                    {
                    case "Mode":
                        if (Common.Variable_ShowMode && (mode != 0))
                        {
                            str1     = tblvariable.VarName + "." + str;
                            property = new Node(str1,
                                                tblfunction.m_tblFormalParameterCollection[i].Description,
                                                tblSolution.m_tblSolution().VarTypeStringList[tblfunction.m_tblFormalParameterCollection[i].Type],
                                                _area);

                            for (int j = 0; j < tblSolution.m_tblSolution().m_tblBlockModeTextCollection.Count; j++)
                            {
                                bitno = tblSolution.m_tblSolution().m_tblBlockModeTextCollection[j].Bit;
                                if (Common.IsBitSet(mode, bitno))
                                {
                                    subperoprty = new Node(str1 + "." + tblSolution.m_tblSolution().m_tblBlockModeTextCollection[j].Txt,
                                                           tblSolution.m_tblSolution().m_tblBlockModeTextCollection[j].Decsription,
                                                           "BOOL",
                                                           _area);
                                    property.Children.Add(subperoprty);
                                }
                            }
                            tag.Children.Add(property);
                        }
                        break;

                    case "State":
                        if (Common.Variable_ShowState && (state != 0))
                        {
                            str1     = tblvariable.VarName + "." + str;
                            property = new Node(str1,
                                                tblfunction.m_tblFormalParameterCollection[i].Description,
                                                tblSolution.m_tblSolution().VarTypeStringList[tblfunction.m_tblFormalParameterCollection[i].Type],
                                                _area);

                            for (int j = 0; j < tblSolution.m_tblSolution().m_tblBlockStateTextCollection.Count; j++)
                            {
                                bitno = tblSolution.m_tblSolution().m_tblBlockStateTextCollection[j].Bit;
                                if (Common.IsBitSet(state, bitno))
                                {
                                    subperoprty = new Node(str1 + "." + tblSolution.m_tblSolution().m_tblBlockStateTextCollection[j].Txt,
                                                           tblSolution.m_tblSolution().m_tblBlockStateTextCollection[j].Decsription,
                                                           "BOOL",
                                                           _area);
                                    property.Children.Add(subperoprty);
                                }
                            }
                            tag.Children.Add(property);
                        }
                        break;

                    case "ALS":
                        if (Common.Variable_ShowALS && (status != 0))
                        {
                            str1     = tblvariable.VarName + "." + str;
                            property = new Node(str1,
                                                tblfunction.m_tblFormalParameterCollection[i].Description,
                                                tblSolution.m_tblSolution().VarTypeStringList[tblfunction.m_tblFormalParameterCollection[i].Type],
                                                _area);

                            for (int j = 0; j < tblSolution.m_tblSolution().m_tblBlockAlarmStatusTextCollection.Count; j++)
                            {
                                bitno = tblSolution.m_tblSolution().m_tblBlockAlarmStatusTextCollection[j].Bit;
                                if (Common.IsBitSet(status, bitno))
                                {
                                    subperoprty = new Node(str1 + "." + tblSolution.m_tblSolution().m_tblBlockAlarmStatusTextCollection[j].Txt,
                                                           tblSolution.m_tblSolution().m_tblBlockAlarmStatusTextCollection[j].Decsription,
                                                           "BOOL",
                                                           _area);
                                    property.Children.Add(subperoprty);
                                }
                            }
                            tag.Children.Add(property);
                        }
                        break;

                    case "ALA":
                        if (Common.Variable_ShowALA && (status != 0))
                        {
                            str1     = tblvariable.VarName + "." + str;
                            property = new Node(str1,
                                                tblfunction.m_tblFormalParameterCollection[i].Description,
                                                tblSolution.m_tblSolution().VarTypeStringList[tblfunction.m_tblFormalParameterCollection[i].Type],
                                                _area);

                            for (int j = 0; j < tblSolution.m_tblSolution().m_tblBlockAlarmStatusTextCollection.Count; j++)
                            {
                                bitno = tblSolution.m_tblSolution().m_tblBlockAlarmStatusTextCollection[j].Bit;
                                if (Common.IsBitSet(status, bitno))
                                {
                                    subperoprty = new Node(str1 + "." + tblSolution.m_tblSolution().m_tblBlockAlarmStatusTextCollection[j].Txt,
                                                           tblSolution.m_tblSolution().m_tblBlockAlarmStatusTextCollection[j].Decsription,
                                                           "BOOL",
                                                           _area);
                                    property.Children.Add(subperoprty);
                                }
                            }
                            tag.Children.Add(property);
                        }
                        break;

                    case "ALB":
                        if (Common.Variable_ShowALB && (status != 0))
                        {
                            str1     = tblvariable.VarName + "." + str;
                            property = new Node(str1,
                                                tblfunction.m_tblFormalParameterCollection[i].Description,
                                                tblSolution.m_tblSolution().VarTypeStringList[tblfunction.m_tblFormalParameterCollection[i].Type],
                                                _area);

                            for (int j = 0; j < tblSolution.m_tblSolution().m_tblBlockAlarmStatusTextCollection.Count; j++)
                            {
                                bitno = tblSolution.m_tblSolution().m_tblBlockAlarmStatusTextCollection[j].Bit;
                                if (Common.IsBitSet(status, bitno))
                                {
                                    subperoprty = new Node(str1 + "." + tblSolution.m_tblSolution().m_tblBlockAlarmStatusTextCollection[j].Txt,
                                                           tblSolution.m_tblSolution().m_tblBlockAlarmStatusTextCollection[j].Decsription,
                                                           "BOOL",
                                                           _area);
                                    property.Children.Add(subperoprty);
                                }
                            }
                            tag.Children.Add(property);
                        }
                        break;

                    case "AEB":
                        if (Common.Variable_ShowAEB && (status != 0))
                        {
                            str1     = tblvariable.VarName + "." + str;
                            property = new Node(str1,
                                                tblfunction.m_tblFormalParameterCollection[i].Description,
                                                tblSolution.m_tblSolution().VarTypeStringList[tblfunction.m_tblFormalParameterCollection[i].Type],
                                                _area);

                            for (int j = 0; j < tblSolution.m_tblSolution().m_tblBlockAlarmStatusTextCollection.Count; j++)
                            {
                                bitno = tblSolution.m_tblSolution().m_tblBlockAlarmStatusTextCollection[j].Bit;
                                if (Common.IsBitSet(status, bitno))
                                {
                                    subperoprty = new Node(str1 + "." + tblSolution.m_tblSolution().m_tblBlockAlarmStatusTextCollection[j].Txt,
                                                           tblSolution.m_tblSolution().m_tblBlockAlarmStatusTextCollection[j].Decsription,
                                                           "BOOL",
                                                           _area);
                                    property.Children.Add(subperoprty);
                                }
                            }
                            tag.Children.Add(property);
                        }
                        break;

                    case "OPN":
                        if (Common.Variable_ShowOPN)
                        {
                            str1     = tblvariable.VarName + "." + str;
                            property = new Node(str1,
                                                tblfunction.m_tblFormalParameterCollection[i].Description,
                                                tblSolution.m_tblSolution().VarTypeStringList[tblfunction.m_tblFormalParameterCollection[i].Type],
                                                _area);
                            tag.Children.Add(property);
                        }
                        break;

                    case "OPH":
                        if (Common.Variable_ShowOPH)
                        {
                            str1     = tblvariable.VarName + "." + str;
                            property = new Node(str1,
                                                tblfunction.m_tblFormalParameterCollection[i].Description,
                                                tblSolution.m_tblSolution().VarTypeStringList[tblfunction.m_tblFormalParameterCollection[i].Type],
                                                _area);
                            tag.Children.Add(property);
                        }
                        break;

                    case "OPM":
                        if (Common.Variable_ShowOPM)
                        {
                            str1     = tblvariable.VarName + "." + str;
                            property = new Node(str1,
                                                tblfunction.m_tblFormalParameterCollection[i].Description,
                                                tblSolution.m_tblSolution().VarTypeStringList[tblfunction.m_tblFormalParameterCollection[i].Type],
                                                _area);
                            tag.Children.Add(property);
                        }
                        break;

                    case "MNN":
                        if (Common.Variable_ShowMNN)
                        {
                            str1     = tblvariable.VarName + "." + str;
                            property = new Node(str1,
                                                tblfunction.m_tblFormalParameterCollection[i].Description,
                                                tblSolution.m_tblSolution().VarTypeStringList[tblfunction.m_tblFormalParameterCollection[i].Type],
                                                _area);
                            tag.Children.Add(property);
                        }
                        break;

                    default:
                        str1     = tblvariable.VarName + "." + str;
                        property = new Node(str1,
                                            tblfunction.m_tblFormalParameterCollection[i].Description,
                                            tblSolution.m_tblSolution().VarTypeStringList[tblfunction.m_tblFormalParameterCollection[i].Type],
                                            _area);
                        tag.Children.Add(property);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #18
0
 public tblBlockStateCollection(tblFunction parent)
 {
     m_FunctionID_tblFunction = parent;
 }