open pdf with hard-coded okular.exe

pull/1/head
DJh2o2 2022-02-10 14:43:41 +07:00
parent ae78e3d350
commit 13b38bfd1d
4 changed files with 52 additions and 15 deletions

@ -4,15 +4,12 @@ namespace Gremlin.MVVM
{
public class AppBootstrapper : BootstrapperBase
{
public AppBootstrapper()
{
Initialize();
}
public AppBootstrapper() => Initialize();
protected override void OnStartup(object sender, System.Windows.StartupEventArgs e)
{
//LogManager.GetLog = type => new DebugLog(type); //DEBUGGING
DisplayRootViewFor<ShellViewModel>();
_ = DisplayRootViewFor<ShellViewModel>();
}
}
}

@ -57,8 +57,16 @@ namespace Gremlin.Operations
process.StartInfo.FileName = "pdflatex";
process.StartInfo.Arguments = quoteVM.QuoteNumber;
process.StartInfo.UseShellExecute = true;
try { process.Start(); }
catch (Exception ex) { ErrorHandler.ShowErrorInMessageBox(ex); }
try
{
process.Start();
}
catch (Exception ex)
{
ErrorHandler.ShowErrorInMessageBox(ex);
}
process.WaitForExit();
}
}
@ -66,8 +74,20 @@ namespace Gremlin.Operations
public static void OpenPDF(QuoteViewModel quoteVM)
{
string pdfFile = $"explorer {quoteVM.QuotePath}";
Process.Start(pdfFile);
using (Process process = new())
{
process.StartInfo.WorkingDirectory = quoteVM.QuotePath;
process.StartInfo.FileName = @"C:\Program Files\Okular\bin\okular.exe";
process.StartInfo.Arguments = $"{quoteVM.QuoteNumber}.pdf";
try
{
process.Start();
}
catch (Exception ex)
{
ErrorHandler.ShowErrorInMessageBox(ex);
}
}
}
}
}

@ -64,6 +64,10 @@ namespace Gremlin.MVVM
{
Random random = new();
SalesRep = salesRep;
//Debug-Standard
SalesRep.LastName = "Woitschetzki";
QuoteNumber = SalesRep.LastName switch
{
"Woitschetzki" => $"DE-83PE89-{DateTime.Now:My}-{random.Next(999999)}",
@ -116,11 +120,24 @@ namespace Gremlin.MVVM
foreach (LineItemViewModel lineItemVM in lineItemsVM)
{
// normale Gewährleistungsverlängerung
if (lineItemVM.OptionNumber.StartsWith("8D"))
{
quoteVM.Warranty = int.Parse(lineItemVM.OptionNumber.Last().ToString()) * 12;
}
//24 Monate Gewährleistung für Akademia
if (lineItemVM.OptionNumber == "9EC")
{
quoteVM.Warranty = 24;
}
//36 Monate Gewährleistung für Akademia
if (lineItemVM.OptionNumber == "9CC")
{
quoteVM.Warranty = 36;
}
quoteVM.LineItemsViewModel.Add(lineItemVM);
}

@ -18,7 +18,8 @@ namespace Gremlin.MVVM
private QuoteViewModel _quoteVM;
private string _searchContact;
public string SearchContact {
public string SearchContact
{
get => _searchContact;
set {
_searchContact = value;
@ -27,7 +28,8 @@ namespace Gremlin.MVVM
}
}
public QuoteViewModel QuoteVM {
public QuoteViewModel QuoteVM
{
get => _quoteVM;
set {
_quoteVM = value;
@ -35,7 +37,8 @@ namespace Gremlin.MVVM
}
}
public ContactViewModel SelectedContact {
public ContactViewModel SelectedContact
{
get => _selectedContact;
set {
_selectedContact = value;
@ -45,7 +48,8 @@ namespace Gremlin.MVVM
}
}
public ObservableCollection<ContactViewModel> Contacts {
public ObservableCollection<ContactViewModel> Contacts
{
get => _contacts;
set {
_contacts = value;
@ -77,7 +81,7 @@ namespace Gremlin.MVVM
contactsVM.Add(ContactViewModel.ConvertContactToVM(contact));
}
Debug.WriteLine($"Es wurden {contactsVM.Count} Kontakte geladen.");
//Debug.WriteLine($"Es wurden {contactsVM.Count} Kontakte geladen.");
return contactsVM;
}
}
@ -89,7 +93,6 @@ namespace Gremlin.MVVM
}
}
public void CreateTex()
{
TexHandler.CreateTexAndOpen(QuoteVM);