public MainForm()
        {
            InitializeComponent();
            _matrixDialog          = null;
            _drawer                = new DrawGraph();
            _rectangle             = new Rectangle(0, 0, 0, 0);
            _rectangleDrawing      = false;
            _forestGraph           = new Graph <string, VertexData, string, EdgeData>();
            _saved                 = true;
            _graphPath             = new List <string>();
            _dijkstra              = new DijkstraAlhorithm <string, VertexData, string, EdgeData>(_forestGraph);
            _trajectoryMatrix      = new TrajectoryMatrix();
            _trajectoryMatrixReady = false;
            _matrixGeneration      = null;
            _saveFileName          = "";
            _rangeTree             = new RangeTree <VertexData>();
            _binaryFile            = @".\data.bin";
            SetTitle();

#if DEBUG
            _autoloadPath = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName;
#else
            _autoloadPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath);
#endif
            _autoloadPath += @"\autoload.xml";

            // autoload data
            if (File.Exists(_autoloadPath))
            {
                try
                {
                    DataSerializer.LoadData(_forestGraph, _autoloadPath);
                    graphCanvas.Invalidate();
                    RegenerateTrajectoryMatrix();
                    BuildRangeTree();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(Resources.AutoImportError + "\n\nDetail chyby:\n" + ex.Message, Resources.AutoImportErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            Size size = Properties.Settings.Default.MainformSize;
            if (size.Width >= 500 && size.Height >= 300)
            {
                Size = size;
            }

            Point position = Properties.Settings.Default.MainformPosition;
            if (!(position.X <= -1000 && position.Y <= -1000))
            {
                StartPosition = FormStartPosition.Manual;
                Location      = position;
            }
        }
        private void TrajectoryMatrixButton_Click(object sender, EventArgs e)
        {
            if (_matrixDialog != null)
            {
                _matrixDialog.Close();
            }

            if (_trajectoryMatrixReady == false)
            {
                ShowMessage(Resources.MatrixNotReady, MessageBoxIcon.Warning, Resources.MatrixNotReadyTitle);
            }

            _matrixDialog = new TrajectoryMatrixDialog(_trajectoryMatrix);
            _matrixDialog.Show();
        }