//Metodo barbaro per calcolare i nodi coinvolti nel percorso anche in caso di biforcazioni private List <string> BackTrace(IComputableWorkflow WF, string checkPointNode) { List <string> backNodes = new List <string>(); while (!WF.IsInitialState())//backtrace dal nodo corrente { backNodes.Add(WF.GetState().Name); WF.ComputeNewStatus(WFeventType.ROLLBACK, null, null); //nodePlaceHolder.ResetStates(); presenPanel2.Controls.Clear(); presenPanel2.Visible = false; //renderNode(workflow.GetState()); //nodePlaceHolder.ResetStates(); //nodePlaceHolder.Controls.Clear(); presenPanel.Controls.Clear(); renderNode(workflow.GetState()); } backNodes.Add(WF.GetState().Name); WFnode curr = WF.GetState(); while (curr.Name != checkPointNode)//riporta il workflow allo stato corrente { WFnode actual = workflow.GetState(); XmlDocument doc = new XmlDocument(); doc.LoadXml(actual.GetValue(nodePlaceHolder.Controls[0], actual.GetRenderingDocument().DocumentElement.FirstChild)); ActionResult ar = workflow.ComputeNewStatus(WFeventType.TRYGOON, doc, ValidationEventHandler); curr = WF.GetState(); //nodePlaceHolder.ResetStates(); //nodePlaceHolder.Controls.Clear(); presenPanel.Controls.Clear(); renderNode(workflow.GetState()); } return(backNodes); }
protected void forward_Click(object sender, EventArgs e) { bool final = workflow.IsFinalState(); WFnode actual = workflow.GetState(); XmlDocument doc = new XmlDocument(); doc.LoadXml(actual.GetValue(/*nodePlaceHolder.Controls[0]*/ presenPanel.Controls[0], actual.GetRenderingDocument().DocumentElement.FirstChild)); ActionResult ar = workflow.ComputeNewStatus(WFeventType.TRYGOON, doc, ValidationEventHandler); if (ar.OK && !final) { //nodePlaceHolder.ResetStates(); //nodePlaceHolder.Controls.Clear(); presenPanel.Controls.Clear(); WFnode currentNode = workflow.GetState(); renderNode(currentNode); /////////////////////////////////HISTORY////////////////////////////////////////////////////////////////// UpdateHistory(currentNode, ar); /////////////////////////////////HISTORY////////////////////////////////////////////////////////////////// } else if (ar.OK && final) { //nodePlaceHolder.ResetStates(); //nodePlaceHolder.Controls.Clear(); presenPanel.Controls.Clear(); //nodePlaceHolder.Controls.Add(new Panel());//To not handle generic error dialog presenPanel.Controls.Add(new Panel()); presenPanel2.Visible = true; forward.Visible = false; save.Visible = true; XmlDocument xd = workflow.GetCollectedDocument(); xd.Schemas = workflow.GetCollectedDocumentSchemas(); xd.Validate(null);//bug XmlNodeList ln = xd.ChildNodes[1].ChildNodes; IEnumerable <WFnode> nodeList = workflow.getNodeList(); foreach (XmlNode xnd in ln) { foreach (WFnode wfn in nodeList) { if (wfn.Name == XmlConvert.DecodeName(xnd.Name)) { renderFinal(wfn, xnd); } } } presenPanel3.Controls.Clear(); } else { /*It remains here...but someone should say him that there is no edge or his input doesn't validate*/ WFnode currentNode = workflow.GetState(); UpdateHistory(currentNode, ar); } }