|
@@ -738,6 +738,8 @@ namespace PDF_Master.ViewModels
|
|
|
|
|
|
public DelegateCommand CreateBlankFileCommand { get; set; }
|
|
|
|
|
|
+ public DelegateCommand CreateFromFile { get; set; }
|
|
|
+
|
|
|
public DelegateCommand ClosePropertyCommand { get; set; }
|
|
|
|
|
|
#endregion 命令
|
|
@@ -769,6 +771,7 @@ namespace PDF_Master.ViewModels
|
|
|
OpenFileCommand = new DelegateCommand(openfile);
|
|
|
HelpCommand = new DelegateCommand<string>(help);
|
|
|
CreateBlankFileCommand = new DelegateCommand(createBlankFile);
|
|
|
+ CreateFromFile = new DelegateCommand(createfromFile);
|
|
|
|
|
|
ViwerRegionName = RegionNames.ViwerRegionName;
|
|
|
SplitViewerRegionName = RegionNames.Viewer_SplitRegionName;
|
|
@@ -837,6 +840,46 @@ namespace PDF_Master.ViewModels
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private async void createfromFile()
|
|
|
+ {
|
|
|
+ string txt = Properties.Resources.txtex;
|
|
|
+ string word = Properties.Resources.wordex;
|
|
|
+ string ppt = Properties.Resources.pptex;
|
|
|
+ string excel = Properties.Resources.excelex;
|
|
|
+ string html = Properties.Resources.htmlex;
|
|
|
+ string image = Properties.Resources.imageex;
|
|
|
+ string allfiles = txt + word + excel + ppt + image + html;
|
|
|
+ OpenFileDialog dialog = new OpenFileDialog();
|
|
|
+ dialog.Multiselect = true;
|
|
|
+ dialog.Filter = string.Format($"Files({allfiles.Replace(";", ",")}|{allfiles})|" +
|
|
|
+ $"Microsoft Office Word({word})|{word}|" +
|
|
|
+ $"Microsoft Office Excel({excel})|{excel}|" +
|
|
|
+ $"Microsoft Office PowerPoint({ppt})|{ppt}|" +
|
|
|
+ $"Txt({txt})|{txt}|" +
|
|
|
+ $"Picture({image})|{image}|" +
|
|
|
+ $"Html({html})|{html}");
|
|
|
+
|
|
|
+ if ((bool)dialog.ShowDialog())
|
|
|
+ {
|
|
|
+ for(int i=0;i<dialog.FileNames.Length;i++)
|
|
|
+ {
|
|
|
+ if(App.OpenedFileList.Contains(dialog.FileNames[i]))
|
|
|
+ {
|
|
|
+ App.mainWindowViewModel.SelectItem(dialog.FileNames[i]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
|
|
+ {
|
|
|
+ App.mainWindowViewModel.AddTabItem(dialog.FileNames[i]);
|
|
|
+ }));
|
|
|
+ await Task.Delay(20);
|
|
|
+ ToolMethod.SetFileThumbImg(dialog.FileNames[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
///创建空白文档
|
|
|
/// </summary>
|