private void DrawGraph() { G = new Graph("Graph"); foreach (Entity.State state in items) { Node node = G.AddNode(state.ToString()); if (state == AraSystem.GetInstance().InitState) { node.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.Aquamarine; } if (state.Color.HasValue) { node.Attr.Color = state.Color.Value; } } foreach (Entity.State st in items) { foreach (Entity.Arc arc in st.Arcs) { Edge edge = G.AddEdge(st.ToString(), arc.ToString(), arc.State.ToString()); if (arc.Color.HasValue) { edge.Attr.Color = arc.Color.Value; } } } graphViewer.Graph = G; }
private void loadBtn_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = Application.StartupPath; ofd.Filter = "Ara System (*.ara)|*.ara"; DialogResult dr = ofd.ShowDialog(); if (dr != System.Windows.Forms.DialogResult.OK || ofd.FileName == null) { return; } try { IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read, FileShare.Read); system = (AraSystem)formatter.Deserialize(stream); AraSystem.LoadSystem(system); stream.Close(); fillRulesTable(); displayList(agentsTB, system.Agents.Cast <Entity.SystemItem>().ToList()); displayList(actionsTB, system.Actions.Cast <Entity.SystemItem>().ToList()); displayList(fluentsTB, system.Fluents.Cast <Entity.SystemItem>().ToList()); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
public AlwaysForm() { InitializeComponent(); sysetm = AraSystem.GetInstance(); if ( sysetm.Always == null) { sysetm.Always = new List <Formula>(); } resultFormula = new Formula(); formulaFluentsCmb.DataSource = sysetm.Fluents.ToArray(); tabelDGV.DataSource = sysetm.Always.ToList(); tabelDGV.Columns["Label"].HeaderText = "Exprestion"; tabelDGV.Columns["IsValid"].Visible = false;; }
private void testQueryBtn_Click(object sender, EventArgs e) { if (AraSystem.GetInstance().InitState == null) { MessageBox.Show("Select the initai State First"); return; } if (!resultFormula.IsValid) { MessageBox.Show("Invalid Formula"); return; } query.QueryPossibility = possiblyRB.Checked ? Utility.QueryPossibility.Possibly : Utility.QueryPossibility.Necessary; query.ResultFormula = resultFormula; resultTB.Text = query.Execute().ToString(); DrawGraph(); }
public MainForm() { InitializeComponent(); system = AraSystem.GetInstance(); }