示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try {
                address = IPAddress.Parse(txtIpAddress.Text);
                port    = int.Parse(txtPort.Text);

                if (transmitter != null)
                {
                    transmitter.Close();
                }

                transmitter = new OSCTransmitter(address.ToString(), port);

                //if(osc != null)
                //{
                //    osc.Close();
                //    osc.Dispose();
                //}
                //osc = new OscSender(address, port);
                //osc.Connect();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        private void InitNetwork()
        {
            if (!FAutoIP.Equals(FTargetIP) || FAutoPort != FTargetPort)
            {
                FTargetIP   = FAutoIP;
                FTargetPort = FAutoPort;

                if (FTargetIP != null)
                {
                    try
                    {
                        if (FOSCTransmitter != null)
                        {
                            FOSCTransmitter.Close();
                        }
                        FOSCTransmitter = new OSCTransmitter(FTargetIP.ToString(), FTargetPort);
                        FOSCTransmitter.Connect();

                        FLogger.Log(LogType.Debug, "connected to Kontrolleur on: " + FTargetIP.ToString() + ":" + FTargetPort.ToString());
                    }
                    catch (Exception e)
                    {
                        FLogger.Log(LogType.Warning, "Kontrolleur: failed to open port " + FTargetPort.ToString());
                        FLogger.Log(LogType.Warning, "Kontrolleur: " + e.Message);
                    }
                }
            }
        }
示例#3
0
 void TargetPortIOValueChanged(object sender, System.EventArgs e)
 {
     try
     {
         if (FOSCTransmitter != null)
         {
             FOSCTransmitter.Close();
         }
         FOSCTransmitter = null;
         FOSCTransmitter = new OSCTransmitter(TargetHostIO.Text, (int)(sender as NumericUpDown).Value);
     }
     catch (Exception se)
     {
         DebugLog.Items.Add("UDP: " + se.Message);
     }
 }
 void Disconnect()
 {
     if (FConnection != null)
     {
         FConnection.Close();
     }
     FConnection = null;
 }
示例#5
0
 void Window1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Escape)
     {
         _oscTransmitter.Close();
         Close();
     }
 }
示例#6
0
 void StopOSCTransmitter()
 {
     if (FOSCTransmitter != null)
     {
         FOSCTransmitter.Close();
         FOSCTransmitter = null;
     }
 }
示例#7
0
 /// <summary>
 /// Disconnect the UDP Transmitter.
 /// </summary>
 /// <returns></returns>
 private void disconnectTransmitter()
 {
     // Close any open connections.
     if (pUDPWriter != null)
     {
         pUDPWriter.Close();
     }
     pUDPWriter = null;
 }
示例#8
0
    public void disconnect()
    {
        if (transmitter != null)
        {
            transmitter.Close();
        }

        transmitter = null;
        connected   = false;
    }
示例#9
0
        void Close()
        {
            if (FRunning)
            {
                FRunning = false;
                FThread.Abort();

                FClient.Close();
                FClient = null;
            }
        }
示例#10
0
 public void disconnect()
 {
     if (pUDPWriter != null)
     {
         pUDPWriter.Close();
     }
     pUDPWriter = null;
     if (OnDisconnect != null)
     {
         OnDisconnect();
     }
 }
示例#11
0
        protected void OnDisable()
        {
            if (_transmitter == null)
            {
                _transmitter = target as OSCTransmitter;
            }

            if (!Application.isPlaying && _transmitter.IsStarted)
            {
                _transmitter.Close();
            }
        }
示例#12
0
 private void InitNetwork()
 {
     if (FIP != null)
     {
         try
         {
             if (FOSCTransmitter != null)
             {
                 FOSCTransmitter.Close();
             }
             FOSCTransmitter = new OSCTransmitter(FIP.ToString(), FTargetPort[0]);
             FOSCTransmitter.Connect();
         }
         catch (Exception e)
         {
             FLogger.Log(LogType.Warning, "PinServer: failed to open port " + FTargetPort.ToString());
             FLogger.Log(LogType.Warning, "PinServer: " + e.Message);
         }
     }
 }
示例#13
0
        void ThreadedFunction()
        {
            try
            {
                FClient = new OSCTransmitter(FPinInRemote[0], FPinInPort[0]);
                FClient.Connect();

                FRunning = true;
                lock (FLockStatus)
                    FStatus = "OK";
            }
            catch (Exception e)
            {
                lock (FLockStatus)
                    FStatus = e.Message;

                if (FClient != null)
                {
                    FClient.Close();
                }
                FRunning = false;
                return;
            }

            List <OSCPacket> copyList;

            while (FRunning)
            {
                lock (FLockPackets)
                {
                    copyList = new List <OSCPacket>(FPacketList);
                    FPacketList.Clear();
                }

                foreach (var p in copyList)
                {
                    FClient.Send(p);
                }
            }
        }
示例#14
0
        private void OscTransmitterConnect()
        {
            try
            {
                address = IPAddress.Parse(txtIpAddress.Text);
                port    = int.Parse(txtPort.Text);

                if (transmitter != null)
                {
                    transmitter.Close();
                }

                transmitter = new OSCTransmitter(address.ToString(), port);

                ShowStatusText("Connected: " + address + ":" + port);
                ToggleConnectView();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
            }
        }
 /// <summary>
 /// Closes the connection.
 /// </summary>
 public void Close()
 {
     connected = false;
     client.Close();
     server.Close();
 }