private async Task <FileTransferControlOptions> StrokesReceivedAsync(InkDocument inkDocument, Exception fileTransferException)
        {
            if (fileTransferException is FileTransferException)
            {
                if (m_retryCounter < 3)
                {
                    m_retryCounter++;
                    return(FileTransferControlOptions.Retry);
                }
            }

            m_retryCounter = 0;

            if (fileTransferException != null)
            {
                return(FileTransferControlOptions.Continue);
            }

            // swap document width and height
            if (inkDocument != null)
            {
                Rect bounds = inkDocument.Bounds;
                inkDocument.Bounds = new Rect(0, 0, bounds.Height, bounds.Width);
            }

            await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                InkDocumentDisplayItem item = (inkDocument == null) ?
                                              new InkDocumentDisplayItem(fileTransferException.Message) :
                                              new InkDocumentDisplayItem(inkDocument);

                listView.Items.Add(item);

                listView.SelectedIndex = listView.Items.Count - 1;
            });

            return(FileTransferControlOptions.Continue);
        }
 public InkDocumentDisplayItem(InkDocument document)
 {
     Id           = Interlocked.Increment(ref _documentCounter);
     Document     = document;
     ErrorMessage = string.Empty;
 }