Esempio n. 1
0
 private void SetEventsButtons(SceneryControl sceneryCtr)
 {
     sceneryCtr.OnClickUp += sceneryCtr_OnClickUp;
     sceneryCtr.OnClickDown += sceneryCtr_OnClickDown;
     sceneryCtr.OnClickEdit += sceneryCtr_OnClickEdit;
 }
Esempio n. 2
0
        private void LoadSceneries()
        {
            string packFile = txBoxFolder.Text + "\\Custom Scenery\\" + "scenery_packs.ini";

            if (!File.Exists(packFile))
            {
                MessageBox.Show(this, "Unable to find scenery pack file in: " + packFile, "File", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }

            try
            {
                using (var readText = new StreamReader(packFile))
                {
                    string line;
                    while ((line = readText.ReadLine()) != null)
                    {
                        if (line.StartsWith("SCENERY_PACK"))
                        {
                            bool enable = !line.StartsWith("SCENERY_PACK_DISABLED");
                            string name = line.Substring(line.IndexOf("/"));
                            var sceneryCtr = new SceneryControl(enable, name.Replace("/", ""));
                            SetEventsButtons(sceneryCtr);
                            tableLayoutPanel1.Controls.Add(sceneryCtr);
                        }
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show(this, "Cannot load info from scenery pack file. Verify if the folowing file is a valid X-Plane scenery pack: " + packFile,
                    "Load File", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
Esempio n. 3
0
 private void pBoxAdd_Click(object sender, EventArgs e)
 {
     var sceneryCtr = new SceneryControl(true, "");
     tableLayoutPanel1.Controls.Add(sceneryCtr);
     SetEventsButtons(sceneryCtr);
     sceneryCtr.Focus();
 }