Пример #1
0
        /******************************************************************
        ** Animations
        ******************************************************************/
        private string[] getAnimationsList(FTPClient ftp)
        {
            if (ftp != null)
            {
                List<string> list = new List<string>();

                string[] filesList = ftpClient.directoryListSimple("");

                foreach (string file in filesList)
                {
                    if (file.Contains(animationFileExtension))
                    {
                        list.Add(file.Replace(animationFileExtension, ""));
                    }
                }

                return list.ToArray();
            }

            return null;
        }
Пример #2
0
        public void TCPSocketClose()
        {
            if (tcpSocket != null)
            {
                tcpSocket.Close();
                tcpSocket = null;

                ftpClient = null;
            }
        }
Пример #3
0
        public void TCPConnectDevice()
        {
            try
            {
                string ipAddress = cbDevicesIP.Items[cbDevicesIP.SelectedIndex].ToString();

                IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse(ipAddress), TCPPort);
                tcpSocket = new TcpClient();
                tcpSocket.Connect(endPoint);

                tcpSocketThread = new Thread(new ParameterizedThreadStart(TCPSocketHandler));
                tcpSocketThread.IsBackground = true;
                tcpSocketThread.Start(tcpSocket);

                btnConnectDevice.Text = "Disconnect";
                cbDevicesIP.Enabled = false;
                btnScanDevices.Enabled = false;

                AddLog("Connect to device");

                ftpClient = new FTPClient("ftp://" + cbDevicesIP.SelectedItem.ToString(), ftpUsername, ftpPassword);

                loadAnimationsList();

                cbAnimationsList.Enabled = true;
                btnRefreshAnimationsList.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());

                btnConnectDevice.Text = "Connect";
                btnScanDevices.Enabled = true;
                if (cbDevicesIP.Items.Count > 0)
                {
                    cbDevicesIP.Enabled = true;
                }
                else
                {
                    cbDevicesIP.Enabled = false;
                }

                AddLog("Disconnect from device");

                ftpClient = null;

                clearComboBoxAnimationsList();

                cbAnimationsList.Enabled = false;
                btnRefreshAnimationsList.Enabled = false;
            }
        }
Пример #4
0
        public void TCPDisconnectDevice()
        {
            try
            {
                tcpSocket.Close();
                tcpSocket = null;

                tcpSocketThread.Abort();
                tcpSocketThread = null;

                ftpClient = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            btnConnectDevice.Text = "Connect";
            btnScanDevices.Enabled = true;
            if (cbDevicesIP.Items.Count > 0)
            {
                cbDevicesIP.Enabled = true;
            }
            else
            {
                cbDevicesIP.Enabled = false;
            }

            AddLog("Disconnect from device " + cbDevicesIP.SelectedItem.ToString());

            clearComboBoxAnimationsList();

            cbAnimationsList.Enabled = false;
            btnRefreshAnimationsList.Enabled = false;
            cbAnimationsList.Enabled = false;
            buttonPlayAnimation.Enabled = false;
            buttonStopAnimation.Enabled = false;
            buttonDeleteAnimation.Enabled = false;

            textBoxNewAnimationName.Enabled = false;
            buttonUpload.Enabled = false;
        }