Example #1
0
        public ExportDialog(ProgressData progressData, string leagueName, ushort minDraftYear, ushort maxDraftYear, ushort currentStageIndex, string[] teams)
        {
            InitializeComponent();

            m_ProgressData = progressData;
            m_LeagueName   = leagueName;
            m_StageIndex   = currentStageIndex;
            m_Teams        = teams;
            m_MaxDraftYear = maxDraftYear;

            for (ushort draftYear = maxDraftYear; draftYear >= minDraftYear; --draftYear)
            {
                comboBoxDraftYear.Items.Add(draftYear);
            }
            comboBoxDraftYear.SelectedIndex = 0;

            XmlSerializer serializer     = new XmlSerializer(typeof(ExportConfig));
            string        configFilename = System.IO.Path.Combine(WindowsUtilities.OutputLocation.Get(), "PlayerTracker", "ExportConfig.xml");

            if (System.IO.File.Exists(configFilename))
            {
                using (System.IO.StreamReader reader = new System.IO.StreamReader(configFilename))
                {
                    m_ExportConfig = (ExportConfig)serializer.Deserialize(reader);
                    reader.Close();
                }
            }
            else
            {
                using (System.IO.StreamWriter writer = new System.IO.StreamWriter(configFilename))
                {
                    serializer.Serialize(writer, m_ExportConfig);
                    writer.Close();
                }
            }
        }