public MessageBoxPack(MessageBoxPack mbp) { this.messageBoxText = mbp.messageBoxText; this.caption = mbp.caption; this.button = mbp.button; this.icon = mbp.icon; }
/// <summary> /// キューに送られたとおりに非同期でメッセージボックスを表示します /// </summary> /// <param name="mbp">パック済みの内容</param> public static void AddMessageBoxQueue(MessageBoxPack mbp) { MessageBoxQueue.Enqueue(mbp); if (GetLockState() == false) { ShowMessageBoxAsync(); } }
private static async void ShowMessageBoxAsync() { await Task.Run(() => { Lock(); while (true) { var mbp = new MessageBoxPack(MessageBoxQueue.Dequeue()); var result = System.Windows.MessageBox.Show(mbp.messageBoxText, mbp.caption, mbp.button, mbp.icon); if (MessageBoxQueue.Count == 0) { break; } } Unlock(); }); }