public static void printTicket(string ticketTyp, string Start, string Ziel, string Preis, string Datum, string Person) { Bitmap ticket = Printer.generateTicket(ticketTyp, Start, Ziel, Preis, Datum, Person); Printer printer = new Printer(); printer.printTicket(ticket); }
private void button1_Click(object sender, EventArgs e) { PrinterDatabase db = new PrinterDatabase(); if (string.IsNullOrEmpty(textBox1.Text)) { MessageBox.Show("Der Hostname darf nicht leer sein. Bitte geben Sie mindestens ein Zeichen ein.", "Prinfo.NET Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { Printer = db.CreatePrinter(textBox1.Text); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ae) { MessageBox.Show("Unerwarteter Fehler. Details: " + ae.Message, "Prinfo.NET Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.Log(ae.Message, LogType.Error); } } }
static void Main(string[] args) { Console.WriteLine("***** Background Threads *****\n"); Printer p = new Printer(); Thread bgroundThread = new Thread(new ThreadStart(p.PrintNumbers)); /* * Foreground threads have the ability to "prevent the current application from terminating". * The CLR will not shut down an application (which is to say, unload the hosting AppDomain) * until all foreground threads have ended. * * Background threads (sometimes called daemon threads) are viewed by the CLR as expendable paths of execution * that "can be ignored at any point in time" (even if they are currently laboring over some unit of work). * Thus, if all foreground threads have terminated, * any and all background threads are automatically killed when the application domain unloads. * */ // This is now a background thread. bgroundThread.IsBackground = true; // By default, every thread you create via the Thread.Start() method is automatically a foreground thread. bgroundThread.Start(); // Primary thread is foreground thread by default. Console.WriteLine("Main thread finished. Press any key to exit."); Console.ReadLine(); }
static void Main() { var numbers = new double[] { 55.2, 12.0, 1.0, -5.0, 0.0, 75.6, 49.3 }; var printer = new Printer(); printer.PrintStatistics(numbers, 3); }
public void NewWayPrinter(Printer printer) { printer?.Print(); var text = printer?.GetPreview() ?? "NullPrinterException :-)"; text.Dump(); }
public void TestSetup() { _output = new StringBuilder(); _wrtr = Create.MockOf.TextWriter.WithOutputStoredTo(_output); _printer = Create.Printer.WithoutDefaultWriters().WithCustomWriter(_wrtr.Object); }
static void Main(string[] args) { var printer = new Printer(); printer.Print(new MyClass()); Console.ReadKey(); }
///<summary>Inserts one Printer into the database. Provides option to use the existing priKey.</summary> public static long Insert(Printer printer,bool useExistingPK){ if(!useExistingPK && PrefC.RandomKeys) { printer.PrinterNum=ReplicationServers.GetKey("printer","PrinterNum"); } string command="INSERT INTO printer ("; if(useExistingPK || PrefC.RandomKeys) { command+="PrinterNum,"; } command+="ComputerNum,PrintSit,PrinterName,DisplayPrompt) VALUES("; if(useExistingPK || PrefC.RandomKeys) { command+=POut.Long(printer.PrinterNum)+","; } command+= POut.Long (printer.ComputerNum)+"," + POut.Int ((int)printer.PrintSit)+"," +"'"+POut.String(printer.PrinterName)+"'," + POut.Bool (printer.DisplayPrompt)+")"; if(useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { printer.PrinterNum=Db.NonQ(command,true); } return printer.PrinterNum; }
static void Main() { Printer P = new Printer(); Receiver R = new Receiver(); R.OnComplete += P.Print; R.Receive(); }
public MyTunesEngine() { this.printer = new Printer(); this.media = new List<IMedia>(); this.mediaSupplies = new Dictionary<IMedia, SalesInfo>(); this.performers = new List<IPerformer>(); }
// [TestMethod] public void IntegretionTest() { var label = new Label("FullLabel", input); label.CollectParameters(); var printer = new Printer(label, GetPrinter); printer.PrintLabel(); }
///<summary>Inserts one Printer into the database. Returns the new priKey.</summary> internal static long Insert(Printer printer) { if(DataConnection.DBtype==DatabaseType.Oracle) { printer.PrinterNum=DbHelper.GetNextOracleKey("printer","PrinterNum"); int loopcount=0; while(loopcount<100){ try { return Insert(printer,true); } catch(Oracle.DataAccess.Client.OracleException ex){ if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){ printer.PrinterNum++; loopcount++; } else{ throw ex; } } } throw new ApplicationException("Insert failed. Could not generate primary key."); } else { return Insert(printer,false); } }
static void TestPrinterClass() { IPrinter printer = new Printer(); printer.GetPrinterInfo(); Console.WriteLine(); printer.AddDoc(new Document()); printer.AddDoc(new Document("My Doc",500)); printer.AddDoc(new Document()); printer.AddDoc(new Document()); Console.WriteLine(); printer.GetPrintQueue(); Console.WriteLine(); printer.Print(); Console.WriteLine(); printer.GetPrintQueue(); Console.WriteLine(); printer.Capacity(); Console.WriteLine(); printer.ReplaceCartrige(2000); Console.WriteLine(); printer.Capacity(); Console.WriteLine(); printer.GetPrinterInfo(); }
static void Main(string[] args) { MyClass myclass = new MyClass("1","2","3","4","5"); Printer myPrinter = new Printer(); myPrinter.Print(myclass); }
public string selectPrinter() { string functionReturnValue = null; string TheSelectedPrinterStr = null; Printer Printer = new Printer(); Printer lPrn = null; ADODB.Recordset rs = default(ADODB.Recordset); Printer lPrnType = null; // ERROR: Not supported in C#: OnErrorStatement rs = modRecordSet.getRS(ref "SELECT * FROM PrinterOftenUsed"); lstPrinter.Items.Clear(); foreach (Printer lPrn_loopVariable in GlobalModule.Printers) { lPrn = lPrn_loopVariable; lstPrinter.Items.Add((lPrn.DeviceName)); } if (lstPrinter.Items.Count) { if (rs.RecordCount > 0) { lstPrinter.SelectedIndex = rs.Fields("PrinterIndex").Value; if (rs.Fields("PrinterType").Value == 0) { lPrnType = GlobalModule.Printers[lstPrinter.SelectedIndex]; if (Strings.InStr(Strings.LCase(lPrnType.DeviceName), "label")) { optType[2].Checked = true; } else if (Printer.Width <= 9000) { optType[3].Checked = true; } else { optType[1].Checked = true; } } else if (rs.Fields("PrinterType").Value > 0) { optType[rs.Fields("PrinterType").Value].Checked = true; } } else { optType[1].Checked = true; } loadLanguage(); ShowDialog(); } else { functionReturnValue = ""; optType[1].Checked = true; } if (gSelect) { functionReturnValue = Printer.DeviceName; TheSelectedPrinterStr = Printer.DeviceName; modApplication.MyNewPrLabel = functionReturnValue; } else { functionReturnValue = ""; } selectPrinterErr: // ERROR: Not supported in C#: ResumeStatement return functionReturnValue; }
static void Main(string[] args) { Console.WriteLine("Print Started"); Printer p = new Printer(); Console.WriteLine("Enter to close"); Console.ReadLine(); p.close(); }
public AdvancedTimpexPrinterTwo(Printer timpexPrinter, Printer timPrinter, Printer pexPrinter, CounterPredicate counterPredicate, Counter numberCounter) { _timpexPrinter = timpexPrinter; _timPrinter = timPrinter; _pexPrinter = pexPrinter; _counterPredicate = counterPredicate; _numberCounter = numberCounter; }
public void ProcessGardens(GardenReport report, Printer printer) { foreach (Garden garden in gardens) { String toPrint = report(garden); printer(toPrint); } }
public void DoesNotAlterAst() { var kitchenSink = TestUtils.KitchenSink.Value; var ast = Parser.Parse(kitchenSink); var astCopy = Parser.Parse(kitchenSink); var printer = new Printer(); printer.VisitDocument(ast); ast.ShouldBeEquivalentToDeepDynamic(astCopy); }
public void DoWork() { var labelName = "FullLabel"; var label = new Label(labelName, GetParameters); label.CollectParameters(); var printer = new Printer(label, GetPrinter); printer.PrintLabel(); }
public WebView(Printer printer) { InitializeComponent(); this.Text = String.Format("{0} - {1}", printer.HostName, this.Text); webBrowser1.StatusTextChanged += new EventHandler( (object o, EventArgs e) => toolStripStatusLabel1.Text = webBrowser1.StatusText ); webBrowser1.Url = new UriBuilder("http", printer.HostName, 80, "").Uri; webBrowser1.Refresh(); }
public void OldWayPrinter(Printer printer) { if (printer != null) printer.Print(); var text = (printer != null) ? printer.GetPreview() : "NullPrinterException :-)"; text.Dump(); }
private void AddPrinters() { for (int index = 1; index <= 5; index++) { Printer printer = new Printer(); printer.ComPort = string.Format("COM{0}", index); printer.BaudRate = "250000"; printer.Name = string.Format("Printer {0}", index); Datastore.Instance.dbSQLite.Insert(printer); } }
public static void Run() { Report report = new Report(Json.Read("report\\example1.rrpt")); report.Fill(new ReportDataSource(getDataTable())); ReportPages pages = report.GetPages(); Printer printer = new Printer(pages); // カスタマイズされたプレビュー画面を表示します MyFmPrintPreview preview = new MyFmPrintPreview(printer); preview.ShowDialog(); }
public static void Run() { ReportPages pages; { // 第2引数にCustomizerオブジェクトを渡します Report report = new Report(Json.Read("report\\example_page1.rrpt"), new Customizer()); report.Fill(new ReportDataSource(getDataTable())); pages = report.GetPages(); } { Report report = new Report(Json.Read("report\\example_page3.rrpt")); report.Fill(DummyDataSource.GetInstance()); // 最後のページを追加します pages.AddRange(report.GetPages()); } // PDF出力 using (FileStream fs = new FileStream("output\\example_page.pdf", FileMode.Create)) { pages.Render(new PdfRenderer(fs)); } // XLS出力 using (FileStream fs = new FileStream("output\\example_page.xls", FileMode.Create)) { HSSFWorkbook workbook = new HSSFWorkbook(); XlsRenderer renderer = new XlsRenderer(workbook); renderer.NewSheet("example_page"); pages.Render(renderer); workbook.Write(fs); } // XLSX出力 using (FileStream fs = new FileStream("output\\example_page.xlsx", FileMode.Create)) { XSSFWorkbook workbook = new XSSFWorkbook(); XlsxRenderer renderer = new XlsxRenderer(workbook); renderer.NewSheet("example_page"); pages.Render(renderer); workbook.Write(fs); } // プレビュー { Printer printer = new Printer(pages); // 用紙サイズの異なるページが含まれているので // 動的に用紙設定が行われるようにします printer.DynamicPageSetting = true; FmPrintPreview preview = new FmPrintPreview(printer); preview.StartUpZoomFit = true; preview.ShowDialog(); } }
private void printGardenInfo(GardenReport gardenReport) { // Clear the ListBox listBox1.Items.Clear(); // Make our printer delegate Printer printer = new Printer(printStringToListBox); // Call the Process Garden function of our manager with our report and our printer gardenManager.ProcessGardens(gardenReport, printer); }
public void It_Should_Return_Tim_Timpex_When_Counter_Is_Dividable_With_Five_and_Three() { _numberCounter.Stub(x => x.IncrementNumber()); _numberCounter.Stub(x => x.GetValue()).Return(5); _counterPredicat.Stub(x => x.IsDividableWithFive(_numberCounter)).Return(true); _counterPredicat.Stub(x => x.IsDividableWithThree(_numberCounter)).Return(true); _sut = new TimPrinter(_numberCounter, _counterPredicat); String _result = _sut.Print(); _numberCounter.AssertWasCalled(x => x.IncrementNumber()); Assert.AreEqual(_result, "tim timpex"); }
protected override void Test(string expected, IEnumerable<SyntaxNode> nodes, Printer.Configuration.SyntaxPrinterConfiguration configuration) { var triviaAdder = new TriviaAdder(); foreach (var node in nodes) { node.Accept(triviaAdder); } base.Test(expected, nodes, configuration); }
public void It_Should_Return_Tim_When_counter_is_1() { _numberCounter.Stub(x => x.IncrementNumber()); _numberCounter.Stub(x => x.GetValue()).Return(1); _counterPredicat.Stub(x => x.IsDividableWithFive(_numberCounter)).Return(false); _counterPredicat.Stub(x => x.IsDividableWithThree(_numberCounter)).Return(false); _sut = new TimPrinter(_numberCounter, _counterPredicat); String _result = _sut.Print(); _numberCounter.AssertWasCalled(x => x.IncrementNumber()); Assert.AreEqual(_result, "tim"); }
public void PrintsMinimalAst() { var ast = new Field { Name = new Name { Value = "foo", }, }; var printer = new Printer(); printer.Visit(ast).Should().Be("foo"); }
static void Main(string[] args) { //AppDomain.CurrentDomain.ProcessExit += AccionDelEvento; //AppDomain.CurrentDomain.ProcessExit += (o,s)=>Printer.Beep(2000,1000,1); var engine = new EscuelaEngine(); engine.Inicializar(); Printer.WriteTitle("Bienvenidos a la escuela"); var reporteador = new Reporteador(engine.GetDiccionarioObjetos()); //reporteador.GetListaEscuela(); /* var evalList = reporteador.GetListaEvaluaciones(); * var listaAsig = reporteador.GetListaAsignaturas(); * var listaEvalAsig = reporteador.GetDiccionarioEvaluacionesXAsignatura(); * var listaPromXAsig = reporteador.GetPromeAlumnPorAsignatura(); * var topListaPromXAsig = reporteador.GetTopPromeAlumnPorAsignatura(5); */ Printer.WriteTitle("Captura de una Evaluación por Consola"); var newEval = new Evaluación(); string nombre, notaString; float nota; WriteLine("Ingrese el nombre de la Evaluación:"); Printer.PresioneEnter(); nombre = Console.ReadLine(); if (string.IsNullOrWhiteSpace(nombre)) { Printer.WriteTitle("El valor del nombre no puede ser vacio"); WriteLine("Saliendo del programa"); } else { newEval.Nombre = nombre.ToLower(); WriteLine("El nombre de la evaluación ha sido ingresado correctamente"); } WriteLine("Ingrese la nota de la Evaluación:"); Printer.PresioneEnter(); notaString = Console.ReadLine(); if (string.IsNullOrWhiteSpace(notaString)) { Printer.WriteTitle("El valor de la nota no puede ser vacio"); WriteLine("Saliendo del programa"); } else { try { newEval.Nota = float.Parse(notaString); if (newEval.Nota < 0 || newEval.Nota > 5) { throw new ArgumentOutOfRangeException("La nota debe estar entre 0 y 5"); } WriteLine("La nota de la evaluación ha sido ingresado correctamente"); return; } catch (ArgumentOutOfRangeException e) { WriteLine(e.Message); WriteLine("Saliendo del programa"); } catch (Exception) { WriteLine("El valor de la nota no es valida"); } finally { Printer.WriteTitle("FINALLY"); Printer.Beep(2500, 500, 3); } } }
private void print() { Printer.Print(this); }
public PrintState(Printer printer) { _printer = printer; }
/// <summary> /// 删除数据 /// </summary> private void Delete() { long Id = -1; try { //确认删除 var confirm = KryptonMessageBox.Show(this, Resources.GetRes().GetString("SureDelete"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (confirm != DialogResult.Yes) { return; } Id = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmPrinterId"].Value.ToString()); //如果是没添加过的记录,就直接删除 if (Id == -1) { KryptonMessageBox.Show(this, Resources.GetRes().GetString("DeleteSuccess"), Resources.GetRes().GetString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); krpdgList.Rows.Remove(krpdgList.SelectedRows[0]); return; } //如果已经有使用,则提示并拒绝删除 if (Resources.GetRes().Pprs.Where(x => x.PrinterId == Id).Count() > 0) { KryptonMessageBox.Show(this, Resources.GetRes().GetString("PropertyUsed"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { ExceptionPro.ExpLog(ex, new Action <string>((message) => { KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); }), false, Resources.GetRes().GetString("DeleteFailt")); return; } StartLoad(this, null); Task.Factory.StartNew(() => { try { ResultModel result = OperatesService.GetOperates().ServiceDelPrinter(Resources.GetRes().Printers.Where(x => x.PrinterId == Id).FirstOrDefault()); this.BeginInvoke(new Action(() => { if (result.Result) { KryptonMessageBox.Show(this, Resources.GetRes().GetString("DeleteSuccess"), Resources.GetRes().GetString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); Printer oldModel = Resources.GetRes().Printers.Where(x => x.PrinterId == Id).FirstOrDefault(); krpdgList.Rows.Remove(krpdgList.SelectedRows[0]); resultList.Remove(oldModel); Resources.GetRes().Printers.Remove(oldModel); ReloadPrinterTextbox(true); } else { if (result.IsDataHasRefrence) { KryptonMessageBox.Show(this, Resources.GetRes().GetString("PropertyUsed"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { KryptonMessageBox.Show(this, Resources.GetRes().GetString("DeleteFailt"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } } })); } catch (Exception ex) { this.BeginInvoke(new Action(() => { ExceptionPro.ExpLog(ex, new Action <string>((message) => { KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); }), false, Resources.GetRes().GetString("DeleteFailt")); })); } StopLoad(this, null); }); }
void Start() { m_workingPrinter = pc.originalPrinter.Clone(); pc.InitializeMotors(); }
public void ChangedToEditPrinter(Printer activePrinter, object state = null) { this.activePrinter = activePrinter; UiThread.RunOnIdle(DoChangeToEditPrinter, state); }
/// <summary> /// 控件外部静默赋值 /// </summary> /// <param name="value"></param> public void SetSelectedPrinter_Inner_Slient(Printer value) { _SelectedPrinter_Inner = value; this.OnPropertyChanged(nameof(SelectedPrinter_Inner)); }
/// <summary> /// Prints this node using a <see cref="Printer"/>. /// </summary> /// <param name="printer">The <see cref="Printer"/> to print this node with.</param> /// <returns>This node printed by <see cref="Printer"/>.</returns> public abstract string Print(Printer printer);
public void EditPrinter(Printer printer) { PersistenceStrategiesFactory.GetPrinterPersistenceStrategy().Edit(printer); }
public void UpdateEngraverPOST_ShouldReturnSuccess() { // Arrange Mapper.Initialize(cfg => { cfg.CreateMap <Printer, PrinterViewModel>(); cfg.CreateMap <PrinterViewModel, Printer>(); cfg.CreateMap <ImpactPrinter, ImpactPrinterViewModel>(); cfg.CreateMap <ImpactPrinterViewModel, ImpactPrinter>(); cfg.CreateMap <Engraver, EngraverViewModel>(); cfg.CreateMap <EngraverViewModel, Engraver>(); cfg.CreateMap <VinylCutter, VinylCutterViewModel>(); cfg.CreateMap <VinylCutterViewModel, VinylCutter>(); cfg.CreateMap <User, UserViewModel>(); cfg.CreateMap <UserViewModel, User>(); }); var controller = new AdminController(mockedHttpContext.Object, mockedProvider.Object, mockedUsersService.Object, mockedMapper.Object, mockedPrinterService.Object, mockedImpactPrinterService.Object, mockedEngraverService.Object, mockedVinylCutterService.Object); // Act var printer = new Printer(); var impactPrinter = new ImpactPrinter(); var engraver = new Engraver(); var cutter = new VinylCutter(); var user = new User(); var printersCollection = new List <Printer>() { printer }; var impactPrintersCollection = new List <ImpactPrinter>() { impactPrinter }; var engraversCollection = new List <Engraver>() { engraver }; var cuttersCollection = new List <VinylCutter>() { cutter }; var userssCollection = new List <User>() { user }; mockedPrinterService.Setup(c => c.GetAll()).Returns(printersCollection.AsQueryable()); mockedImpactPrinterService.Setup(c => c.GetAll()).Returns(impactPrintersCollection.AsQueryable()); mockedEngraverService.Setup(c => c.GetAll()).Returns(engraversCollection.AsQueryable()); mockedVinylCutterService.Setup(c => c.GetAll()).Returns(cuttersCollection.AsQueryable()); mockedUsersService.Setup(c => c.GetAll()).Returns (userssCollection.AsQueryable()); //Assert controller .WithCallTo(c => c.UpdateEngraver(engraver)).ShouldRenderPartialView("_Success"); }
public void Index_ShouldReturnsTrue_WhenUsers_AreValid() { // Arrange Mapper.Initialize(cfg => { cfg.CreateMap <Printer, PrinterViewModel>(); cfg.CreateMap <PrinterViewModel, Printer>(); cfg.CreateMap <ImpactPrinter, ImpactPrinterViewModel>(); cfg.CreateMap <ImpactPrinterViewModel, ImpactPrinter>(); cfg.CreateMap <Engraver, EngraverViewModel>(); cfg.CreateMap <EngraverViewModel, Engraver>(); cfg.CreateMap <VinylCutter, VinylCutterViewModel>(); cfg.CreateMap <VinylCutterViewModel, VinylCutter>(); cfg.CreateMap <User, UserViewModel>(); cfg.CreateMap <UserViewModel, User>(); }); var controller = new AdminController(mockedHttpContext.Object, mockedProvider.Object, mockedUsersService.Object, mockedMapper.Object, mockedPrinterService.Object, mockedImpactPrinterService.Object, mockedEngraverService.Object, mockedVinylCutterService.Object); // Act var printer = new Printer(); var impactPrinter = new ImpactPrinter(); var engraver = new Engraver(); var cutter = new VinylCutter(); var user = new User(); var printersCollection = new List <Printer>() { printer }; var impactPrintersCollection = new List <ImpactPrinter>() { impactPrinter }; var engraversCollection = new List <Engraver>() { engraver }; var cuttersCollection = new List <VinylCutter>() { cutter }; var userssCollection = new List <User>() { user }; mockedPrinterService.Setup(c => c.GetAll()).Returns(printersCollection.AsQueryable()); mockedImpactPrinterService.Setup(c => c.GetAll()).Returns(impactPrintersCollection.AsQueryable()); mockedEngraverService.Setup(c => c.GetAll()).Returns(engraversCollection.AsQueryable()); mockedVinylCutterService.Setup(c => c.GetAll()).Returns(cuttersCollection.AsQueryable()); mockedUsersService.Setup(c => c.GetAll()).Returns (userssCollection.AsQueryable()); var guid = new Guid(); guid = Guid.Parse(user.Id); //Assert controller .WithCallTo(c => c.Index("User", guid)).ShouldReturnJson(); }
public FrmProgress(string printerName, Printer printer) { InitializeComponent(); _printer = printer; _lblPrinter.Text = "Printer " + printerName + " Is Printing Now"; }
public static void Test() { #region Lecture1 Printer p = Print; p += Print; p += PrintTwice; p += Print; p += PrintTwice; p += Print; p -= Print; p("Message"); Delegate[] delegates = p.GetInvocationList(); foreach (var del in delegates) { //Console.WriteLine(del.Method); } #endregion Lecture1 #region Lecture2 CheckLengthOfString d = LessThanFive; d += MoreThanFive; d += ExactlyFive; /* Hard Way * List<bool> results = new List<bool>(); * * foreach(var del in d.GetInvocationList()) * { * results.Add((bool)del.DynamicInvoke("Message")); * } */ /* Static Way * List<bool> results = d.GetInvocationList().Select(del => (bool)del.DynamicInvoke("Message")).ToList(); */ /* Generic Way */ List <bool> results = GottaCatchEmAll <bool>(d, "Message"); Console.WriteLine(string.Join(", ", results)); GetLengths g = x => x.Length; g += x => x.Length + 1; g += x => x.Length + 2; List <int> lengths = GottaCatchEmAll <int>(g, "Message"); Console.WriteLine(string.Join(", ", g)); Console.WriteLine(d("Message")); #endregion Lecture2 #region Lecture 3 Action <string> printer = Print; printer += PrintTwice; printer("Message"); #endregion Lecture 3 }
void imprimirTicket(Pagos pago) { CContratos cContratos = new CContratos(); con contrato = new con(); CCuota cCuota = new CCuota(); Cuotas c = new Cuotas(); c = cCuota.ObtenerUna(pago.IdCuota_FK); contrato = cContratos.uno(c.IdContrato_FK); CConfiguracion cConfiguracion = new CConfiguracion(); Configuracion config = cConfiguracion.ObtenerConfiguracion(); Printer printer = new Printer(config.Impresora); CCorrelativo ccorrelativo = new CCorrelativo(); Correlativo correlativo = ccorrelativo.ObtenerUna(pago.IdCorrelativo_FK); printer.AlignCenter(); printer.Append(" "); printer.Append(" "); printer.Append(" "); printer.BoldMode(config.NombreEmpresa); printer.BoldMode(config.municipio); //Bitmap image = new Bitmap(Bitmap.FromFile("Icon.bmp")); //printer.Image(image); printer.Append(config.Direccion); printer.Append("TELEFONO: " + config.Telefono); printer.Append("NIT:" + config.NIT); printer.Append("NRC:" + config.NRC); printer.Append("Fecha:" + pago.FechaPago); printer.Append("Ticket #" + pago.Correlativo); printer.Append("Cliente:" + contrato.NombreCompleto); printer.Append("--------------------------------------"); printer.AlignLeft(); printer.Append("Descripción del pago"); printer.Append("Total cancelado = $" + pago.Monto.ToString("F")); // printer.Append("Cuota con vencimiento al " + c.Fecha.Value.ToString()); if (pago.Comentario != null) { printer.Append("--------------"); printer.Append("Información:" + pago.Comentario); printer.Append("--------------"); } printer.Append("A intereses = $" + pago.AIntereses.ToString("F")); printer.Append("A capital = $" + pago.ACapital.ToString("F")); printer.Append("Abono extra a capital = $" + pago.ACApitalExtra.ToString("F")); printer.Append("--------------"); printer.Append("Capital pendiente = $" + pago.CapitalRestante.ToString("F")); printer.AlignCenter(); printer.Append("--------------------------------------"); printer.AlignLeft(); printer.Append("Ventas Afectas:" + pago.Monto); printer.Append("Ventas Exentas:" + "0.00"); printer.AlignCenter(); printer.Append("--------------------------------------"); printer.AlignLeft(); printer.Append("Recibido:" + pago.Recibido); printer.Append("Cambio:" + pago.Cambio); printer.AlignCenter(); printer.Append(" "); printer.Append(" "); printer.Append(" "); printer.Append("Gracias por su pago"); printer.Append(" "); printer.Append(" "); printer.Append(" "); printer.Append("Resolución: " + correlativo.Resolucion); printer.Append("Del " + "0000001 al " + correlativo.Fin); printer.Append("Autorización:" + correlativo.Autorizacion); printer.Append("Fecha de resolución:" + correlativo.FechaDeAutorizacion.ToString()); printer.Append(" "); printer.Append(" "); printer.FullPaperCut(); try { printer.PrintDocument(); } catch (Exception) { } }
public void ChangeToAddPrinter() { this.activePrinter = null; UiThread.RunOnIdle(DoChangeToAddPrinter); }
public bool Run(System.IO.DirectoryInfo workingDirectory, object options) { RemoteCommandVerbOptions localOptions = options as RemoteCommandVerbOptions; Printer.EnableDiagnostics = localOptions.Verbose; IRemoteClient client = null; Area ws = null; if (NeedsWorkspace) { ws = Area.Load(workingDirectory, Headless); if (ws == null) { Printer.Write(Printer.MessageType.Error, string.Format("#x#Error:##\n The current directory #b#`{0}`## is not part of a vault.\n", workingDirectory.FullName)); return(false); } } TargetDirectory = workingDirectory; bool requireRemoteName = false; LocalState.RemoteConfig config = null; if (ws != null) { config = ws.GetRemote(string.IsNullOrEmpty(localOptions.Remote) ? "default" : localOptions.Remote); if (UpdateRemoteTimestamp && config != null) { ws.UpdateRemoteTimestamp(config); } } if (config == null && string.IsNullOrEmpty(localOptions.Remote)) { requireRemoteName = true; } if (config == null && requireRemoteName) { Printer.PrintError("You must specify either a remote server or name."); return(false); } if (config == null) { config = new LocalState.RemoteConfig() { Module = localOptions.Remote } } ; if (ws == null) { // No workspace; must use Versionr Client client = new Client(workingDirectory); if (!((Client)client).Connect(config.URL, RequiresWriteAccess)) { client = null; } } else { client = ws.Connect(config.URL, RequiresWriteAccess); URL = config.URL; } if (client == null || !client.Connected) { Printer.PrintError("Couldn't connect to server:## #b#{0}##", config.URL); return(false); } bool result = RunInternal(client, localOptions); client.Close(); return(result); }
public ReportPrinter WithPrinter(Printer printer) { _printer = printer; return(this); }
private static void EventAction(object sender, EventArgs e) { Printer.WriteTitle("SALIENDO"); Printer.Beep(3000, 1000, 3); Printer.WriteTitle("SALIO"); }
/// <summary> /// 保存新增或改动的数据 /// </summary> private void Save() { if (null != krpdgList.SelectedRows[0]) { //如果是插入 if (krpdgList.SelectedRows[0].Cells["krpcmPrinterId"].Value.ToString().Equals("-1")) { Printer model = new Printer(); try { // 隐藏功能时先把必要的复制掉(比如语言) Common.GetCommon().CopyForHide(krpdgList.SelectedRows[0].Cells["krpcmPrinterName0"], krpdgList.SelectedRows[0].Cells["krpcmPrinterName1"], krpdgList.SelectedRows[0].Cells["krpcmPrinterName2"], true, false, krpcbMultipleLanguage.Checked); model.PrinterId = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmPrinterId"].Value.ToString()); model.PrinterName0 = krpdgList.SelectedRows[0].Cells["krpcmPrinterName0"].Value.ToString().Trim(); model.PrinterName1 = krpdgList.SelectedRows[0].Cells["krpcmPrinterName1"].Value.ToString().Trim(); model.PrinterName2 = krpdgList.SelectedRows[0].Cells["krpcmPrinterName2"].Value.ToString().Trim(); model.PrinterDeviceName = krpdgList.SelectedRows[0].Cells["krpcmPrinterDeviceName"].Value.ToString().Trim(); model.PrintType = GetPrintTypeNo(krpdgList.SelectedRows[0].Cells["krpcmPrintType"].Value.ToString()); model.IsMain = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmIsMain"].Value.ToString()); model.IsCashDrawer = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmIsCashDrawer"].Value.ToString()); model.Lang = GetLanguageNo(krpdgList.SelectedRows[0].Cells["krpcmLang"].Value.ToString()); model.Order = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmOrder"].Value.ToString()); model.IsEnable = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmIsEnable"].Value.ToString()); //判断空 if (string.IsNullOrWhiteSpace(model.PrinterName0) || string.IsNullOrWhiteSpace(model.PrinterName1) || string.IsNullOrWhiteSpace(model.PrinterName2) || string.IsNullOrWhiteSpace(model.PrinterDeviceName)) { KryptonMessageBox.Show(this, Resources.GetRes().GetString("CompleteInput"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //判断是否已存在 if (Resources.GetRes().Printers.Where(x => (x.PrinterName0.Equals(model.PrinterName0, StringComparison.OrdinalIgnoreCase) || x.PrinterName1.Equals(model.PrinterName1, StringComparison.OrdinalIgnoreCase) || x.PrinterName2.Equals(model.PrinterName2, StringComparison.OrdinalIgnoreCase))).Count() > 0) { KryptonMessageBox.Show(this, string.Format(Resources.GetRes().GetString("PropertyExists"), Resources.GetRes().GetString("PrinterName")), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (model.IsCashDrawer == 1 && model.PrintType != 0) { krpdgList.SelectedRows[0].Cells["krpcmIsCashDrawer"].Value = "0"; model.IsCashDrawer = 0; } if (model.IsCashDrawer == 1 && Resources.GetRes().Printers.Where(x => x.IsCashDrawer == 1).Count() > 0) { KryptonMessageBox.Show(this, string.Format(Resources.GetRes().GetString("PropertyExists"), Resources.GetRes().GetString("CashDrawer")), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { ExceptionPro.ExpLog(ex, new Action <string>((message) => { KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); }), false, Resources.GetRes().GetString("SaveFailt")); return; } StartLoad(this, null); Task.Factory.StartNew(() => { try { bool result = OperatesService.GetOperates().ServiceAddPrinter(model); this.BeginInvoke(new Action(() => { if (result) { krpdgList.SelectedRows[0].Cells["krpcmPrinterId"].Value = model.PrinterId; KryptonMessageBox.Show(this, Resources.GetRes().GetString("SaveSuccess"), Resources.GetRes().GetString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); krpdgList.SelectedRows[0].Cells["krpcmEdit"].Value = ""; resultList.Insert(0, model); Resources.GetRes().Printers.Add(model); ReloadPrinterTextbox(true); } else { KryptonMessageBox.Show(this, Resources.GetRes().GetString("SaveFailt"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } })); } catch (Exception ex) { this.BeginInvoke(new Action(() => { ExceptionPro.ExpLog(ex, new Action <string>((message) => { KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); }), false, Resources.GetRes().GetString("SaveFailt")); })); } StopLoad(this, null); }); } //如果是编辑 else { Printer model = new Printer(); try { model.PrinterId = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmPrinterId"].Value.ToString()); model = Resources.GetRes().Printers.Where(x => x.PrinterId == model.PrinterId).FirstOrDefault().FastCopy(); // 隐藏功能时先把必要的复制掉(比如语言) Common.GetCommon().CopyForHide(krpdgList.SelectedRows[0].Cells["krpcmPrinterName0"], krpdgList.SelectedRows[0].Cells["krpcmPrinterName1"], krpdgList.SelectedRows[0].Cells["krpcmPrinterName2"], false, Ext.AllSame(model.PrinterName0, model.PrinterName1, model.PrinterName2), krpcbMultipleLanguage.Checked); model.PrinterName0 = krpdgList.SelectedRows[0].Cells["krpcmPrinterName0"].Value.ToString().Trim(); model.PrinterName1 = krpdgList.SelectedRows[0].Cells["krpcmPrinterName1"].Value.ToString().Trim(); model.PrinterName2 = krpdgList.SelectedRows[0].Cells["krpcmPrinterName2"].Value.ToString().Trim(); model.PrinterDeviceName = krpdgList.SelectedRows[0].Cells["krpcmPrinterDeviceName"].Value.ToString().Trim(); model.PrintType = GetPrintTypeNo(krpdgList.SelectedRows[0].Cells["krpcmPrintType"].Value.ToString()); model.IsMain = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmIsMain"].Value.ToString()); model.IsCashDrawer = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmIsCashDrawer"].Value.ToString()); model.Lang = GetLanguageNo(krpdgList.SelectedRows[0].Cells["krpcmLang"].Value.ToString()); model.Order = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmOrder"].Value.ToString()); model.IsEnable = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmIsEnable"].Value.ToString()); //判断空 if (string.IsNullOrWhiteSpace(model.PrinterName0) || string.IsNullOrWhiteSpace(model.PrinterName1) || string.IsNullOrWhiteSpace(model.PrinterName2) || string.IsNullOrWhiteSpace(model.PrinterDeviceName)) { KryptonMessageBox.Show(this, Resources.GetRes().GetString("CompleteInput"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //判断是否已存在 if (Resources.GetRes().Printers.Where(x => x.PrinterId != model.PrinterId && (x.PrinterName0.Equals(model.PrinterName0, StringComparison.OrdinalIgnoreCase) || x.PrinterName1.Equals(model.PrinterName1, StringComparison.OrdinalIgnoreCase) || x.PrinterName2.Equals(model.PrinterName2, StringComparison.OrdinalIgnoreCase))).Count() > 0) { KryptonMessageBox.Show(this, string.Format(Resources.GetRes().GetString("PropertyExists"), Resources.GetRes().GetString("PrinterName")), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (model.IsCashDrawer == 1 && model.PrintType != 0) { krpdgList.SelectedRows[0].Cells["krpcmIsCashDrawer"].Value = "0"; model.IsCashDrawer = 0; } if (model.IsCashDrawer == 1 && Resources.GetRes().Printers.Where(x => x.IsCashDrawer == 1 && x.PrinterId != model.PrinterId).Count() > 0) { KryptonMessageBox.Show(this, string.Format(Resources.GetRes().GetString("PropertyExists"), Resources.GetRes().GetString("CashDrawer")), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { ExceptionPro.ExpLog(ex, new Action <string>((message) => { KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); }), false, Resources.GetRes().GetString("SaveFailt")); return; } StartLoad(this, null); Task.Factory.StartNew(() => { try { ResultModel result = OperatesService.GetOperates().ServiceEditPrinter(model); this.BeginInvoke(new Action(() => { if (result.Result) { KryptonMessageBox.Show(this, Resources.GetRes().GetString("SaveSuccess"), Resources.GetRes().GetString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); krpdgList.SelectedRows[0].Cells["krpcmEdit"].Value = ""; Printer oldModel = resultList.Where(x => x.PrinterId == model.PrinterId).FirstOrDefault(); int no = resultList.IndexOf(oldModel); resultList.RemoveAt(no); resultList.Insert(no, model); no = Resources.GetRes().Printers.IndexOf(oldModel); Resources.GetRes().Printers.RemoveAt(no); Resources.GetRes().Printers.Insert(no, model); ReloadPrinterTextbox(true); } else { if (result.UpdateModel) { KryptonMessageBox.Show(this, Resources.GetRes().GetString("PropertyUnSame"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { KryptonMessageBox.Show(this, Resources.GetRes().GetString("SaveFailt"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } } })); } catch (Exception ex) { this.BeginInvoke(new Action(() => { ExceptionPro.ExpLog(ex, new Action <string>((message) => { KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); }), false, Resources.GetRes().GetString("SaveFailt")); })); } StopLoad(this, null); }); } } }
public static void Run() { // 帳票定義ファイルを読み込みます Report report = new Report(Json.Read("report\\example1.rrpt")); // 帳票にデータを渡します report.Fill(new ReportDataSource(getDataTable())); // ページ分割を行います ReportPages pages = report.GetPages(); // PDF出力 using (FileStream fs = new FileStream("output\\example1.pdf", FileMode.Create)) { PdfRenderer renderer = new PdfRenderer(fs); // バックスラッシュ文字を円マーク文字に変換します renderer.Setting.ReplaceBackslashToYen = true; pages.Render(renderer); } // XLS出力 using (FileStream fs = new FileStream("output\\example1.xls", FileMode.Create)) { HSSFWorkbook workbook = new HSSFWorkbook(); XlsRenderer renderer = new XlsRenderer(workbook); // Renderメソッドを呼ぶ前に必ずNewSheetメソッドを呼んでワークシートを作成します renderer.NewSheet("見積書"); pages.Render(renderer); workbook.Write(fs); } // XLSX出力 using (FileStream fs = new FileStream("output\\example1.xlsx", FileMode.Create)) { XSSFWorkbook workbook = new XSSFWorkbook(); XlsxRenderer renderer = new XlsxRenderer(workbook); // Renderメソッドを呼ぶ前に必ずNewSheetメソッドを呼んでワークシートを作成します renderer.NewSheet("見積書"); pages.Render(renderer); workbook.Write(fs); } // 直接印刷、プレビュー画面表示 { Printer printer = new Printer(pages); //// 直接印刷 //// ダイアログを出して印刷します //if (printer.PrintDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) //{ // printer.PrintDocument.Print(); //} //// ダイアログを出さずに印刷します //printer.PrintDocument.Print(); // プレビュー画面表示 FmPrintPreview preview = new FmPrintPreview(printer); // プレビュー画面が開かれた時点で表示倍率を現在のウィンドウサイズに合わせます preview.StartUpZoomFit = true; preview.ShowDialog(); } }
static void Main(string[] args) { FakeDB.InitData(); var printer = new Printer(new PetService(new PetRepository())); }
public Problem(bool isGCJ, Printer printer) : this(isGCJ, new Scanner(), printer) { }
public static void Main() { Printer printer = new Printer(); printer.PrintBoolValue(true); }
public void Run() { Printer.Write(ConfigurationManager.AppSettings["ExceptionTasksStr"]); DoTask4(); DoTask5(); }
private void Page_Unloaded(object sender, RoutedEventArgs e) { Printer.ClosePrinter(); }
protected override void PrintMenuBody() { Printer.PrintLine($"{(int)LeafMenuOptions.Describe}: Describe"); }
protected override void PrintMenuHeader() { Printer.PrintLine("ADD TAKEOFF MENU"); }
public static void ImportPrinter(Printer printer, ProfileManager profileData, string profilePath) { var printerInfo = new PrinterInfo() { Name = printer.Name, ID = printer.Id.ToString(), Make = printer.Make ?? "", Model = printer.Model ?? "", }; profileData.Profiles.Add(printerInfo); var printerSettings = new PrinterSettings() { OemLayer = LoadOemLayer(printer) }; printerSettings.OemLayer[SettingsKey.make] = printerInfo.Make; printerSettings.OemLayer[SettingsKey.model] = printer.Model; LoadQualitySettings(printerSettings, printer); LoadMaterialSettings(printerSettings, printer); printerSettings.ID = printer.Id.ToString(); printerSettings.UserLayer[SettingsKey.printer_name] = printer.Name ?? ""; printerSettings.UserLayer[SettingsKey.baud_rate] = printer.BaudRate ?? ""; printerSettings.UserLayer[SettingsKey.auto_connect] = printer.AutoConnect ? "1" : "0"; printerSettings.UserLayer[SettingsKey.default_material_presets] = printer.MaterialCollectionIds ?? ""; printerSettings.UserLayer[SettingsKey.windows_driver] = printer.DriverType ?? ""; printerSettings.UserLayer[SettingsKey.device_token] = printer.DeviceToken ?? ""; printerSettings.UserLayer[SettingsKey.device_type] = printer.DeviceType ?? ""; // Open the first imported printer if no active printer if (!ApplicationController.Instance.ActivePrinters.Any()) { ApplicationController.Instance.OpenEmptyPrinter(printer.Id.ToString()).ConfigureAwait(false); } // Import macros from the database var allMacros = Datastore.Instance.dbSQLite.Query <CustomCommands>("SELECT * FROM CustomCommands WHERE PrinterId = " + printer.Id); printerSettings.Macros = allMacros.Select(macro => new GCodeMacro() { GCode = macro.Value.Trim(), Name = macro.Name, LastModified = macro.DateLastModified }).ToList(); string query = string.Format("SELECT * FROM PrinterSetting WHERE Name = 'PublishBedImage' and PrinterId = {0};", printer.Id); var publishBedImage = Datastore.Instance.dbSQLite.Query <PrinterSetting>(query).FirstOrDefault(); printerSettings.UserLayer[SettingsKey.publish_bed_image] = publishBedImage?.Value == "true" ? "1" : "0"; printerSettings.UserLayer[SettingsKey.print_leveling_enabled] = printer.DoPrintLeveling ? "true" : "false"; printerSettings.UserLayer[SettingsKey.manual_movement_speeds] = printer.ManualMovementSpeeds; // make sure we clear the one time settings printerSettings.OemLayer[SettingsKey.spiral_vase] = ""; printerSettings.OemLayer[SettingsKey.layer_to_pause] = ""; // TODO: Where can we find CalibrationFiiles in the current model? //layeredProfile.SetActiveValue(""calibration_files"", ???); printerSettings.ID = printer.Id.ToString(); printerSettings.DocumentVersion = PrinterSettings.LatestVersion; printerSettings.Helpers.SetComPort(printer.ComPort); printerSettings.ClearBlackList(); printerSettings.Save(userDrivenChange: false); }
public DemoPrinterJob(Printer printer) : base(printer) { }
protected override void PrintMenuHeader() { Printer.PrintLine("Leaf MENU"); }