private void PresenceByeSend()
        {
            byte[] buffer;
            TTNet.GeneratePresenceBuffer(MacAddress, out buffer, TTInstruction.Discovery_Bye);

            socketUDP.SendTo(buffer, PresenceEndPoint);
        }
        private void PresenceHelloSend()
        {
            byte[] buffer;
            TTNet.GeneratePresenceBuffer(MacAddress, out buffer, TTInstruction.Discovery_Hello, Settings.SettingsData.Name, DeviceType);

            socketUDP.SendTo(buffer, PresenceEndPoint);
        }
        private void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            SetSendButtonEnabled(true);

            InitializeNetworkInfo();

            // TCP
            transferServer = new TransferServer(IPAddress, Settings.SettingsData.NetworkTransferPort, Settings.SettingsData.MaxNetworkPingMs, Settings.SettingsData.MaxBufferSize, TransferProgress);
            transferServer.OnRecordableEvent += OnRecordableEvent;
            transferServer.Start();
            transferClient = new TransferClient(Settings.SettingsData.NetworkTransferPort, Settings.SettingsData.MaxNetworkPingMs, Settings.SettingsData.MaxBufferSize, TransferProgress);
            transferClient.OnRecordableEvent += OnRecordableEvent;

            TTNet.GeneratePresenceBuffer(MacAddress, out PresenceBuffer, TTInstruction.Discovery_Present, Settings.SettingsData.Name, DeviceType);
            PresenceTimer                      = new Timer(new TimerCallback(PresenceSend), null, 2000, Settings.SettingsData.PresenceSendPeriod);
            PresenceTimeoutCheckTimer          = new Timer(new TimerCallback(PresenceTimeoutTick), null, Settings.SettingsData.MaxNetworkPingMs, Settings.SettingsData.PresenceTimeoutCheckPeriod);
            presenceReceiveThread              = new Thread(new ThreadStart(PresenceReceiveLoop));
            presenceReceiveThread.IsBackground = true;
            presenceReceiveThread.Start();
            PresenceHelloSend();
        }