Пример #1
0
		private void openToolStripMenuItem_Click(object sender, EventArgs e)
		{
			string path = Directory.GetCurrentDirectory() + fileName;
			System.IO.StreamReader file = new System.IO.StreamReader(path);
			//if save file exists, import data
			if (File.Exists(path))
			{
				System.Xml.Serialization.XmlSerializer reader = new System.Xml.Serialization.XmlSerializer(typeof(DinnersForEight));
				
				DinnersForEight projData = (DinnersForEight)reader.Deserialize(file);
				ds = projData.ds;
				historyDate = projData.historyDate;
				history = projData.getHistory();
			}
			else
			{
				//if save file is not found, create data structures
				MessageBox.Show("Save file not found. Ensure file is in same directory as program.\n" + path);

				DinnersForEight projData2 = new DinnersForEight();
				ds = projData2.ds;
				historyDate = projData2.historyDate;
				history = projData2.getHistory();
			}
			
			dgvUser.DataSource = ds;
			dgvUser.DataMember = "user";

			dgvMatchCount.DataSource = ds;
			dgvMatchCount.DataMember = "matchCount";

			UpdateCellColors();
			file.Close();
		}
Пример #2
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string path = Directory.GetCurrentDirectory() + fileName;

            System.IO.StreamReader file = new System.IO.StreamReader(path);
            //if save file exists, import data
            if (File.Exists(path))
            {
                System.Xml.Serialization.XmlSerializer reader = new System.Xml.Serialization.XmlSerializer(typeof(DinnersForEight));

                DinnersForEight projData = (DinnersForEight)reader.Deserialize(file);
                ds          = projData.ds;
                historyDate = projData.historyDate;
                history     = projData.getHistory();
            }
            else
            {
                //if save file is not found, create data structures
                MessageBox.Show("Save file not found. Ensure file is in same directory as program.\n" + path);

                DinnersForEight projData2 = new DinnersForEight();
                ds          = projData2.ds;
                historyDate = projData2.historyDate;
                history     = projData2.getHistory();
            }

            dgvUser.DataSource = ds;
            dgvUser.DataMember = "user";

            dgvMatchCount.DataSource = ds;
            dgvMatchCount.DataMember = "matchCount";

            UpdateCellColors();
            file.Close();
        }