Beispiel #1
0
        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);
        }
Beispiel #2
0
        /// 由ChecBox的Click事件来记录被选中行的
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CheckBox_Click(object sender, RoutedEventArgs e)
        {
            CheckBox       cb   = sender as CheckBox;
            string         Name = cb.Tag.ToString();
            Prompt_lv_item Item = ItemsSource.Find(x => x.Name == Name);

            if (cb.IsChecked == true)
            {
                Item.Checked = true;
            }
            else
            {
                Item.Checked = false;
            }
        }