LunarPresentation/Commands/SaveFileAs.cs
(开头部分) 10KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media.Imaging;
using System.Xml;
using Microsoft.Win32;
namespace SHomeWorkshop.LunarPresentation.Commands
{
public partial class Command
{
/// <summary>
/// 另存文档。
/// </summary>
/// <param name="closeAfterSaveAs">保存后立即关闭文档。</param>
/// <returns></returns>
public static bool SaveFileAs()
{
if (Globals.selectedEditor == null)
{
MessageBox.Show("当前没有文档可以保存!",
Globals.appName, MessageBoxButton.OK, MessageBoxImage.Warning);
return false;
}
Editor editor = Globals.selectedEditor;
return SaveFileAs(editor);
}
/// <summary>
/// 文档另存为。
/// </summary>
/// <param name="editor"></param>
/// <param name="closeIfHasSamename"></param>
/// <param name="resultFileName">必须传入合法的文件名(全路径)。</param>
/// <returns></returns>
public static bool SaveFileAs(Editor editor, bool closeIfHasSamename = true, string resultFileName = null)
{
if (resultFileName == null)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.Title = Globals.appName + "——保存文件:";
sfd.Filter = Globals.appName +
" 文档(*.lpdoc)|*.lpdoc|" + Globals.appName +
" 模板文档(*.lptemp)|*.lptemp|Xml文档(*.xml)|*.xml|文本文档(*.txt)|*.txt";
sfd.FileName = editor.FileNameHeader.Text;
if (Directory.Exists(Globals.pathofUserDocuments) == false)
{
Directory.CreateDirectory(Globals.pathofUserDocuments);
}
sfd.InitialDirectory = Globals.pathofUserDocuments;
//只有Vista以上版本才支持。
if (System.Environment.OSVersion.Version.Major >= 6)
{
后面还有 236 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。