private void novyButton_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(jmenoTextBox.Text)) { MessageBox.Show("Jméno není vyplněno.", "Chyba", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { Pes = new Pes(jmenoTextBox.Text, DateTime.Now); Close(); } }
private void nacistToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); if (openFileDialog.ShowDialog() == DialogResult.OK) { using (FileStream fs = new FileStream(openFileDialog.FileName, FileMode.Open)) { XmlSerializer xs = new XmlSerializer(typeof(Pes)); pes = (Pes)xs.Deserialize(fs); } } Random random = new Random(); pes.Nalada = (byte)random.Next(0, 100); }
private void novyToolStripMenuItem_Click(object sender, EventArgs e) { using (NovyDialog dlg = new NovyDialog()) { if (dlg.ShowDialog() == DialogResult.OK) { pes = dlg.Pes; Prepis(); } pes = dlg.Pes; if (pes != null) { Prepis(); } } }
private void nacistToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); if (openFileDialog.ShowDialog() == DialogResult.OK) { using (FileStream fs = new FileStream(openFileDialog.FileName, FileMode.Open)) { XmlSerializer xs = new XmlSerializer(typeof(Pes)); pes = (Pes)xs.Deserialize(fs); } } Random random = new Random(); pes.Nalada = (byte) random.Next(0, 100); }