|
@@ -1,3 +1,4 @@
|
|
|
+<<<<<<< Updated upstream
|
|
|
using ComPDFKit.PDFDocument;
|
|
|
using PDF_Office.Model;
|
|
|
using Prism.Commands;
|
|
@@ -19,6 +20,160 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
public HomePagePrinterDialogViewModel(IDialogService dialogService)
|
|
|
{
|
|
|
dialogs = dialogService;
|
|
|
+=======
|
|
|
+using PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter;
|
|
|
+using Prism.Commands;
|
|
|
+using Prism.Mvvm;
|
|
|
+using Prism.Regions;
|
|
|
+using Prism.Services.Dialogs;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Windows.Controls;
|
|
|
+using System.Windows;
|
|
|
+using System.Diagnostics;
|
|
|
+using System.Drawing.Printing;
|
|
|
+using PDFSettings;
|
|
|
+
|
|
|
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
+{
|
|
|
+ public class HomePagePrinterDialogViewModel : BindableBase, IDialogAware, INavigationAware
|
|
|
+ {
|
|
|
+ public IDialogService Dialogs;
|
|
|
+ public IRegionManager PrintModRegion;
|
|
|
+
|
|
|
+ private string currentPrintModName;
|
|
|
+
|
|
|
+ private string _printModRegionName;
|
|
|
+ public string PrintModRegionName
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return _printModRegionName;
|
|
|
+ }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref _printModRegionName, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public Dictionary<string, string> GetContentByPrintMod;
|
|
|
+
|
|
|
+ private Visibility _printModVisible = Visibility.Collapsed;
|
|
|
+ public Visibility PrintModVisible
|
|
|
+ {
|
|
|
+ get { return _printModVisible; }
|
|
|
+ set { SetProperty(ref _printModVisible, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<string> _printerNameList;
|
|
|
+ public List<string> PrinterNameList
|
|
|
+ {
|
|
|
+ get { return _printerNameList; }
|
|
|
+ set { _printerNameList = value; }
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<string> _printContentList;
|
|
|
+ public List<string> PrintContentList
|
|
|
+ {
|
|
|
+ get { return _printContentList; }
|
|
|
+ set { _printContentList = value; }
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<string> _printerDirectionList;
|
|
|
+ public List<string> PrintDirectionList
|
|
|
+ {
|
|
|
+ get { return _printerDirectionList; }
|
|
|
+ set { _printerDirectionList = value; }
|
|
|
+ }
|
|
|
+
|
|
|
+ public DelegateCommand<object> DelegateChangePrintModCommand { get; set; }
|
|
|
+
|
|
|
+ public HomePagePrinterDialogViewModel(IDialogService dialogService, IRegionManager regionManager)
|
|
|
+ {
|
|
|
+ Dialogs = dialogService;
|
|
|
+ PrintModRegion = regionManager;
|
|
|
+ PrintModVisible = Visibility.Visible;
|
|
|
+ PrintModRegionName = Guid.NewGuid().ToString();
|
|
|
+ DelegateChangePrintModCommand = new DelegateCommand<object>(ChangePrintMod);
|
|
|
+
|
|
|
+ GetContentByPrintMod = new Dictionary<string, string>();
|
|
|
+ InitGetContentByPrintMod(ref GetContentByPrintMod);
|
|
|
+
|
|
|
+ InitComponent();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void InitComponent()
|
|
|
+ {
|
|
|
+ InitPrinterNameList();
|
|
|
+ InitPrintContentList();
|
|
|
+ InitPrintContentList();
|
|
|
+ InitPrintDirectionList();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private void InitPrinterNameList()
|
|
|
+ {
|
|
|
+ PrinterNameList = new List<string>();
|
|
|
+ PrintDocument printDocument = new PrintDocument();
|
|
|
+ string defaultPrinterName = printDocument.PrinterSettings.PrinterName;
|
|
|
+
|
|
|
+ foreach (string printerListItem in PrinterSettings.InstalledPrinters)
|
|
|
+ {
|
|
|
+ PrinterNameList.Add(printerListItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void InitPrintContentList()
|
|
|
+ {
|
|
|
+ PrintContentList = new List<string>();
|
|
|
+ PrintContentList.Add("文档");
|
|
|
+ PrintContentList.Add("文档和标记");
|
|
|
+ PrintContentList.Add("文档和图章");
|
|
|
+ }
|
|
|
+
|
|
|
+ private void InitPrintDirectionList()
|
|
|
+ {
|
|
|
+ PrintDirectionList= new List<string>();
|
|
|
+ PrintDirectionList.Add("横向");
|
|
|
+ PrintDirectionList.Add("纵向");
|
|
|
+ }
|
|
|
+
|
|
|
+ private void InitGetContentByPrintMod(ref Dictionary<string, string> dictionary)
|
|
|
+ {
|
|
|
+ dictionary.Add("ModSize", "HomePagePrinterModSizeContent");
|
|
|
+ dictionary.Add("ModPoster", "HomePagePrinterModPosterContent");
|
|
|
+ dictionary.Add("ModMutiple", "HomePagePrinterModMutipleContent");
|
|
|
+ dictionary.Add("ModBooklet", "HomePagePrinterModBookletContent");
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ShowContent(string currentBar)
|
|
|
+ {
|
|
|
+ PrintModVisible = Visibility.Visible;
|
|
|
+ //TODO
|
|
|
+ }
|
|
|
+
|
|
|
+ private void EnterSelectedMod(string currentBar)
|
|
|
+ {
|
|
|
+
|
|
|
+ NavigationParameters param = new NavigationParameters();
|
|
|
+ PrintModVisible = Visibility.Collapsed;
|
|
|
+ PrintModRegion.RequestNavigate(PrintModRegionName, GetContentByPrintMod[currentBar]);
|
|
|
+ //TODO
|
|
|
+ ShowContent(currentBar);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private void ChangePrintMod(object e)
|
|
|
+ {
|
|
|
+ var args = e as Button;
|
|
|
+ if (args != null)
|
|
|
+ {
|
|
|
+ currentPrintModName = args.Name;
|
|
|
+ EnterSelectedMod(currentPrintModName);
|
|
|
+ //TODO:
|
|
|
+ }
|
|
|
+>>>>>>> Stashed changes
|
|
|
}
|
|
|
|
|
|
public string Title => "";
|
|
@@ -36,12 +191,29 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
|
|
|
|
|
|
public void OnDialogOpened(IDialogParameters parameters)
|
|
|
{
|
|
|
+<<<<<<< Updated upstream
|
|
|
CPDFDocument doc = null;
|
|
|
parameters.TryGetValue<CPDFDocument>(ParameterNames.PDFDocument, out doc);
|
|
|
if (doc != null)
|
|
|
{
|
|
|
document = doc;
|
|
|
}
|
|
|
+=======
|
|
|
+ PrintModRegion.RequestNavigate(PrintModRegionName, GetContentByPrintMod["ModSize"]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void OnNavigatedTo(NavigationContext navigationContext)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ public bool IsNavigationTarget(NavigationContext navigationContext)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void OnNavigatedFrom(NavigationContext navigationContext)
|
|
|
+ {
|
|
|
+>>>>>>> Stashed changes
|
|
|
}
|
|
|
}
|
|
|
}
|