// ============================================ // Work.Ink Offer SDK - C# Example // ============================================ // Build: csc Example.cs // Run: Place work-ink-offer-sdk.dll in same folder using System; using System.Runtime.InteropServices; class WorkInkOfferSDK { // Import the native DLL function [DllImport("work-ink-offer-sdk.dll", CallingConvention = CallingConvention.Cdecl)] public static extern int runOffer(int pubId); } class Program { static void Main(string[] args) { Console.WriteLine("Work.Ink Offer SDK - C# Example"); Console.WriteLine("================================="); Console.WriteLine(); // Replace 1 with your actual publisher ID int publisherId = 1; Console.WriteLine($"Showing offer for publisher ID: {publisherId}"); try { int result = WorkInkOfferSDK.runOffer(publisherId); // Handle the result Console.WriteLine($"\nResult: {result}"); switch (result) { case 1: Console.WriteLine("✅ SUCCESS: User accepted and installer launched!"); // Continue with your application... break; case 0: Console.WriteLine("⚠️ PARTIAL: Installer launch failed, browser opened"); // Still count as acceptance, continue... break; case -1: Console.WriteLine("❌ DECLINED: User declined the offer"); // User declined, continue with your app... break; case -2: Console.WriteLine("🚪 CLOSED: User closed the window"); // User closed without decision... break; case -3: Console.WriteLine("🌐 API ERROR: Could not fetch offers"); // Network error or no offers available... break; default: Console.WriteLine("❓ UNKNOWN: Unexpected result"); break; } Console.WriteLine("\nContinuing with application..."); // Your application logic here } catch (DllNotFoundException) { Console.WriteLine("ERROR: work-ink-offer-sdk.dll not found!"); Console.WriteLine("Make sure the DLL is in the same folder as your executable."); } catch (Exception ex) { Console.WriteLine($"ERROR: {ex.Message}"); } } }