Esempio n. 1
0
        private void ladenToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                mp = MissionPack.Load(openFileDialog1.FileName);

                ServiceLocator.Add("MissionPack", mp);
                ServiceLocator.Add("filename", openFileDialog1.FileName);
            }
        }
        public MissionPackSelector()
        {
            InitializeComponent();

            foreach (var m in Directory.GetFiles(Application.StartupPath + "\\MissionPacks", "*.mp"))
            {
                var mp   = MissionPack.Load(m);
                var item = new ComboboxItem();
                item.Text     = mp.Name;
                item.Value    = mp;
                item.Filename = m;

                mpComboBox.Items.Add(item);
            }

            if (mpComboBox.Items.Count > 0)
            {
                mpComboBox.SelectedIndex = 0;
            }
        }
        public MissionPackSelector()
        {
            InitializeComponent();

            if (!Directory.Exists(Application.StartupPath + "\\MissionPacks"))
            {
                Directory.CreateDirectory(Application.StartupPath + "\\MissionPacks");
            }

            var sg = (SavedGame)ServiceLocator.Add("SavedGame", SavedGame.Load());

            //System.Globalization.CultureInfo.CurrentUICulture = new System.Globalization.CultureInfo(sg.Locale);
            ServiceLocator.Subscribe("LocaleChanged", _ =>
            {
                Title             = ServiceLocator._("Select Mission");
                okButton.Text     = ServiceLocator._("OK");
                cancelButton.Text = ServiceLocator._("Cancel");
            });

            ServiceLocator.LoadLocale();

            foreach (var m in Directory.GetFiles(Application.StartupPath + "\\MissionPacks", "*.mp"))
            {
                var mp   = MissionPack.Load(m);
                var item = new ComboboxItem();
                item.Text  = mp.Name;
                item.Value = mp;

                mpComboBox.Items.Add(item);
            }

            if (mpComboBox.Items.Count < 0)
            {
                mpComboBox.SelectedIndex = 0;
            }
        }