private List <string> Softs = new List <string>(); //列表源数据 public Prompt(FILEUTILS fileutils) { InitializeComponent(); this.fileutils = fileutils; lb_summary.Content = "本软件目前运行与U盘,请勾选需复制到" + fileutils.target.Split('\\')[0] + "的项目."; Softs = fileutils.Traverse(fileutils.path + @"\softs").Select(x => x.Split('\\').Last()).ToList(); Softs.Remove("softs"); //Console.WriteLine(Softs[1]); lv_Softs.ItemsSource = Softs; }
public Prompt(FILEUTILS fileutils) { InitializeComponent(); btn_pause.IsEnabled = false; this.fileutils = fileutils; //lb_summary.Content = "本软件目前运行与U盘,请勾选需复制到" + fileutils.target.Split('\\')[0] + "的项目;复制完成后本软件将会关闭,并打开" + fileutils.target.Split('\\')[0]; lb_summary.Content = "本软件目前运行与U盘,请勾选需复制到" + fileutils.target + "的项目."; bool symbol = Install_Status.Check(fileutils, "VNC", true); if (symbol) { Console.WriteLine("系统中已安装Office."); /*var toolTip = new ToolTip(); * toolTip.StaysOpen = true; * toolTip.Content = "系统中已安装Office."; * lv_Softs.ToolTip = toolTip;*/ } var ItemsPath = fileutils.Traverse(fileutils.path + @"\softs").Skip(1); foreach (string path in ItemsPath) { Prompt_lv_item item = new Prompt_lv_item(); item.Name = path.Split('\\').Last(); item.Path = path; ItemsSource.Add(item); } var StoreItems = LoadList(ListFile); if (StoreItems != null) { foreach (Prompt_lv_item NewItem in ItemsSource) { foreach (Prompt_lv_item OldItem in StoreItems) { if (NewItem.Name == OldItem.Name) { NewItem.Checked = OldItem.Checked; } } } } lv_Softs.ItemsSource = ItemsSource; //background process initialize m_BackgroundWorker = new BackgroundWorker(); // 实例化后台对象 m_BackgroundWorker.WorkerReportsProgress = true; // 设置可以通告进度 m_BackgroundWorker.WorkerSupportsCancellation = true; // 设置可以取消 m_BackgroundWorker.DoWork += new DoWorkEventHandler(DoWork); m_BackgroundWorker.ProgressChanged += new ProgressChangedEventHandler(UpdateProgress); m_BackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(CompletedWork); }