Exemplo n.º 1
0
 public CTokenVariable(String _str) : base(_str)
 {
     m_token = Token_Type.Token_Variable;
     //m_Value = gcnew VarType();
     //m_PropertyType =VarType.UNKNOWN;
     _tblformalparameter = new tblFormalParameter();
     _tblvariable        = new tblVariable();
 }
Exemplo n.º 2
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;

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }
Exemplo n.º 3
0
 public DrawVariable(PageList _parent, int x, int y, tblVariable _tblvariable, tblFormalParameter _tblformalparameter, string extendedproperystring /*,bool isextendedproperty,bool isobject*/)
     : base(_parent)
 {
     tblvariable        = _tblvariable;
     tblformalparameter = _tblformalparameter;
     //this._isobject = isobject;
     this.ExtendedPropertyTXT = extendedproperystring;
     //this._isextendedproperty = isextendedproperty;
     ShapeType = STATIC_OBJ_TYPE.ID_FBDBoxVariable;
     Initalize(x, y);
     GenerateGraphic();
 }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
0
        public FBDObjectPin(FBDboxObject _parent, tblFormalParameter _tblformalparameter, bool _visible)
        {
            Parent = _parent;
            tblformalparameter.Class           = _tblformalparameter.Class;
            tblformalparameter.Description     = _tblformalparameter.Description;
            tblformalparameter.Extensible      = _tblformalparameter.Extensible;
            tblformalparameter.oIndex          = _tblformalparameter.oIndex;
            tblformalparameter.PinID           = _tblformalparameter.PinID;
            tblformalparameter.PinName         = _tblformalparameter.PinName;
            tblformalparameter.Type            = _tblformalparameter.Type;
            tblformalparameter.InitializeValue = _tblformalparameter.InitializeValue;
            _Visible = _visible;

            //_oIndex = _oindex;
            //_PinName = _pinname;
            //_Type = _type;
            //_Class = _class;
            //_Visible = _visible;
            //_Extensible = _extensible;
        }
Exemplo n.º 6
0
        public override bool Load(object obj)
        {
            base.Load(obj);
            bool ret = false;

            //tblfbdblock = (tblFBDBlock)obj;
            //this.SqlTableID = tblfbdblock.FBDBlockID;
            NewObject = false;
            string initstr      = "";
            string pinshowState = "";

            //IsObject = tblfbdblock.ISObject;
            //_isextendedproperty = tblfbdblock.IsExtendedProperty;
            ExtendedPropertyTXT   = tblfbdblock.ExtendedPropertyTXT;
            tblvariable.VarNameID = tblfbdblock.VarNameID;
            tblvariable.Select();
            string typname = tblSolution.m_tblSolution().GetFunctionFromType(tblvariable.Type).FunctionName;

            if (!tblfbdblock.ISObject)
            {
                tblformalparameter = new tblFormalParameter(tblSolution.m_tblSolution().GetFunctionFromName(typname).GetFormalParameterFromName(tblfbdblock.PinName));
            }
            else
            {
                tblformalparameter = null;
            }
            //tblformalparameter.PinName = tblfbdblock.PinName;
            //tblformalparameter.Select();
            initstr      = tblvariable.InitialVal;
            pinshowState = tblvariable.PinState;
            //int i = 0;

            //FunctionWidth = tblfunction.Width;
            Initalize(tblfbdblock.X, tblfbdblock.Y);
            GenerateGraphic();
            Dirty = false;

            return(ret);
        }
Exemplo n.º 7
0
 public void Fill(tblVariable _tblvariable, tblFormalParameter _tblformalparameter)
 {
     tblvariable        = _tblvariable;
     tblformalparameter = _tblformalparameter;
     //Operand.Index = _tblvariable.VarNameID;
 }
Exemplo n.º 8
0
        public void AddFormalParameter(string filename)
        {
            if (MainForm.Instance().CurrentUser.LogicExplorer != (int)EXPLORER_ACCESS.Full)
            {
                System.Windows.Forms.MessageBox.Show("current user cannot add any Contrller");
            }
            if (!File.Exists(filename))
            {
                DCS.Forms.MainForm.Instance().WriteToOutputWindows("File " + filename + " does not exist");
                return;
            }
            int                ret = 0;
            string             str;
            string             _log            = "";
            int                FunctionNameCol = -1;
            string             functionname;
            bool               headerline = true;
            tblFunction        tblfunction;
            tblFormalParameter tblformalparameter = new tblFormalParameter();

            using (StreamReader reader = new StreamReader(filename))
            {
                while ((str = reader.ReadLine()) != null)
                {
                    str.Replace(",,", ", ,");
                    if (str.StartsWith("!"))
                    {
                        continue;
                    }
                    if (headerline)
                    {
                        tblformalparameter.headerString = str;
                        headerline      = false;
                        FunctionNameCol = tblformalparameter.ColumnExistInHeader("FunctionName");
                        if (FunctionNameCol == -1)
                        {
                            DCS.Forms.MainForm.Instance().WriteToOutputWindows("Formalparameter add error: FunctionName column does not exist in " + filename);
                            break;
                        }
                    }
                    else
                    {
                        tblformalparameter = new tblFormalParameter();
                        string[] _strs = str.Split(new Char[] { ',' });
                        functionname = _strs[FunctionNameCol].ToLower();
                        tblfunction  = tblSolution.m_tblSolution().functionbyName[functionname.ToUpper()];
                        if (tblfunction != null)
                        {
                            tblformalparameter.AddFromString(_strs, functionname, ref _log);
                            tblformalparameter.FunctionID = tblSolution.m_tblSolution().functionbyName[functionname.ToUpper()].FunctionID;;
                            if ((ret = tblformalparameter.Insert()) != 0)
                            {
                                if (ret == 19)
                                {
                                    DCS.Forms.MainForm.Instance().WriteToOutputWindows(_log + " Already exist in database");
                                }
                            }
                            else
                            {
                                tblfunction.m_tblFormalParameterCollection.Add(tblformalparameter);
                            }
                        }
                        else
                        {
                            DCS.Forms.MainForm.Instance().WriteToOutputWindows("Function Name " + functionname + " doesn't exist in database");
                        }
                    }
                }
                reader.Close();
            }
        }
Exemplo n.º 9
0
        void RowExistIntblFormalparamter(string pinname, string pindescription, string pintype, string pinclass, string pininitialvalue, ref int oIndex)
        {
            foreach (tblFormalParameter tblformalparameter in _tblfunction.m_tblFormalParameterCollection)
            {
                if (tblformalparameter.PinName.ToUpper() == pinname.ToUpper())
                {
                    tblformalparameter.Description = pindescription;
                    tblformalparameter.Type        = (int)tblSolution.m_tblSolution().functionbyName[pintype.ToUpper()].Type;
                    if (pinclass == "Input")
                    {
                        tblformalparameter.Class     = (int)VarClass.Input;
                        tblformalparameter.Reference = false;
                    }
                    if (pinclass == "InOut")
                    {
                        tblformalparameter.Class     = (int)VarClass.InOut;
                        tblformalparameter.Reference = false;
                    }
                    if (pinclass == "Reference")
                    {
                        tblformalparameter.Class     = (int)VarClass.Input;
                        tblformalparameter.Reference = true;
                    }
                    if (pinclass == "Output")
                    {
                        tblformalparameter.Class     = (int)VarClass.Output;
                        tblformalparameter.Reference = false;
                    }
                    if (pinclass == "Local")
                    {
                        tblformalparameter.Class     = (int)VarClass.Local;
                        tblformalparameter.Reference = false;
                    }
                    tblformalparameter.InitializeValue = pininitialvalue;
                    tblformalparameter.oIndex          = oIndex++;
                    tblformalparameter.Update();

                    return;
                }
            }

            {
                tblFormalParameter tblformalparameter = new tblFormalParameter();
                tblformalparameter.FunctionID = _tblfunction.FunctionID;
                tblformalparameter.PinName    = pinname.ToUpper();

                tblformalparameter.Description = pindescription;
                tblformalparameter.Type        = (int)tblSolution.m_tblSolution().functionbyName[pintype.ToUpper()].Type;
                if (pinclass == "Input")
                {
                    tblformalparameter.Class     = (int)VarClass.Input;
                    tblformalparameter.Reference = false;
                }
                if (pinclass == "InOut")
                {
                    tblformalparameter.Class     = (int)VarClass.InOut;
                    tblformalparameter.Reference = false;
                }
                if (pinclass == "Reference")
                {
                    tblformalparameter.Class     = (int)VarClass.Input;
                    tblformalparameter.Reference = true;
                }
                if (pinclass == "Output")
                {
                    tblformalparameter.Class     = (int)VarClass.Output;
                    tblformalparameter.Reference = false;
                }
                if (pinclass == "Local")
                {
                    tblformalparameter.Class     = (int)VarClass.Local;
                    tblformalparameter.Reference = false;
                }
                tblformalparameter.InitializeValue = pininitialvalue;
                tblformalparameter.oIndex          = oIndex++;
                tblformalparameter.Insert();
            }
            _tblfunction.m_tblFormalParameterCollection = null;
        }
Exemplo n.º 10
0
 public void AddOutputPin(tblFormalParameter _tblformalparameter, bool _visible)
 {
     PinCollectionOutput.Add(new FBDObjectPin(this, _tblformalparameter, _visible));
 }
Exemplo n.º 11
0
 public FBDPin(tblFormalParameter _tblformalparameter, int _pinno)
 {
     _isobject          = false;
     tblformalparameter = new tblFormalParameter(_tblformalparameter);
     _PinNo             = _pinno;
 }
Exemplo n.º 12
0
        public bool IsVariable(string _fcsname, string _pouname, string _variablename, string _propertyname, ref tblVariable _tblvariable, ref tblFormalParameter _tblformalparameter)
        {
            string tempstr = "";
            int    count   = 0;


            foreach (tblController tblcontroller in m_tblControllerCollection)
            {
                if (tblcontroller.ControllerName.ToLower() == _fcsname)
                {
                    if (tblcontroller.IsVariable(_pouname, _variablename, _propertyname, ref _tblvariable, ref _tblformalparameter))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(false);
        }