コード例 #1
0
        async void OnDeviceCloseClicked(object sender, EventArgs e)
        {
            await _printSemaphore.WaitAsync();

            if (_printer != null)
            {
                // If there's nothing to do with the printer, call "closeService" method to disconnect the communication between Host and Printer.
                await _printer.closeService();

                _printer = null;
                btnPrintText.IsEnabled = false;

                btnCloseService.IsEnabled = false;
                btnOpenService.IsEnabled  = true;
            }

            _printSemaphore.Release();
        }