本文整理汇总了C#中Ticket.Set方法的典型用法代码示例。如果您正苦于以下问题:C# Ticket.Set方法的具体用法?C# Ticket.Set怎么用?C# Ticket.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ticket
的用法示例。
在下文中一共展示了Ticket.Set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintSettingsViewModel
public PrintSettingsViewModel()
{
var lps = new LocalPrintServer();
var queue = lps.GetPrintQueue("Microsoft XPS Document Writer");
var pc = Capabilities.Load(queue.GetPrintCapabilitiesAsXml());
printTicket = Ticket.Load(queue.DefaultPrintTicket.GetXmlStream());
var mediaSizeFeature = pc.Get(Psk.PageMediaSize);
MediaSizeDisplayName = mediaSizeFeature.Get(Psk.DisplayName)?.AsString();
MediaSizeCapabilities = new ReactiveList<MediaSizeViewModel>(
from option in mediaSizeFeature.Options()
select new MediaSizeViewModel(option));
MediaSize = MediaSizeCapabilities.First(ms =>
{
return ms.Option.Name == printTicket.Get(Psk.PageMediaSize)?.First()?.Name;
});
this.WhenAnyValue(x => x.MediaSize)
.Skip(1)
.Subscribe(ms =>
{
printTicket = printTicket.Set(Psk.PageMediaSize, ms.Option);
});
var copies = pc.Get(Psk.JobCopiesAllDocuments);
CopiesDisplayName = copies.Get(Psk.DisplayName)?.AsString();
CopiesMax = (copies.Get(Psf.MaxValue)?.AsInt()).GetValueOrDefault(1);
CopiesMin = (copies.Get(Psf.MinValue)?.AsInt()).GetValueOrDefault(1);
CopiesMultiple = (copies.Get(Psf.Multiple)?.AsInt()).GetValueOrDefault(1);
Copies = (copies.Get(Psf.DefaultValue)?.AsInt()).GetValueOrDefault(1);
this.WhenAnyValue(x => x.Copies)
.Skip(1)
.Subscribe(cp =>
{
printTicket = printTicket.Set(Psk.JobCopiesAllDocuments, cp);
});
IncreaseCopies = ReactiveCommand.Create(
this.WhenAny(_ => _.Copies, x => x.Value < CopiesMax));
IncreaseCopies.Subscribe(_ =>
{
Copies += CopiesMultiple;
});
DecreaseCopies = ReactiveCommand.Create(
this.WhenAny(_ => _.Copies, x => x.Value > CopiesMin));
DecreaseCopies.Subscribe(_AppDomain =>
{
Copies -= CopiesMultiple;
});
}