コード例 #1
0
ファイル: TreeModel.cs プロジェクト: HelloWindows/CompareTool
        public TreeModel(string leftRoot, string rightRoot)
        {
            this.leftRoot  = leftRoot;
            this.rightRoot = rightRoot;
            DirectoryModle.Reset(leftRoot, rightRoot);
            _itemMap     = new Dictionary <string, ItemNode>();
            _nodeMap     = new Dictionary <string, BaseItem>();
            _itemsToRead = new List <BaseItem>();
            _worker      = new BackgroundWorker();
            _worker.WorkerReportsProgress = true;
            _worker.DoWork          += new DoWorkEventHandler(ReadFilesProperties);
            _worker.ProgressChanged += new ProgressChangedEventHandler(OnProgressChanged);

            progress = new ProgressModle();
            _compare = new BackgroundWorker();
            _compare.WorkerReportsProgress = true;
            _compare.DoWork             += new DoWorkEventHandler(CompareWork);
            _compare.ProgressChanged    += new ProgressChangedEventHandler(OnCompareChanged);
            _compare.RunWorkerCompleted += new RunWorkerCompletedEventHandler(OnCompareCompleted);
            if (!_itemMap.ContainsKey(""))
            {
                _itemMap.Add("", new ItemNode(""));
            }
            // end if
            foreach (var item in DirectoryModle.DirectoryMap)
            {
                foreach (var folder in item.Value.GetDirectorys())
                {
                    lock (_itemMap) {
                        if (!_itemMap.ContainsKey(folder))
                        {
                            _itemMap.Add(folder, new ItemNode(folder));
                        }
                        // end if
                    } // end lock
                    _compare.ReportProgress(0);
                }     // end foreach
            }         // end foreach
            _moveWorker = new BackgroundWorker();
            _moveWorker.WorkerReportsProgress = true;
            _moveWorker.DoWork             += new DoWorkEventHandler(MoveFile);
            _moveWorker.ProgressChanged    += new ProgressChangedEventHandler(OnMoveProgressChanged);
            _moveWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(OnMoveCompleted);
            moveList     = new List <string>();
            moveProgress = new ProgressModle();
        }
コード例 #2
0
 public SvnViewModel(string leftRoot, string rightRoot)
 {
     this.leftRoot  = leftRoot;
     this.rightRoot = rightRoot;
     DirectoryModle.Reset(leftRoot, rightRoot);
     _nodeMap     = new Dictionary <string, BaseItem>();
     _itemsToRead = new List <BaseItem>();
     _worker      = new BackgroundWorker();
     _worker.WorkerReportsProgress = true;
     _worker.DoWork             += new DoWorkEventHandler(ReadFilesProperties);
     _worker.ProgressChanged    += new ProgressChangedEventHandler(OnProgressChanged);
     _worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(OnProgressCompleted);
     progress    = new ProgressModle();
     _moveWorker = new BackgroundWorker();
     _moveWorker.WorkerReportsProgress = true;
     _moveWorker.DoWork             += new DoWorkEventHandler(MoveFile);
     _moveWorker.ProgressChanged    += new ProgressChangedEventHandler(OnMoveProgressChanged);
     _moveWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(OnMoveCompleted);
     moveList     = new List <string>();
     moveProgress = new ProgressModle();
 }