Closed Noemata closed 7 years ago
Hi @Noemata, thanks for submitting your changes. While this may be a matter of personal preference, I tend to avoid unnecessary awaits in handlers for UI or networking functions, as blocking here can cause hangs in the interface or slow network data handling. If you encountered a bug however please do let me know so we can address it.
Thanks, James
For anyone interested in the data channel sample, here is the cleaned up code. I didn't bother with a pull request because I've noticed Microsoft isn't devoting much attention to this project.
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using System.Threading.Tasks; using Org.Ortc; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.Networking; using Windows.Networking.Connectivity; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; using DataChannelOrtc.Signalling;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace DataChannelOrtc { ///
/// An empty page that can be used on its own or navigated to within a Frame.
///
public sealed partial class MainPage : Page, INotifyPropertyChanged
{
RTCIceGatherer _gatherer;
RTCIceTransport _ice; // Ice transport for the currently selected peer.
RTCDtlsTransport _dtls;
RTCSctpTransport _sctp;
RTCDataChannel _dataChannel; // Data channel for the currently selected peer.
bool _isInitiator = false; // True for the client that started the connection.
}