/**********************************************************************************************//** * Event handler. Called by Button_PresentedSources_List for click events. * * \author Ilan Hindy * \date 16/01/2017 * * \param sender Source of the event. * \param e Routed event information. **************************************************************************************************/ private void Button_PresentedSources_List_Click(object sender, RoutedEventArgs e) { // Retrieve all senders to list List <string> senders = ListBox_Messages.Items.Cast <ListBoxItem>().ToList() .Select(item => SenderOfItem(item)) .ToList().Distinct().ToList(); // Select the senders to present SelectDialog selectDialog = new SelectDialog("Select the sources", "DebugWindow Window Select Source", senders, null, null, SelectionMode.Multiple); selectDialog.ShowDialog(); if (selectDialog.Result == SelectDialog.SelectDialogResult.Quit) { return; } // Set the presentedSenders according to the selected presentedSenders = senders.Select((s, idx) => new { s, idx }). Where(p => selectDialog.Selection.IndexOf(p.idx) > -1). Select(p => p.s).ToList(); // presented sender status only messages from the selected senders will be shown presentedSenderStatus = PresentedSenderStatus.Filtered; // Refresh the presentation NewPresentedSendersSelected(); }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// \fn private BaseMessage CreateDefaultMessage() /// /// \brief Creates default message. /// /// \par Description. /// /// \par Algorithm. /// /// \par Usage Notes. /// /// \author Ilanh /// \date 04/07/2017 /// /// \return The new default message. //////////////////////////////////////////////////////////////////////////////////////////////////// private BaseMessage CreateDefaultMessage() { /* * Select the source process */ List <BaseProcess> sourceProcesses = new List <BaseProcess>(); networkElements[0].Network.Processes.ForEach(process => { if (networkElements[0] != process) { sourceProcesses.Add(process); } }); List <string> sourceProcessesNames = new List <string>(); sourceProcesses.ForEach(process => sourceProcessesNames.Add(process.ToString())); SelectDialog sourceProcessSelectDialog = new SelectDialog("Select the source process of the message ", "Source process select dialog", sourceProcessesNames); sourceProcessSelectDialog.ShowDialog(); BaseProcess sourceProcess = sourceProcesses[sourceProcessSelectDialog.Selection[0]]; BaseChannel sendingChannel = sourceProcess.OutGoingChannels.First(channel => channel.ea[bc.eak.DestProcess] == networkElements[0].ea[ne.eak.Id]); BaseMessage message = new BaseMessage(networkElements[0].Network, bm.MessageTypes.EmptyMessage, sendingChannel, "", 0, 0); return(message); }