//////////////////////////////////////////////////////////////////////////////////////////////////// /// \fn private bool PerformQuestion(AttributeDictionary entry, List<int> messageIdxs) /// /// \brief Performs the question action. /// /// \par Description. /// - Ask the user if to perform an order change /// - There can be 3 answers /// -# Yes /// -# No /// -# Remove from the list /// /// \par Algorithm. /// /// \par Usage Notes. /// /// \author Ilanh /// \date 27/05/2018 /// /// \param sourceProcess (int) - Source process. /// /// \param entry (List<int>) - The permutations. /// \param messageIdxs (List<int>) - The message idxs. /// /// \return True if it succeeds, false if it fails. /// /// \param MessageQ (AttributeList) - The message q. //////////////////////////////////////////////////////////////////////////////////////////////////// private bool PerformQuestion(AttributeDictionary entry, List <int> messageIdxs) { MessageBoxElementData l1 = new MessageBoxElementData("Message from process : " + Element.ToString(), new Font { alignment = HorizontalAlignment.Center, fontWeight = FontWeights.Bold }); MessageBoxElementData l2 = new MessageBoxElementData("In Previous running of the algorithm the order of the messages was change"); MessageBoxElementData l3 = new MessageBoxElementData("The source process is :" + entry[Comps.SourceProcess].ToString()); MessageBoxElementData l4 = new MessageBoxElementData("The source list is :", new Font { fontWeight = FontWeights.Bold }); List <string> originalContent = new List <string>(); AttributeList messagesQ = entry[Comps.MessageQ]; messagesQ.ForEach(a => originalContent.Add(((BaseMessage)a.Value).Description())); string originalString; string transforedString; PermutationString(entry[Comps.Permutations].AsList(), originalContent, out originalString, out transforedString); MessageBoxElementData l5 = new MessageBoxElementData(originalString); MessageBoxElementData l6 = new MessageBoxElementData("The transformed list is :", new Font { fontWeight = FontWeights.Bold }); MessageBoxElementData l7 = new MessageBoxElementData(transforedString); MessageBoxElementData l8 = new MessageBoxElementData("Do you want to apply this change ?", new Font { fontWeight = FontWeights.Bold }); MessageBoxElementData b1 = new MessageBoxElementData("Yes"); MessageBoxElementData b2 = new MessageBoxElementData("No"); MessageBoxElementData b3 = new MessageBoxElementData("Remove"); string result = MessageRouter.CustomizedMessageBox(new List <MessageBoxElementData> { l1, l2, l3, l4, l5, l6, l7, l8 }, "ChangeMessageOrder Message", new List <MessageBoxElementData> { b1, b2, b3 }, Icons.Question, true); string s = ""; switch (result) { case "Yes": return(true); case "Remove": Remove((Attribute)entry.Parent); return(false); default: return(false); } }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// \fn private string EndDragQuestion() /// /// \brief Ends drag question. /// /// \par Description. /// Ask the user what he wants to do with the change /// /// \par Algorithm. /// /// \par Usage Notes. /// /// \author Ilanh /// \date 27/05/2018 /// /// \return A string. //////////////////////////////////////////////////////////////////////////////////////////////////// private string EndDragQuestion() { MessageBoxElementData l1 = new MessageBoxElementData("The permutation list is :", new Font { fontWeight = FontWeights.Bold, wrap = TextWrapping.NoWrap }); MessageBoxElementData l2 = new MessageBoxElementData("The source list is :", new Font { fontWeight = FontWeights.Bold, wrap = TextWrapping.NoWrap }); string originalString; string transforedString; PresentPermutationEvent(permutations, originalContent, out originalString, out transforedString); MessageBoxElementData l3 = new MessageBoxElementData(originalString, new Font { wrap = TextWrapping.NoWrap }); MessageBoxElementData l4 = new MessageBoxElementData("The transformed list is :", new Font { fontWeight = FontWeights.Bold, wrap = TextWrapping.NoWrap }); MessageBoxElementData l5 = new MessageBoxElementData(transforedString, new Font { wrap = TextWrapping.NoWrap }); MessageBoxElementData l6 = new MessageBoxElementData("What do you want to do?", new Font { fontWeight = FontWeights.Bold, wrap = TextWrapping.NoWrap }); MessageBoxElementData b1 = new MessageBoxElementData("Continue Change", new Font { fontWeight = FontWeights.Bold, wrap = TextWrapping.NoWrap }); MessageBoxElementData b2 = new MessageBoxElementData("Apply"); MessageBoxElementData b3 = new MessageBoxElementData("Quit Change", new Font { fontWeight = FontWeights.Bold, wrap = TextWrapping.NoWrap }); return(MessageRouter.CustomizedMessageBox(new List <MessageBoxElementData> { l1, l2, l3, l4, l5, l6 }, "GridView Message", new List <MessageBoxElementData> { b1, b2, b3 }, Icons.Question, true)); }