Ejemplo n.º 1
0
        /// <summary>
        /// the function called when you click on the button save
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void save_Btn_click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.SaveFileDialog saveFileDialog = new Microsoft.Win32.SaveFileDialog();
            saveFileDialog.Filter           = "Save file (.save) | *.save";
            saveFileDialog.FileName         = "Save1.save";
            saveFileDialog.DefaultExt       = "save";
            saveFileDialog.ValidateNames    = true;
            saveFileDialog.InitialDirectory = System.AppDomain.CurrentDomain.BaseDirectory;
            Nullable <bool> result = saveFileDialog.ShowDialog();

            if (result == true)
            {
                // Open document
                string filename = saveFileDialog.FileName;
                game.SaveGame(filename);
            }
        }