コード例 #1
0
        private void OnSaveAs(object sender, RoutedEventArgs e)
        {
            e.Handled = true;
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.DefaultExt = ".vsc";
            dlg.Filter     = "Visual Script Files (*.vsc)|*.vsc|All Files (*.*)|*.*";
            //dlg.Multiselect = false;
            dlg.InitialDirectory = LastFolder;

            Nullable <bool> result = dlg.ShowDialog();

            if (result != true)
            {
                return;
            }
            File       = dlg.FileName;
            LastFolder = new FileInfo(dlg.FileName).DirectoryName;
            Serialization.Save((Script)Editor.Script, File);
            Title = Properties.Resources.VisualCodeEditor + " - " + File;
            ShowMessage(toast.ShowSuccess, string.Format(Properties.Resources.SuccessLodFile, File));
            Editor.IsModified      = false;
            ButtonOpen.IsEnabled   = true;
            ButtonSave.IsEnabled   = true;
            ButtonStart.IsEnabled  = true;
            ButtonSaveAs.IsEnabled = true;
            ButtonPrint.IsEnabled  = true;
        }
コード例 #2
0
        private void OnSaveFile(object sender, RoutedEventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.DefaultExt = ".xml";
            dlg.Filter     = "XML Files (*.xml)|*.xml|All Files (*.*)|*.*";
            //dlg.Multiselect = false;
            dlg.InitialDirectory = System.IO.Directory.GetCurrentDirectory();

            Nullable <bool> result = dlg.ShowDialog();

            if (result == true)
            {
                //Serialization.Save(ScriptEditor.Sprite, dlg.FileName);
                Serialization.Save(CurrentEnviroment.Game, dlg.FileName);
            }
        }