コード例 #1
0
ファイル: MainForm.cs プロジェクト: XEngima/Apps-CashBox
        private void skapaBackupToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var fileDialog = new SaveFileDialog();

            fileDialog.Filter     = CurrentApplication.Name + "-backupfiler|*.backup|Alla filer|*.txt";
            fileDialog.DefaultExt = ".backup";
            fileDialog.FileName   = CurrentApplication.DateTimeNow.ToString("yyyyMMdd_HHmm") + " " + CurrentApplication.Name + ".backup";

            DialogResult result = fileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                using (var core = new StandardBusinessLayer(DataCache)) {
                    core.Connect();
                    core.CreateBackup(fileDialog.FileName);
                }

                MessageBox.Show("Backupen skapades.", CurrentApplication.Name, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }