private void ProcessRefreshSignalSource(Guid id) { if (_viewStatus != null && _viewStatus.View != null && !(_viewStatus.View as DispatcherObject).Dispatcher.CheckAccess()) { (_viewStatus.View as DispatcherObject).Dispatcher.BeginInvoke(new SignalSourceChangeDelegate(ProcessRefreshSignalSource), id); } else { bool bDone = false; foreach (SourceGroupModel mdl in _signalGroups) { bDone |= mdl.ProcessRefreshSignalSource(id); if (bDone) { break; } } if (!bDone) { foreach (SourceGroupModel mdl in _signalGroups) { mdl.ProcessRemoveSignalSource(id); } Common.SignalSource src = Common.AppSettings.Instance.SignalSources.FirstOrDefault(s => s.SourceId == id); if (src != null) { ProcessNewSignalSource(src); } } } }
private void ProcessNewSignalSource(Common.SignalSource newSrc) { if (_viewStatus != null && _viewStatus.View != null && !(_viewStatus.View as DispatcherObject).Dispatcher.CheckAccess()) { (_viewStatus.View as DispatcherObject).Dispatcher.BeginInvoke(new NewSignalSourceDelegate(ProcessNewSignalSource), newSrc); } else { AddSignalSourceToList(newSrc); } }
protected BaseSourceModel(Common.SignalSource src, Common.SignalGroup group) { if (src == null) { throw new ArgumentNullException(); } _src = src; _group = group; Cinch.Mediator.Instance.RegisterHandler <bool>("REFRESH_VISUALS", (b) => { DoRefreshVisuals(); }); }
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); }
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); }
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); } } } }
private void AddSignalSourceToList(Common.SignalSource src) { SourceGroupModel grp = null; if (Common.AppSettings.Instance.UseGroups) { grp = _signalGroups.FirstOrDefault(g => g.GroupId == src.GroupId); } else { grp = _signalGroups.FirstOrDefault(g => g.GroupId == Guid.Empty); } if (grp != null) { grp.AddSignalSourceToList(src); _signalGroups.Sort(); } }
public WaveInChannelSourceModel(Common.SignalSource src, Common.SignalGroup group) : base(src, group) { }
private void btnOk_Click(object sender, RoutedEventArgs e) { if (!VerifySourceInputs()) return; string colorName = string.Empty; if (cbSourceColor.SelectedIndex > 0) { colorName = cbSourceColor.SelectedValue as string; } int displayOrder = (int)sDisplayOrder.Value; RadioLog.Common.SignalSource newSrc = null; switch (SelectedSourceType) { case Common.SignalingSourceType.File: { //newSrc.SourceURL break; } case Common.SignalingSourceType.WaveInChannel: { newSrc = new Common.SignalSource() { SourceName = tbSourceName.Text, SourceType = Common.SignalingSourceType.WaveInChannel, IsEnabled = true, SourceLocation = _channelList[cbMultiLineIn.SelectedIndex].DeviceName, SourceChannel = ((int)(nudChannelNumber.Value ?? 1) - 1) }; break; } case Common.SignalingSourceType.Streaming: { string url; if (GetCorrectedStreamURL(tbStreamURL.Text, out url)) { newSrc = new Common.SignalSource() { SourceName = tbSourceName.Text, SourceType = Common.SignalingSourceType.Streaming, IsEnabled = true, SourceLocation = url }; } break; } } if (newSrc != null) { newSrc.SourceColor = colorName; newSrc.DisplayOrder = displayOrder; newSrc.NoiseFloor = Common.NoiseFloor.Normal; newSrc.CustomNoiseFloor = 20; newSrc.RemoveNoise = true; newSrc.Volume = 50; newSrc.MaxVolume = 100; if (cbGroup.SelectedValue != null) newSrc.GroupId = (Guid)cbGroup.SelectedValue; RadioLog.Common.AppSettings.Instance.AddNewSignalSource(newSrc); Cinch.Mediator.Instance.NotifyColleagues<RadioLog.Common.SignalSource>("NEW_SIGNAL_SOURCE", newSrc); DialogResult = true; } }
public StreamingSourceModel(Common.SignalSource src, Common.SignalGroup group) : base(src, group) { }
private void btnOk_Click(object sender, RoutedEventArgs e) { if (!VerifySourceInputs()) { return; } string colorName = string.Empty; if (cbSourceColor.SelectedIndex > 0) { colorName = cbSourceColor.SelectedValue as string; } int displayOrder = (int)sDisplayOrder.Value; RadioLog.Common.SignalSource newSrc = null; switch (SelectedSourceType) { case Common.SignalingSourceType.File: { //newSrc.SourceURL break; } case Common.SignalingSourceType.WaveInChannel: { newSrc = new Common.SignalSource() { SourceName = tbSourceName.Text, SourceType = Common.SignalingSourceType.WaveInChannel, IsEnabled = true, SourceLocation = _channelList[cbMultiLineIn.SelectedIndex].DeviceName, SourceChannel = ((int)(nudChannelNumber.Value ?? 1) - 1) }; break; } case Common.SignalingSourceType.Streaming: { string url; if (GetCorrectedStreamURL(tbStreamURL.Text, out url)) { newSrc = new Common.SignalSource() { SourceName = tbSourceName.Text, SourceType = Common.SignalingSourceType.Streaming, IsEnabled = true, SourceLocation = url }; } break; } } if (newSrc != null) { newSrc.SourceColor = colorName; newSrc.DisplayOrder = displayOrder; newSrc.NoiseFloor = Common.NoiseFloor.Normal; newSrc.CustomNoiseFloor = 20; newSrc.RemoveNoise = true; newSrc.Volume = 50; newSrc.MaxVolume = 100; if (cbGroup.SelectedValue != null) { newSrc.GroupId = (Guid)cbGroup.SelectedValue; } RadioLog.Common.AppSettings.Instance.AddNewSignalSource(newSrc); Cinch.Mediator.Instance.NotifyColleagues <RadioLog.Common.SignalSource>("NEW_SIGNAL_SOURCE", newSrc); DialogResult = true; } }