Skip to content

Commit

Permalink
settings and offline works
Browse files Browse the repository at this point in the history
  • Loading branch information
bryce.coon authored and bryce.coon committed Feb 15, 2024
1 parent b844a3b commit 39327b0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion MauiTickets/Components/Pages/MauiTicket.razor
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
//await service.ResetLocalTicketsDB();

await service.SyncDatabases();
//await service.SyncDatabases();
StateHasChanged();
}
Expand Down
2 changes: 1 addition & 1 deletion MauiTickets/Components/Pages/Settings.razor
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Please input the api that the data should pull from
<button @onclick="resetTickets">Reset local Tickets</button>

@code {
public bool isOnline;
public bool isOnline = true;
public int sFrequency = 15;
public string setAPI = "";
public string errorMessage = "";
Expand Down
4 changes: 3 additions & 1 deletion MauiTickets/Services/MauiTicketService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ private async Task SyncLocalToOnline(List<Ticket> onlineTickets, List<Ticket> lo
if ((onlineTickets.FirstOrDefault(q => q.Ticketnumber == ticket.Ticketnumber).IsScanned) != ticket.IsScanned)
{
//set the online ticket equal to local
await client.PutAsJsonAsync("/api/Ticket/updateticket", ticket);
Ticket tem = ticket;
tem.Id = onlineTickets.FirstOrDefault(q => q.Ticketnumber == ticket.Ticketnumber).Id;
await client.PutAsJsonAsync("/api/Ticket/updateticket", tem);
}
}
}
Expand Down
21 changes: 11 additions & 10 deletions TicketLibrary/Services/generateQRCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ public static string GenerateQRCodeBase64(string qrCodeText)
try
{

QRCodeGenerator qrCodeGenerate = new QRCodeGenerator();
QRCodeData qrCodeData = qrCodeGenerate.CreateQrCode(qrCodeText, QRCodeGenerator.ECCLevel.Q);
QRCode qrCode = new QRCode(qrCodeData);
QRCodeGenerator qrCodeGenerate = new QRCodeGenerator();
QRCodeData qrCodeData = qrCodeGenerate.CreateQrCode(qrCodeText, QRCodeGenerator.ECCLevel.Q);
QRCode qrCode = new QRCode(qrCodeData);

string appDataDirectory = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string filePath = Path.Combine(appDataDirectory, "QREmail.png");
string appDataDirectory = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string filePath = Path.Combine(appDataDirectory, "QREmail.png");

using (Bitmap qrBitMap = qrCode.GetGraphic(20))
{
qrBitMap.Save(filePath, ImageFormat.Png);
}
using (Bitmap qrBitMap = qrCode.GetGraphic(20))
{
qrBitMap.Save(filePath, ImageFormat.Png);
qrBitMap.Dispose();
}

return filePath;
return filePath;
}
catch (Exception ex)

Check warning on line 31 in TicketLibrary/Services/generateQRCode.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used

Check warning on line 31 in TicketLibrary/Services/generateQRCode.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used
{
Expand Down

0 comments on commit 39327b0

Please sign in to comment.