Skip to content

Commit

Permalink
return bpac code
Browse files Browse the repository at this point in the history
  • Loading branch information
limenet committed Jun 4, 2017
1 parent b33b7a9 commit 3431e47
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ private void Form1_Load(object sender, EventArgs e)

if (args.GetLength(0) >= 3)
{
int exitCode = (new PrinterAPI(args[1], args[2], args.Length > 3 ? args[3] : null, args.Length > 4 ? Int32.Parse(args[4]) : 1).print()) ? 0 : 1;
int exitCode = new PrinterAPI(args[1], args[2], args.Length > 3 ? args[3] : null, args.Length > 4 ? Int32.Parse(args[4]) : 1).print();
Close();
Program.ExitApplication(exitCode);
}
}
Expand Down
6 changes: 3 additions & 3 deletions PrinterAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public PrinterAPI(string title, string barcode, string timestamp = null, int cou
this.count = count;
}

public bool print()
public int print()
{
bpac.DocumentClass doc = new DocumentClass();
string templatePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\" + doc.Printer.GetMediaId().ToString() + ".lbx";
Expand All @@ -34,11 +34,11 @@ public bool print()
doc.PrintOut(count, printOptions);
doc.EndPrint();
doc.Close();
return true;
return doc.ErrorCode;
}

MessageBox.Show("Open() Error: " + doc.ErrorCode + "\nMedia ID" + doc.Printer.GetMediaId().ToString());
return false;
return doc.ErrorCode;
}
}
}

0 comments on commit 3431e47

Please sign in to comment.