//刷新初始化界面 public void RefreshList(bool initTree = true) { This.Dispatcher.Invoke(() => { This.WaitEvent(() => { ClearUI(); WaitWindow.ChangeCallback(0, 10); Thread.Sleep(100); initlocalList(); WaitWindow.ChangeCallback(0, 30); Thread.Sleep(100); InitRemoteList(); WaitWindow.ChangeCallback(0, 50); Thread.Sleep(100); InitRelativeList(); WaitWindow.ChangeCallback(0, 100); Thread.Sleep(100); }); }); Binging(); AllRemoteFilesCheckBox.IsChecked = false; AllLocalFilesCheckBox.IsChecked = false; P2PConfig.This.SetFileDir(IP, DirRelative); }
private void BatchProduce(int num, int id, string strPort, uint ipv4_1, uint ipv4_2, uint ipv4_3, uint ipv4_4) { listProduce.Clear(); this.WaitEvent(() => { for (uint i = 0; i < num; i++) { RobotInfo info = new RobotInfo(); info.Id = (int)(i + 1); Convert.ToInt32((id + i).ToString()); info.Id = Convert.ToInt32((id + i).ToString()); if (ipv4_4 + 1 < 255) { ipv4_4++; } else if (ipv4_3 + 1 < 255) { ipv4_3++; ipv4_4 = 0; } else if (ipv4_2 + 1 < 255) { ipv4_2++; ipv4_3 = 0; ipv4_4 = 0; } else if (ipv4_1 + 1 < 255) { ipv4_1++; ipv4_2 = 0; ipv4_3 = 0; ipv4_4 = 0; } string strStreamIP = string.Format("{0}.{1}.{2}.{3}", ipv4_1, ipv4_2, ipv4_3, ipv4_4); info.EndPoint = strStreamIP + ":" + strPort; info.NetId = 0; info.NetState = false; info.Fts = strStreamIP + ":" + "4411"; listProduce.Add(info); Thread.Sleep(1); WaitWindow.ChangeCallback(0, (int)((i + 1) * 100 / num)); } }); PreviewRobotList.ItemsSource = listProduce; }
private void OnDisconnnectBatch(object sender, RoutedEventArgs e) { this.Dispatcher.Invoke(() => { this.WaitEvent(() => { int count = 0; int total = SelectRobotInfoList.Count(); foreach (string ep in SelectRobotInfoList) { Int32 netid = RobotInfoCollect.GetInstance().FindNetId(ep); DisconectHost(netid); Thread.Sleep(100); WaitWindow.ChangeCallback(0, (++count) * 100 / total); } }); }); }
private void OnConnnectBatch(object sender, RoutedEventArgs e) { this.Dispatcher.Invoke(() => { this.WaitEvent(() => { int count = 0; int total = SelectRobotInfoList.Count(); foreach (string ep in SelectRobotInfoList) { if (RobotInfoCollect.GetInstance().IsConnectedHost(ep)) { continue; } ConnectHost(ep); Thread.Sleep(10); WaitWindow.ChangeCallback(0, (++count) * 100 / total); } }); }); }