public void Connection() { DeviceList.ReadDeviceName(); string CheckServerCore = ""; Socket = new ClassSock(UI_Name, Signature, FlagReciveIP); //проверяем наличие сервера CheckServerCore = Socket.CheckAnotherCore(); try { if (IsProcessOpen("KMcontroller")) { this.FindAndKillProcess("KMcontroller"); Thread.Sleep(1000); } Process proc = new Process(); proc.StartInfo.FileName = @"KMcontroller.exe"; proc.StartInfo.CreateNoWindow = true; proc.StartInfo.UseShellExecute = false; proc.Start(); Thread.Sleep(100); Socket = new ClassSock(UI_Name, Signature, FlagReciveIP); } catch { Socket = new ClassSock(UI_Name, Signature, FlagReciveIP); } if (CheckServerCore == "NO") { Socket.OnReceiveMessage += new OnReceive(OnReceivedData); //Socket.OnConnectErrorMessage += new OnConnectError(OnConnectError); Socket.DeviceName = UI_Name; Socket.ErrorConnect = 0; string myHost = Dns.GetHostName(); string myIP = GetIPAddress(myHost); Socket.Connect(myIP, true); } if (Directory.Exists(FFMPEGConvert.PathConvert)) { //Directory.Delete(FFMPEGConvert.PathConvert, true); } Thread.Sleep(1000); Directory.CreateDirectory(FFMPEGConvert.PathConvert); }
public Form1() { InitializeComponent(); DeviceList.ReadDeviceName(); DataGridViewProgressColumn column = new DataGridViewProgressColumn(); dataGridView1.ColumnCount = 2; dataGridView1.Columns.Add(column); dataGridView1.Columns[2].MinimumWidth = 220; dataGridView1.Columns[2].Width = 220; dataGridView1.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.None; column.HeaderText = " Progress "; dataGridView1.Columns.Add("Column1", " File "); dataGridView1.Columns[3].MinimumWidth = 200; dataGridView1.Columns[3].Width = 200; dataGridView1.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.None; string CheckServerCore = ""; try { Socket = new ClassSock(UI_Name, Signature, FlagReciveIP); //проверяем наличие сервера CheckServerCore = Socket.CheckAnotherCore(); if (CheckServerCore == "NO") { if (IsProcessOpen("KMcontroller")) { FindAndKillProcess("KMcontroller"); Thread.Sleep(1000); } Process proc = new Process(); proc.StartInfo.FileName = @"KMcontroller.exe"; proc.StartInfo.CreateNoWindow = true; proc.StartInfo.UseShellExecute = false; proc.Start(); Thread.Sleep(100); } else { MessageBox.Show("Close Server = " + CheckServerCore + " please!"); } // Socket = new ClassSock(UI_Name, Signature, FlagReciveIP); } catch { // Socket = new ClassSock(UI_Name, Signature, FlagReciveIP); } if (CheckServerCore == "NO") { Socket.OnReceiveMessage += new OnReceive(OnReceivedData); Socket.OnConnectErrorMessage += new OnConnectError(OnConnectError); Socket.DeviceName = UI_Name; Socket.ErrorConnect = 0; string myHost = Dns.GetHostName(); string myIP = GetIPAddress(myHost); Socket.Connect(myIP, true); } //checkBox1.Left = dataGridView1.Columns[0].Width + checkBox1.Width / 3 + dataGridView1.Location.X; //checkBox3.Left = dataGridView2.Columns[0].Width + dataGridView2.Columns[1].Width + dataGridView2.Columns[2].Width + dataGridView2.Columns[3].Width + dataGridView2.Columns[4].Width + checkBox3.Width / 3 + dataGridView2.Location.X; //checkBox4.Left = dataGridView4.Columns[0].Width + checkBox4.Width / 3 + dataGridView4.Location.X; //checkBox5.Left = dataGridView3.Columns[0].Width + dataGridView3.Columns[1].Width / 2 + checkBox5.Width + dataGridView3.Location.X; ////////////////////////////////////////////////////// if (Directory.Exists(FFMPEGConvert.PathConvert)) { Directory.Delete(FFMPEGConvert.PathConvert, true); } Thread.Sleep(1000); Directory.CreateDirectory(FFMPEGConvert.PathConvert); }