Exemplo n.º 1
0
        public void ProcessRemoveSignalSource(Guid id)
        {
            List <BaseSourceModel> srcToRemove = new List <BaseSourceModel>(_signalSources.Where(s => s.SignalSourceId == id).ToArray());

            foreach (BaseSourceModel src in srcToRemove)
            {
                _signalSources.Remove(src);
                src.Stop();
            }
        }
Exemplo n.º 2
0
        private void ProcessGroupDeleted(Guid id)
        {
            List <BaseSourceModel>  sources = new List <BaseSourceModel>();
            List <SourceGroupModel> grps    = new List <SourceGroupModel>();

            foreach (SourceGroupModel grp in _signalGroups.Where(g => g.GroupId == id))
            {
                grps.Add(grp);
                foreach (BaseSourceModel src in grp.SignalSources)
                {
                    sources.Add(src);
                }
            }
            SourceGroupModel dfltGrp = _signalGroups.FirstOrDefault(g => g.GroupId == Guid.Empty);

            if (dfltGrp == null)
            {
                return;
            }
            foreach (BaseSourceModel src in sources)
            {
                src.SrcInfo.GroupId = Guid.Empty;
                src.GroupInfo       = dfltGrp.GroupInfo;
                dfltGrp.SignalSources.Add(src);
            }
            foreach (SourceGroupModel grp in grps)
            {
                _signalGroups.Remove(grp);
            }
            Common.AppSettings.Instance.SaveSettingsFile();
        }