// refreshing the state tree when undo button is clicked (going back to the previous state)
        private void button2_Click(object sender, EventArgs e)
        {
            sm.stepBack();
            UpdateForm();
            var text = updateStateTree(_selectedState);
            var pic  = Graphviz.RenderImage(text, "jpg");

            pictureBox1.Image = pic;
        }
        // importing the files, checking if the right files are imported and creating a state tree
        private void button1_Click(object sender, EventArgs e)
        {
            if (_path_d.Trim(' ') == "" || _path_p.Trim(' ') == "")
            {
                button1.ForeColor = Color.White;
                button1.BackColor = Color.DarkRed;
                button1.Text      = "No paths";
                return;
            }

            string input_d;
            string input_p;

            try
            {
                input_d = System.IO.File.ReadAllText(_path_d);
                input_p = System.IO.File.ReadAllText(_path_p);
            }
            catch (Exception)
            {
                button1.ForeColor = Color.White;
                button1.BackColor = Color.DarkRed;
                button1.Text      = "Wrong paths";
                return;
            }

            try
            {
                readInput(input_d, input_p);
            }
            catch (Exception)
            {
                button1.ForeColor = Color.White;
                button1.BackColor = Color.DarkRed;
                button1.Text      = "Wrong files";
                return;
            }

            _states         = sm.GetStates();
            _selectedState  = _states[0];
            button3.Enabled = false;
            previousPreds   = new List <Predicate>();
            UpdateForm();
            var graphVizString = "digraph g{\n     node [margin=0.1 fontsize=12 width=0.2 shape=circle style=filled];" +
                                 "\n      A [color=red lp=\"2,1222!?\"];\n    A->B->C;\n    B->D;\n     D [color=blue]}";

            // Bitmap bm = new Bitmap(Graphviz.RenderImage(graphVizString, "jpg"));
            var text = updateStateTree(_selectedState);
            var pic  = Graphviz.RenderImage(text, "jpg");

            pictureBox1.Image = pic;

            button1.Text = "Reset";
        }
        // refreshing the state tree when an action is chosen (going to the new state)
        private void button3_Click(object sender, EventArgs e)
        {
            sm.PerformAction(_selectedAction);
            UpdateForm();

            //listView2.Items.Add(_selectedState.StateID.ToString());
            button2.Enabled = true;
            button3.Enabled = false;
            var text = updateStateTree(_selectedState);
            var pic  = Graphviz.RenderImage(text, "jpg");

            pictureBox1.Image = pic;
        }
        // refreshing the state tree when an action is selected (coloring arrow coresponding to the selected action in blue)
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                return;
            }

            _selectedAction = sm.GetActions()[listView1.SelectedIndices[0]];
            button3.Enabled = true;
            var text = updateStateTree(_selectedState);
            var pic  = Graphviz.RenderImage(text, "jpg");

            pictureBox1.Image = pic;
        }