internal static bool GetConsumableBalance(MainWindow window, string itemid) { main = window; consumableBalanceCallback = new ConsumableBalanceCallback(GetSonsumableBalanceCallback); var ret = GetConsumableBalanceRemaining(itemid, consumableBalanceCallback); return(ret); }
static void GetSonsumableBalanceCallback(bool result, uint quantity, string msg) { main.Dispatcher.Invoke(() => { main.Logs("=====Get Consumable Balance================"); if (!result) { main.Logs("Error"); } main.Logs(msg); main.Logs("Remaining=" + quantity.ToString()); }); // Release delegate. // デリゲートの解放 var ds = consumableBalanceCallback.GetInvocationList(); foreach (var d in ds) { consumableBalanceCallback -= (ConsumableBalanceCallback)d; } }
static extern bool GetConsumableBalanceRemaining([MarshalAs(UnmanagedType.LPWStr)] string itemId, ConsumableBalanceCallback callback);