コード例 #1
0
ファイル: MainViewModel.cs プロジェクト: JoeGilkey/RadioLog
 private void ProcessSourceGroupChange(Common.SignalSourceGroupChangeHolder info)
 {
     if (_viewStatus != null && _viewStatus.View != null && !(_viewStatus.View as DispatcherObject).Dispatcher.CheckAccess())
     {
         (_viewStatus.View as DispatcherObject).Dispatcher.BeginInvoke(new SourceGroupChangeDelegate(ProcessSourceGroupChange), info);
     }
     else
     {
         BaseSourceModel src = null;
         foreach (SourceGroupModel grp in _signalGroups)
         {
             BaseSourceModel tmp = grp.SignalSources.FirstOrDefault(s => s.SignalSourceId == info.SignalSourceId);
             if (tmp != null)
             {
                 src = tmp;
                 grp.SignalSources.Remove(tmp);
                 break;
             }
         }
         if (src != null)
         {
             SourceGroupModel grp = _signalGroups.FirstOrDefault(g => g.GroupId == info.NewGroupId);
             if (grp != null && grp.SignalSources.FirstOrDefault(s => s.SignalSourceId == info.SignalSourceId) == null)
             {
                 grp.AddSignalSourceModelToList(src);
             }
         }
     }
 }
コード例 #2
0
 public void AddSignalSourceModelToList(BaseSourceModel processor)
 {
     if (processor == null)
     {
         return;
     }
     _signalSources.Add(processor);
     if (!processor.IsRunning)
     {
         processor.Start();
     }
     processor.IsMuted   = this.GroupMuted;
     processor.GroupInfo = this.GroupInfo;
     _signalSources.Sort();
 }
コード例 #3
0
        private BaseSourceModel GetProcessorForStreamingSource(Common.SignalSource src)
        {
            if (src == null)
            {
                return(null);
            }
            BaseSourceModel processor = null;

            switch (src.SourceType)
            {
            case Common.SignalingSourceType.Streaming: processor = new StreamingSourceModel(src, _groupInfo); break;

            case Common.SignalingSourceType.WaveInChannel: processor = new WaveInChannelSourceModel(src, _groupInfo); break;
            }
            return(processor);
        }
コード例 #4
0
        public bool ProcessRefreshSignalSource(Guid id)
        {
            bool            bDone        = false;
            BaseSourceModel curProcessor = _signalSources.FirstOrDefault(s => s.SignalSourceId == id && s.ParentSourceId == null);

            Common.SignalSource src = Common.AppSettings.Instance.SignalSources.FirstOrDefault(s => s.SourceId == id);
            if (src != null && curProcessor != null)
            {
                curProcessor.DoRefreshSource();
                bDone = true;
                _signalSources.Sort();

                ProcessRefreshSubItems(curProcessor);
            }
            return(bDone);
        }
コード例 #5
0
        public void AddSignalSourceToList(Common.SignalSource src)
        {
            BaseSourceModel primarySrc = GetProcessorForStreamingSource(src);

            if (primarySrc != null)
            {
                AddSignalSourceModelToList(primarySrc);
                //sub-items...
                BaseSourceModel[] subSources = primarySrc.GetSubSourceModels();
                if (subSources != null)
                {
                    foreach (BaseSourceModel subSrc in subSources)
                    {
                        AddSignalSourceModelToList(subSrc);
                    }
                }
            }
        }
コード例 #6
0
 private void ProcessRefreshSubItems(BaseSourceModel curProcessor)
 {
     if (curProcessor == null || !curProcessor.SupportsSubSources)
     {
         return;
     }
     BaseSourceModel[] curSubSources = _signalSources.Where(s => s.ParentSourceId == curProcessor.SignalSourceId).ToArray();
     BaseSourceModel[] cfgSubSources = curProcessor.GetSubSourceModels();
     if (curSubSources == null || curSubSources.Length <= 0)
     {
         return;
     }
     if (cfgSubSources == null || cfgSubSources.Length <= 0)
     {
         foreach (BaseSourceModel subSrc in curSubSources)
         {
             _signalSources.Remove(subSrc);
         }
     }
     else
     {
         foreach (BaseSourceModel subSrc in curSubSources)
         {
             if (!cfgSubSources.Contains(subSrc))
             {
                 _signalSources.Remove(subSrc);
             }
         }
         foreach (BaseSourceModel cgfSrc in cfgSubSources)
         {
             if (!_signalSources.Contains(cgfSrc))
             {
                 _signalSources.Add(cgfSrc);
             }
         }
     }
     _signalSources.Sort();
     foreach (BaseSourceModel subSrc in _signalSources)
     {
         subSrc.DoRefreshSource();
     }
     curProcessor.DoRefreshVisuals();
 }
コード例 #7
0
ファイル: MainViewModel.cs プロジェクト: JoeGilkey/RadioLog
        public void ReorderAll()
        {
            int iFeedSortOrder = 10;

            for (int i = 0; i < _signalGroups.Count; i++)
            {
                SourceGroupModel grp = _signalGroups[i];
                grp.DisplayOrder = iFeedSortOrder;
                iFeedSortOrder  += 10;
                for (int j = 0; i < grp.SignalSources.Count; j++)
                {
                    BaseSourceModel src = grp.SignalSources[i];
                    src.DisplayOrder = iFeedSortOrder;
                    iFeedSortOrder  += 10;
                }

                grp.SignalSources.RaiseCollectionChanged();
            }

            this.SignalGroups.RaiseCollectionChanged();

            Common.AppSettings.Instance.SaveSettingsFile();
        }