LunarPresentation/Commands/OpenFile.cs

(开头部分) 20KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Xml;
using Microsoft.Win32;

namespace SHomeWorkshop.LunarPresentation.Commands
{
    public partial class Command
    {
        public static void OpenFile(MainWindow window,
            System.Windows.Controls.TabControl mainTabControl)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Title = Globals.appName + "——打开文档:";
            ofd.Filter = Globals.appName +
                " 文档(*.lpdoc)|*.lpdoc|" + Globals.appName +
                " 模板文档(*.lptemp)|*.lptemp|可移植网络图形(*.png)|*.png|全部支持格式(*.lpdoc;*.lptemp;*.png)|*.lpdoc;*.lptemp;*.png";
            ofd.FilterIndex = 4;
            ofd.Multiselect = true;

            if (Directory.Exists(Globals.pathofUserDocuments) == false)
            {
                Directory.CreateDirectory(Globals.pathofUserDocuments);
            }

            ofd.InitialDirectory = Globals.pathofUserDocuments;

            //只有Vista以上版本才支持。
            if (System.Environment.OSVersion.Version.Major >= 6)
            {
                ofd.CustomPlaces.Add(
                    new FileDialogCustomPlace(Globals.pathofUserDocuments));

                ofd.CustomPlaces.Add(
                    new FileDialogCustomPlace(Globals.pathOfUserTemplateDocuments));
            }

            if (ofd.ShowDialog(Globals.MainWindow) != true)
            {
                window.Focus();
                Globals.SwitchInputMethod(false);
                return;
            }

            if (ofd.FileNames.Count() > 10)
            {
                System.Windows.MessageBoxResult result
                    = System.Windows.MessageBox.Show(
                    "您选择的文件数目大于10个,这可能严重影响程序运行速度。真的要继续吗?",
                    Globals.appName,
                    System.Windows.MessageBoxButton.YesNo,
                    System.Windows.MessageBoxImage.Warning);

                if (result != System.Windows.MessageBoxResult.Yes)
后面还有 432 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。