private void saveButton_Click(object sender, EventArgs e) { using (var sfd = new SaveFileDialog()) { sfd.AddExtension = true; sfd.Filter = "Key Stroke Files|*.strokes|All Files|*.*"; if (sfd.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } KeyStrokeSerializer.Save(sfd.FileName, GetStrokeList()); Text = Path.GetFileName(sfd.FileName); } }
private void loadButton_Click(object sender, EventArgs e) { using (var ofd = new OpenFileDialog()) { ofd.AddExtension = true; ofd.Filter = "Key Stroke Files|*.strokes|All Files|*.*"; ofd.CheckFileExists = true; if (ofd.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } var strokes = KeyStrokeSerializer.Load(ofd.FileName); FillList(strokes); } }