public string Set_Reset_Bool(string BoolName, Boolean BoolValue)
        {
            ABB_Data_Write Write        = new ABB_Data_Write();
            string         _infomessage = "";

            try
            {
                tasks = controller.Rapid.GetTasks();
                using (Mastership m = Mastership.Request(this.controller.Rapid))
                {
                    //Check if the user has the rights to execute RAPID program
                    if (uas.CheckDemandGrant(Grant.ModifyRapidDataValue))
                    {
                        //Modify the rapid value
                        Write.Write_ABB_Boolean(BoolName, "mMain", "T_MAIN", controller, BoolValue);
                        return(_infomessage);
                    }
                    else
                    {
                        return(_infomessage);
                    }
                }
            }
            catch (System.InvalidOperationException ex)
            {
                return(_infomessage = "Mastership is held by another client." + ex.Message);
            }
            catch (System.Exception ex)
            {
                return(_infomessage = "Unexpected error occurred: " + ex.Message);
            }
        }
        public string Write_Record_In_Array(int[] Parameters, int Individual_Index)
        {
            ABB_Data_Write Write_DataRecord  = new ABB_Data_Write();
            string         _infomessage      = "";
            List <string>  _StringParameters = new List <string>();

            int[] _Parameters = Parameters;


            //Write the parameters to the string list
            for (int i = 0; i <= 4; i++)
            {
                _StringParameters.Add(_Parameters[i].ToString());
            }
            try
            {
                using (Mastership m = Mastership.Request(controller.Rapid))
                {
                    //Check if the user has the rights to execute RAPID program
                    if (uas.CheckDemandGrant(Grant.ModifyRapidDataValue))
                    {
                        //Modify the rapid record
                        Write_DataRecord.Write_ABB_DataRecord("RawIndividual", "mMain", "T_MAIN", controller, _StringParameters, Individual_Index);
                        _infomessage = "Data written succesfully";
                        return(_infomessage);
                    }
                    else
                    {
                        return(_infomessage = "You do not have the grant to modify RAPID Data");
                    }
                }
            }

            catch (System.NullReferenceException ex)
            {
                return(_infomessage = "No data in the user defined data type or not logged in a controller");
            }
        }