Esempio n. 1
0
        private void M_btnLoadTradenodes_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter = "tradenode files (*.eu4tradenode)|*.eu4tradenode";

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    m_provinceEditor.ReadMarker(dialog.FileName);

                    m_provinceEditor.MarkProvinces();

                    m_provinceEditor.MarkLocation();

                    List <ComboBoxItem <MarkerItem> > listComboItem = new List <ComboBoxItem <MarkerItem> > ();

                    foreach (MarkerItem markerItem in m_provinceEditor.ListMarkerItem)
                    {
                        listComboItem.Add(new ComboBoxItem <MarkerItem> (markerItem, markerItem.Name));
                    }

                    m_cbMarker.Enabled = true;

                    m_cbMarker.DisplayMember = "Label";
                    m_cbMarker.ValueMember   = "Value";

                    m_cbMarker.DataSource = listComboItem;

                    UpdateGui();
                }
                catch (Exception)
                {
                    MessageBox.Show("Cant load tradenodes", "Cant load tradenodes", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 2
0
        private void BtnLoadTradenodes_Click(object sender, EventArgs e)
        {
            var openFileDialog = new OpenFileDialog
            {
                Filter = "tradenode files (*.eu4tradenode)|*.eu4tradenode"
            };

            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            try
            {
                m_provinceEditor.ReadMarker(openFileDialog.FileName);

                m_provinceEditor.MarkProvinces();

                m_provinceEditor.MarkLocation();

                var listComboItem = m_provinceEditor.MarkerItems
                                    .Select(mi => new ComboBoxItem <MarkerItem>(mi, mi.Name))
                                    .ToList();

                m_cbMarker.Enabled = true;

                m_cbMarker.DisplayMember = "Label";
                m_cbMarker.ValueMember   = "Value";

                m_cbMarker.DataSource = listComboItem;

                UpdateGui();
            }
            catch
            {
                MessageBox.Show("Can't load tradenodes", "Can't load tradenodes", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }