public async void UpdateContent(double maxFreq, double minFreq, IList <double> channelData, IList <double> spectrum, IList <double> freqs, double avgSpectrum, CoreDispatcher uiDisp) { Debug.WriteLine("Updating RT charts conent"); await uiDisp.RunAsync(CoreDispatcherPriority.Normal, () => { MaxFreqText = $"Max inst frequency = {maxFreq}"; MinFreqText = $"Min inst frequency = {minFreq}"; AvgSpectrumText = $"Avg Hilbert spectrum = {avgSpectrum}"; EnsembleCountText = $"Ensemble count = {DataManager.Current.EnsembleCount}"; //AppendDataSeries(MaxFreqValues, maxFreq); //AppendDataSeries(MinFreqValues, minFreq); AppendDataSeries(AvgSpectrumValues, avgSpectrum); ChannelData.Clear(); for (int i = 0; i < channelData.Count; ++i) { ChannelData.Add(new Point(i, channelData[i])); } ChannelData.NotifyCollectionReset(); SpectrumValues.Clear(); for (int i = 0; i < spectrum.Count; ++i) { SpectrumValues.Add(new Point(freqs[i], spectrum[i])); } SpectrumValues.NotifyCollectionReset(); }); }
/// <summary> /// Shows the detail. /// </summary> /// <param name="communication">The communication.</param> private void ShowDetail(Rock.Model.Communication communication) { CommunicationId = communication.Id; lStatus.Visible = communication.Status != CommunicationStatus.Transient; lRecipientStatus.Visible = communication.Status != CommunicationStatus.Transient; lStatus.Text = string.Format("<span class='label label-communicationstatus-{0}'>{1}</span>", communication.Status.ConvertToString().ToLower().Replace(" ", ""), communication.Status.ConvertToString()); ChannelEntityTypeId = communication.ChannelEntityTypeId; BindChannels(); Recipients.Clear(); communication.Recipients.ToList().ForEach(r => Recipients.Add(new Recipient(r.Person.Id, r.Person.FullName, r.Status))); BindRecipients(); ChannelData = communication.ChannelData; ChannelData.Add("Subject", communication.Subject); ChannelControl control = LoadChannelControl(true); if (control != null && CurrentPerson != null) { control.InitializeFromSender(CurrentPerson); } dtpFutureSend.SelectedDateTime = communication.FutureSendDateTime; ShowActions(communication); }
private void GetTemplateData(int templateId, bool loadControl = true) { var template = new CommunicationTemplateService(new RockContext()).Get(templateId); if (template != null) { var channelData = template.ChannelData; if (!channelData.ContainsKey("Subject")) { channelData.Add("Subject", template.Subject); } foreach (var dataItem in channelData) { if (!string.IsNullOrWhiteSpace(dataItem.Value)) { if (ChannelData.ContainsKey(dataItem.Key)) { ChannelData[dataItem.Key] = dataItem.Value; } else { ChannelData.Add(dataItem.Key, dataItem.Value); } } } if (loadControl) { LoadChannelControl(true); } } }
/// <summary> /// Sets a channel data value. If the key exists, the value will be replaced with the new value, otherwise a new key value pair will be added to dictionary. /// </summary> /// <param name="key">A <see cref="System.String"/> representing the key.</param> /// <param name="value">A <see cref="System.String"/> representing the value.</param> public void SetChannelDataValue(string key, string value) { if (ChannelData.ContainsKey(key)) { ChannelData[key] = value; } else { ChannelData.Add(key, value); } }
/// <summary> /// Gets the channel data. /// </summary> private void GetChannelData() { if (phContent.Controls.Count == 1 && phContent.Controls[0] is ChannelControl) { var channelData = ((ChannelControl)phContent.Controls[0]).ChannelData; foreach (var dataItem in channelData) { if (ChannelData.ContainsKey(dataItem.Key)) { ChannelData[dataItem.Key] = dataItem.Value; } else { ChannelData.Add(dataItem.Key, dataItem.Value); } } } }
/// <summary> /// Shows the detail. /// </summary> /// <param name="communication">The communication.</param> private void ShowDetail(Rock.Model.Communication communication) { Recipients.Clear(); if (communication != null) { this.AdditionalMergeFields = communication.AdditionalMergeFields.ToList(); lTitle.Text = (communication.Subject ?? "New Communication").FormatAsHtmlTitle(); foreach (var recipient in new CommunicationRecipientService(new RockContext()) .Queryable("Person.PhoneNumbers") .Where(r => r.CommunicationId == communication.Id)) { Recipients.Add(new Recipient(recipient.Person, recipient.Status, recipient.StatusNote, recipient.OpenedClient, recipient.OpenedDateTime)); } } else { communication = new Rock.Model.Communication() { Status = CommunicationStatus.Transient }; lTitle.Text = "New Communication".FormatAsHtmlTitle(); int?personId = PageParameter("Person").AsInteger(false); if (personId.HasValue) { communication.IsBulkCommunication = false; var person = new PersonService(new RockContext()).Get(personId.Value); if (person != null) { Recipients.Add(new Recipient(person, CommunicationRecipientStatus.Pending, string.Empty, string.Empty, null)); } } } CommunicationId = communication.Id; ChannelEntityTypeId = communication.ChannelEntityTypeId; BindChannels(); ChannelData = communication.ChannelData; ChannelData.Add("Subject", communication.Subject); if (communication.Status == CommunicationStatus.Transient && !string.IsNullOrWhiteSpace(GetAttributeValue("DefaultTemplate"))) { var template = new CommunicationTemplateService(new RockContext()).Get(GetAttributeValue("DefaultTemplate").AsGuid()); if (template != null && template.ChannelEntityTypeId == ChannelEntityTypeId) { foreach (ListItem item in ddlTemplate.Items) { if (item.Value == template.Id.ToString()) { item.Selected = true; GetTemplateData(template.Id, false); } else { item.Selected = false; } } } } cbBulk.Checked = communication.IsBulkCommunication; ChannelControl control = LoadChannelControl(true); if (control != null && CurrentPerson != null) { control.InitializeFromSender(CurrentPerson); } dtpFutureSend.SelectedDateTime = communication.FutureSendDateTime; ShowStatus(communication); ShowActions(communication); }