Beispiel #1
0
        /// <summary>
        /// Rimuove un gruppo di bottoni dall'editor
        /// </summary>
        /// <param name="RDE">L'editor da cui togliere i bottoni</param>
        /// <param name="GroupName">Il nome del gruppo da togliere</param>
        /// <remarks></remarks>

        public static void RemoveGroup(ref Telerik.Web.UI.RadEditor editor, GroupName groupName)
        {
            //If Not ToolsLoaded Then
            editor.EnsureToolsFileLoaded();
            //ToolsLoaded = True
            //End If

            List <Telerik.Web.UI.EditorToolGroup> DelGroups = new List <Telerik.Web.UI.EditorToolGroup>();

            foreach (Telerik.Web.UI.EditorToolGroup @group in editor.Tools)
            {
                if ((@group != null) && @group.Tag == groupName.ToString())
                {
                    DelGroups.Add(@group);
                }
            }

            if ((DelGroups != null) && DelGroups.Count > 0)
            {
                foreach (Telerik.Web.UI.EditorToolGroup @group in DelGroups)
                {
                    if ((@group != null))
                    {
                        editor.Tools.Remove(@group);
                    }
                }
            }
        }
Beispiel #2
0
        public bool SyncWrite(GroupName enumGrp, ItemName[] enumArryItem, int[] arrWriteVal)
        {
            bool   bResult;
            string strGrp = enumGrp.ToString();
            var    grp    = opcResultsDic[strGrp];

            int[]    arrHandle = new int[enumArryItem.Length];
            object[] arrObj    = new object[enumArryItem.Length];
            int[]    arrErr;
            for (int i = 0; i < enumArryItem.Length; i++)
            {
                string strItem = enumArryItem[i].ToString();
                arrHandle[i] = grp[strItem].HandleServer;
                arrObj[i]    = arrWriteVal[i];
            }

            try
            {
                bResult = opcGrpsDic[strGrp].SyncWrite(arrHandle, arrObj, out arrErr);
            }
            catch (Exception)
            {
                bResult = false;
            }
            return(bResult);
        }
Beispiel #3
0
        public bool SyncRead(GroupName enumGrp, ItemName[] enumArryItem, out bool[] arrResult)
        {
            bool   bResult;
            string strGrp = enumGrp.ToString();
            var    grp    = opcResultsDic[strGrp];

            arrResult = new bool[enumArryItem.Length];
            int[] arrHandle = new int[enumArryItem.Length];
            for (int i = 0; i < enumArryItem.Length; i++)
            {
                string strItem = enumArryItem[i].ToString();
                arrHandle[i] = grp[strItem].HandleServer;
            }

            OPCItemState[] arrState = new OPCItemState[enumArryItem.Length];

            try
            {
                bResult = opcGrpsDic[strGrp].SyncRead(OPCDATASOURCE.OPC_DS_DEVICE, arrHandle, out arrState);
            }
            catch (Exception)
            {
                bResult = false;
            }

            for (int i = 0; i < arrState.Length; i++)
            {
                arrResult[i] = (bool)arrState[i].DataValue;
            }

            return(bResult);
        }
Beispiel #4
0
        public override string ToString()
        {
            var result = new StringBuilder();

            result.AppendLine("GROUP: " + GroupName.ToString());
            foreach (var item in teams)
            {
                result.AppendLine(item.TeamName.ToString());
            }

            return(result.ToString());
        }
Beispiel #5
0
        public bool SyncRead(GroupName enumGrp, ItemName enumItem, out bool iResult)
        {
            bool   bExec;
            string strGrp = enumGrp.ToString();

            int[]          arrHandle = new int[] { opcResultsDic[strGrp][enumItem.ToString()].HandleServer };
            OPCItemState[] arrState  = new OPCItemState[1];

            try
            {
                bExec = opcGrpsDic[strGrp].SyncRead(OPCDATASOURCE.OPC_DS_DEVICE, arrHandle, out arrState);
            }
            catch (Exception ee)
            {
                bExec = false;
                LogImpl.Debug("plc错误:" + ee.ToString());
            }

            iResult = (bool)arrState[0].DataValue;
            return(bExec);
        }
Beispiel #6
0
        public bool SyncWrite(GroupName enumGrp, ItemName enumItem, int iWriteVal)
        {
            bool   bExec;
            string strGrp = enumGrp.ToString();

            int[] arrErr = new int[1];
            try
            {
                int[]    arrHandle = { _opcResultsDic[strGrp][enumItem.ToString()].HandleServer };
                object[] arrObj    = new object[] { iWriteVal };
                bExec = _opcGrpsDic[strGrp].SyncWrite(arrHandle, arrObj, out arrErr);
            }
            catch (Exception ex)
            {
                bExec = false;
            }
            if (arrErr[0] == 1)
            {
                bExec = false;
            }
            return(bExec);
        }
        protected void ShowByGroupBtn_Click(object sender, EventArgs e)
        {
            GroupName groupName = GroupName.Group1;

            foreach (GroupName gr in Enum.GetValues(typeof(GroupName)))
            {
                if (gr.ToString() == GroupList.SelectedItem.Value)
                {
                    groupName = gr;
                }
            }
            String url;

            if (Request.Url.AbsoluteUri.Contains("?"))
            {
                url = Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.IndexOf('?')) + "?group=" + groupName.ToString();
            }
            else
            {
                url = Request.Url.AbsoluteUri + "?group=" + groupName.ToString();
            }
            Response.Redirect(url);
        }
Beispiel #8
0
 /// <summary>
 /// Return a text representation of this object.
 /// </summary>
 public override String ToString()
 => String.Concat(nameof(TelegramGroupNotification), ": ", GroupName.ToString());
Beispiel #9
0
        /// <summary>
        /// Aggiunge un bottone
        /// </summary>
        /// <param name="RDE">L'editor a cui aggiungere il bottone</param>
        /// <param name="ButtonName">Il nome del bottone</param>
        /// <param name="GroupName">Il nome del gruppo a cui aggiungere il bottone</param>
        /// <remarks>Se il gruppo non c'è, verra ricreato</remarks>

        public static void AddButton(ref Telerik.Web.UI.RadEditor editor, ToolsName buttonName, GroupName groupName)
        {
            //If Not ToolsLoaded Then
            editor.EnsureToolsFileLoaded();
            //ToolsLoaded = True
            //End If

            bool found = false;

            foreach (Telerik.Web.UI.EditorToolGroup @group in editor.Tools)
            {
                if ((@group != null) && ((groupName == GroupName._ALL) || @group.Tag == groupName.ToString() || (string.IsNullOrEmpty(@group.Tag) && groupName == GroupName._VOID)))
                {
                    found = true;
                    Telerik.Web.UI.EditorTool tool = null;
                    try {
                        tool = @group.FindTool(buttonName.ToString());
                    } catch (Exception ex) {
                    }

                    if ((tool == null))
                    {
                        tool      = new Telerik.Web.UI.EditorTool();
                        tool.Name = buttonName.ToString();
                        //tool.ShortCut = "CTRL+B"
                        @group.Tools.Add(tool);
                    }
                }
            }

            if (!found)
            {
                Telerik.Web.UI.EditorToolGroup NewGroup = new Telerik.Web.UI.EditorToolGroup();
                editor.Tools.Add(NewGroup);
                Telerik.Web.UI.EditorTool Tool = new Telerik.Web.UI.EditorTool();
                Tool.Name = buttonName.ToString();
                NewGroup.Tools.Add(Tool);
            }
        }
Beispiel #10
0
        /// <summary>
        /// Rimuove il bottone
        /// </summary>
        /// <param name="RDE">L'editor da cui togliere il bottone</param>
        /// <param name="ButtonName">Il nome del bottone</param>
        /// <param name="GroupName">Il gruppo da cui eleminare il bottone</param>
        /// <remarks></remarks>

        public static void RemoveButton(ref Telerik.Web.UI.RadEditor editor, ToolsName buttonName, GroupName groupName)
        {
            //If Not ToolsLoaded Then
            editor.EnsureToolsFileLoaded();
            //ToolsLoaded = True
            //End If

            List <Telerik.Web.UI.EditorToolGroup> DelGroups = new List <Telerik.Web.UI.EditorToolGroup>();

            foreach (Telerik.Web.UI.EditorToolGroup @group in editor.Tools)
            {
                if ((@group != null) && ((groupName == GroupName._ALL) || @group.Tag == groupName.ToString() || (string.IsNullOrEmpty(@group.Tag) && groupName == GroupName._VOID)))
                {
                    Telerik.Web.UI.EditorTool tool = null;
                    try {
                        tool = @group.FindTool(buttonName.ToString());
                    } catch (Exception ex) {
                    }

                    if ((tool != null))
                    {
                        try {
                            @group.Tools.Remove(tool);
                        } catch (Exception ex) {
                        }
                    }

                    if (@group.Tools.Count <= 0)
                    {
                        DelGroups.Add(@group);
                    }
                }
            }

            if ((DelGroups != null) && DelGroups.Count > 0)
            {
                foreach (Telerik.Web.UI.EditorToolGroup @group in DelGroups)
                {
                    if ((@group != null))
                    {
                        editor.Tools.Remove(@group);
                    }
                }
            }
        }
Beispiel #11
0
 public override string ToString()
 {
     return("Author : " + Name + " GroupName : " + GroupName.ToString());
 }
        public async Task SchedulerStartAsync <T>(ITrigger trigger, GroupName groupName, string jobDetailName) where T : IJob
        {
            if (Scheduler == null)
            {
                CreateScheduler();
            }

            IJobDetail jobDetail = JobBuilder.Create <T>().WithIdentity(jobDetailName, groupName.ToString()).Build();
            //将任务与触发器添加到调度器中
            await Scheduler.ScheduleJob(jobDetail, trigger);

            //开始执行
            await Scheduler.Start();
        }
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="trigger"></param>
        /// <param name="groupName"></param>
        public void SchedulerStart <T>(ITrigger trigger, GroupName groupName) where T : IJob
        {
            if (Scheduler == null)
            {
                CreateScheduler();
            }

            IJobDetail jobDetail = JobBuilder.Create <T>().WithIdentity(typeof(T).Name, groupName.ToString()).Build();

            //将任务与触发器添加到调度器中
            Scheduler.ScheduleJob(jobDetail, trigger);
            //开始执行
            Scheduler.Start();
        }