Exemplo n.º 1
0
        static int CreateNewDirectoryFromTextEntry(TextBox box)
        {
            DirectoryTreeItem selectedItem = m_targetTreeView.SelectedItem as DirectoryTreeItem;

            if (!selectedItem.IsDirectory)
            {
                selectedItem = selectedItem.GetParentSave() as DirectoryTreeItem;
            }


            string newdir = selectedItem.FullPath + "\\" + box.Text;

            Directory.CreateDirectory(newdir);

            //selectedItem.Items.Clear();
            //TraverseDirectory(new DirectoryInfo(selectedItem.FullPath), ref selectedItem);

            //selectedItem.IsExpanded = true;

            m_targetTreeView.Focus();



            return(0);
        }
Exemplo n.º 2
0
        static int TriggerNewAssetSave(TextBox box)
        {
            DirectoryTreeItem selectedItem = m_targetTreeView.SelectedItem as DirectoryTreeItem;

            if (selectedItem.IsDirectory == false)
            {
                selectedItem = selectedItem.GetParentSave() as DirectoryTreeItem;
            }


            CDCCDefinition def = CApplicationSettings.Instance.GetDCCProgram(m_sRequesteDCCPackage);


            string savepath = selectedItem.FullPath + "\\" + box.Text;


            if (savepath.LastIndexOf('.') == -1)
            {
                // HACK: Add a dot if there is none, so def.Start won't crop the last letter
                savepath += '.';
            }


            def.Start(savepath);


            selectedItem.Items.Clear();

            DirectoryInfo info = new DirectoryInfo(selectedItem.FullPath);

            TraverseDirectory(info, ref selectedItem);

            selectedItem.IsExpanded = true;
            return(0);
        }
Exemplo n.º 3
0
        static void OnContextRunRCClicked(object sender, RoutedEventArgs args)
        {
            DirectoryTreeItem selectedItem = m_targetTreeView.SelectedItem as DirectoryTreeItem;

            if (!selectedItem.IsDirectory)
            {
                FileInfo info = new FileInfo(selectedItem.FullPath);
                CProcessUtils.RunRC(info);
            }
        }
Exemplo n.º 4
0
        static void OnContextCopyClicked(object sender, EventArgs args)
        {
            DirectoryTreeItem selectedItem = m_targetTreeView.SelectedItem as DirectoryTreeItem;

            if (selectedItem != null)
            {
                StringCollection coll = new StringCollection();

                coll.Add(selectedItem.FullPath);
                Clipboard.SetFileDropList(coll);
            }
        }
Exemplo n.º 5
0
        private static void UnmarkTracked(DirectoryTreeItem item)
        {
            string sItemHeader = item.Header as string;

            if (sItemHeader.Contains("[Tracked]"))
            {
                int pos = sItemHeader.IndexOf("[Tracked]");

                sItemHeader = sItemHeader.Substring(0, pos);
                sItemHeader = sItemHeader.Trim();
                item.Header = sItemHeader;
            }
        }
Exemplo n.º 6
0
        private static void MarkAsTracked(DirectoryTreeItem item)
        {
            string sItemHeader = item.Header as string;

            if (!sItemHeader.Contains("[Tracked]"))
            {
                sItemHeader = sItemHeader.Trim();

                sItemHeader += " [Tracked]";

                item.Header = sItemHeader;
            }
        }
Exemplo n.º 7
0
 private static void UntrackDirectory(DirectoryTreeItem directory)
 {
     foreach (DirectoryTreeItem item in directory.Items)
     {
         if (item.IsDirectory)
         {
             UntrackDirectory(item);
         }
         else
         {
             CSourceTracker.Instance.RemoveFileFromTracking(item.FullPath, EFileRoot.eFR_CERoot);
             UnmarkTracked(item);
         }
     }
 }
Exemplo n.º 8
0
        private static void TrackDirectory(DirectoryTreeItem directory)
        {
            foreach (DirectoryTreeItem item in directory.Items)
            {
                if (item.IsDirectory)
                {
                    TrackDirectory(item);
                }
                else
                {
                    CSourceTracker.Instance.AddFileToTracking(item.FullPath, EFileRoot.eFR_CERoot);

                    MarkAsTracked(item);
                }
            }
        }
Exemplo n.º 9
0
        static void OnContextStopTrackClicked(object sender, RoutedEventArgs args)
        {
            DirectoryTreeItem selectedItem = m_targetTreeView.SelectedItem as DirectoryTreeItem;

            // TODO: If its a directory, remove all files in it ( not recursive)
            if (selectedItem != null)
            {
                if (!selectedItem.IsDirectory)
                {
                    CSourceTracker.Instance.RemoveFileFromTracking(selectedItem.FullPath, EFileRoot.eFR_CERoot);
                    UnmarkTracked(selectedItem);
                }
                else
                {
                    UntrackDirectory(selectedItem);
                }
            }
        }
Exemplo n.º 10
0
        static void FillTreeItem(CDirectoryEntry entry, ref DirectoryTreeItem item)
        {
            var newDir = new DirectoryTreeItem();

            newDir.Header      = entry.Header;
            newDir.IsDirectory = entry.IsDirectory;
            newDir.FullPath    = entry.FullPath;
            if (!newDir.IsDirectory)
            {
                if (CSourceTracker.Instance.IsFileTracked(newDir.FullPath))
                {
                    // TODO: Load some fancy icon here!
                    // Also see revisits
                    newDir.Header += " [Tracked]";
                }
            }

            if (entry.IsDirectory)
            {
                foreach (CDirectoryEntry subEntry in entry.SubEntries)
                {
                    FillTreeItem(subEntry, ref newDir);
                }
            }
            else
            {
                newDir.MouseDoubleClick += delegate
                {
                    System.Diagnostics.Process proc = new System.Diagnostics.Process();

                    System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(newDir.FullPath);

                    proc.StartInfo = info;

                    proc.Start();
                };
            }

            item.ToolTip = item.FullPath;
            item.Items.Add(newDir);
            item.ContextMenu = m_viewItemContextMenu;
        }
Exemplo n.º 11
0
        static void OnContextTrackClicked(object sender, RoutedEventArgs args)
        {
            DirectoryTreeItem selectedItem = m_targetTreeView.SelectedItem as DirectoryTreeItem;

            // TODO: If its a directory, add all files in it ( not recursive)
            if (selectedItem != null)
            {
                if (!selectedItem.IsDirectory)
                {
                    if (CSourceTracker.Instance.AddFileToTracking(selectedItem.FullPath, EFileRoot.eFR_CERoot, true))
                    {
                        MarkAsTracked(selectedItem);
                    }
                }
                else
                {
                    TrackDirectory(selectedItem);
                }
            }
        }
Exemplo n.º 12
0
        static void OnContextOpenInExplorerClicked(object sender, RoutedEventArgs args)
        {
            if (m_targetTreeView.SelectedItem != null)
            {
                DirectoryTreeItem item    = m_targetTreeView.SelectedItem as DirectoryTreeItem;
                string            dirPath = "";

                if (item.IsDirectory)
                {
                    dirPath = item.FullPath;
                }
                else
                {
                    dirPath = CPathUtils.GetFilePath(item.FullPath);
                }

                Process proc = new Process();
                proc.StartInfo = new ProcessStartInfo("explorer", dirPath);
                proc.Start();
            }
        }
Exemplo n.º 13
0
        static void OnContextRunGFXClicked(object sender, RoutedEventArgs args)
        {
            DirectoryTreeItem selectedItem = m_targetTreeView.SelectedItem as DirectoryTreeItem;

            if (selectedItem.IsDirectory)
            {
                CUserInteractionUtils.ShowErrorMessageBox("You can only run the gfxexporter on files (directory was selected)");                 // LOCALIZE
                return;
            }
            else
            {
                FileInfo fileInf = new FileInfo(selectedItem.FullPath);

                if (fileInf.Extension != ".swf")
                {
                    CUserInteractionUtils.ShowErrorMessageBox("You can only run the gfxexporter on .swf files");                     // LOCALIZE
                    return;
                }

                CProcessUtils.RunGFXExporter(fileInf);
            }
        }
Exemplo n.º 14
0
        static void OnContextRecycleClicked(object sender, EventArgs args)
        {
            DirectoryTreeItem selectedItem = m_targetTreeView.SelectedItem as DirectoryTreeItem;
            DirectoryTreeItem parent       = selectedItem.GetParentSave() as DirectoryTreeItem;

            try
            {
                if (selectedItem.IsDirectory)
                {
                    //Directory.Delete(selectedItem.FullPath, true);
                    FileSystem.DeleteDirectory(selectedItem.FullPath, UIOption.AllDialogs, RecycleOption.SendToRecycleBin, UICancelOption.DoNothing);
                    var mainWindow = Application.Current.MainWindow as Window1;
                    if (mainWindow != null)
                    {
                        mainWindow.ValidateRootPath();
                        mainWindow.ValidateGameFolder();
                    }
                }
                else
                {
                    //File.Delete(selectedItem.FullPath);
                    FileSystem.DeleteFile(selectedItem.FullPath, UIOption.AllDialogs, RecycleOption.SendToRecycleBin, UICancelOption.DoNothing);
                }
            }
            catch (Exception e)
            {
                if (e is ArgumentException ||
                    e is UnauthorizedAccessException ||
                    e is IOException)
                {
                    CUserInteractionUtils.ShowErrorMessageBox(e.Message);
                }
                else
                {
                    throw;
                }
            }
        }
Exemplo n.º 15
0
        static int RenameTreeEntry(TextBox box)
        {
            // DONE_TODO: Account for extension being typed already...
            DirectoryTreeItem selectedItem = m_targetTreeView.SelectedItem as DirectoryTreeItem;

            try
            {
                if (selectedItem.IsDirectory)
                {
                    string newPath = selectedItem.FullPath.Substring(0, selectedItem.FullPath.LastIndexOf('\\')) + '\\' + box.Text;
                    //Directory.Move(selectedItem.FullPath, newPath);
                    FileSystem.RenameDirectory(selectedItem.FullPath, newPath);
                }
                else
                {
                    var fileInfo = new FileInfo(selectedItem.FullPath);

                    string sNewExtension = CPathUtils.GetExtension(box.Text);

                    if (sNewExtension != box.Text && sNewExtension != fileInfo.Extension.TrimStart('.'))
                    {
                        var res = MessageBox.Show(Properties.Resources.FEConfirmChangeExtension,
                                                  Properties.Resources.CommonNotice,
                                                  MessageBoxButton.YesNo,
                                                  MessageBoxImage.Question);

                        if (res != MessageBoxResult.Yes)
                        {
                            sNewExtension = fileInfo.Extension.TrimStart('.');
                        }
                    }
                    else
                    {
                        if (sNewExtension == box.Text)
                        {
                            sNewExtension = fileInfo.Extension.TrimStart('.');
                        }
                    }
                    string filename = CPathUtils.RemoveExtension(CPathUtils.GetFilename(box.Text));
                    FileSystem.RenameFile(selectedItem.FullPath, filename + "." + sNewExtension);
                }
            }
            catch (Exception e)
            {
                if (e is ArgumentException ||
                    e is UnauthorizedAccessException ||
                    e is IOException)
                {
                    CUserInteractionUtils.ShowErrorMessageBox(e.Message);
                }
                else
                {
                    throw;
                }
            }


            var mainWindow = Application.Current.MainWindow as Window1;

            if (mainWindow != null)
            {
                // Not elegant but all the error checking is done in these methods
                // no sense in writing them again
                mainWindow.ValidateRootPath();
                mainWindow.ValidateGameFolder();
            }

            //selectedItem = selectedItem.GetParentSave() as DirectoryTreeItem;
            //selectedItem.Items.Clear();
            //TraverseDirectory(new DirectoryInfo(selectedItem.FullPath), ref selectedItem);

            return(0);
        }
Exemplo n.º 16
0
        static void OnContextPasteClicked(object sender, EventArgs args)
        {
            // DONE_TODO: Implement directory copying
            if (!Clipboard.ContainsFileDropList())
            {
                return;
            }

            DirectoryTreeItem targetItem = m_targetTreeView.SelectedItem as DirectoryTreeItem;

            if (!targetItem.IsDirectory)
            {
                targetItem = targetItem.GetParentSave() as DirectoryTreeItem;
            }

            //string fileSource = Clipboard.GetFileDropList()[0];

            foreach (string fileSource in Clipboard.GetFileDropList())
            {
                FileInfo fileInfo = new FileInfo(fileSource);

                if (fileInfo.Exists)
                {
                    string fileTarget = targetItem.FullPath + "\\" + fileInfo.Name;

                    try
                    {
                        //File.Copy(fileSource, fileTarget, true);


                        if (m_bIsFileCut)
                        {
                            FileSystem.MoveFile(fileSource, fileTarget, UIOption.AllDialogs, UICancelOption.DoNothing);
                        }
                        else
                        {
                            CProcessUtils.CopyFile(fileSource, fileTarget, false);
                        }
                    }
                    catch (Exception e)
                    {
                        CUserInteractionUtils.ShowErrorMessageBox(e.Message);
                        m_bIsFileCut = false;
                    }
                }
                else
                {
                    // It's a direcory?
                    DirectoryInfo dirInf = new DirectoryInfo(fileSource);
                    if (dirInf.Exists)
                    {
                        string targetDir = targetItem.FullPath + "\\" + dirInf.Name;

                        if (m_bIsFileCut)
                        {
                            CProcessUtils.MoveDirectory(dirInf.FullName, targetDir, false);
                        }
                        else
                        {
                            CProcessUtils.CopyDirectory(dirInf.FullName, targetDir, false);
                        }
                    }
                }
            }

            TraverseDirectory(new DirectoryInfo(targetItem.FullPath), ref targetItem);
        }
Exemplo n.º 17
0
        static void TimerTick(object sender, EventArgs e)
        {
            if (m_bFillFinished)
            {
                m_timer.Stop();
                m_bFillFinished = false;


                var rootItem = new DirectoryTreeItem();
                rootItem.Header      = m_filledEntry.Header;
                rootItem.FullPath    = m_filledEntry.FullPath;
                rootItem.IsDirectory = m_filledEntry.IsDirectory;

                foreach (CDirectoryEntry entry in m_filledEntry.SubEntries)
                {
                    FillTreeItem(entry, ref rootItem);
                }

                m_targetTreeView.Items.Clear();
                m_targetTreeView.Items.Add(rootItem);

                // Expand the treeview to the last selected item
                if (m_lastSelectedItem != null)
                {
                    List <string>     selectedPath = new List <string>();
                    DirectoryTreeItem parentItem   = m_lastSelectedItem;

                    // Construct a relative tree view path to the selection
                    while (parentItem != null)
                    {
                        var temp = parentItem.Parent as DirectoryTreeItem;
                        if (temp == null)
                        {
                            break;
                        }

                        string sheader = parentItem.Header as string;

                        // TODO: Revisit when not using label in header for tracking indicator
                        if (sheader.Contains(" [Tracked]"))
                        {
                            sheader = sheader.Remove(sheader.IndexOf(" [Tracked"), sheader.Length - sheader.IndexOf(" [Tracked]"));
                        }

                        selectedPath.Add(sheader as string);
                        parentItem = temp;
                    }

                    selectedPath.Reverse();

                    // Construct  the filesystem path to the selected item
                    string path = rootItem.FullPath;
                    foreach (string dir in selectedPath)
                    {
                        path += "\\" + dir;
                    }

                    // If the selection was deleted, remove it from the relative path
                    if (!Directory.Exists(path) && !File.Exists(path))
                    {
                        selectedPath.RemoveAt(selectedPath.Count - 1);
                    }


                    // Traverse the tree view until the path has been expanded
                    Queue <string> selQ = new Queue <string>(selectedPath);

                    if (m_targetTreeView.Items.Count > 0)
                    {
                        rootItem.IsExpanded = true;

                        while (rootItem.HasItems)
                        {
                            for (int i = 0; i < rootItem.Items.Count; ++i)
                            {
                                var    temp        = rootItem.Items[i] as DirectoryTreeItem;
                                string currentName = temp.Header as string;
                                // TODO: Revisit when not using label in header for tracking indicator
                                if (currentName.Contains(" [Tracked]"))
                                {
                                    currentName = currentName.Remove(currentName.IndexOf(" [Tracked"), currentName.Length - currentName.IndexOf(" [Tracked]"));
                                }

                                if (selQ.Count == 0)
                                {
                                    rootItem            = temp;
                                    rootItem.IsSelected = true;
                                    rootItem.IsExpanded = true;
                                    break;
                                }

                                string queueEnd = selQ.Peek();
                                if (currentName == queueEnd)
                                {
                                    rootItem            = temp;
                                    rootItem.IsExpanded = true;
                                    selQ.Dequeue();
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                DirectoryTreeItem item = m_targetTreeView.Items[0] as DirectoryTreeItem;
                string            name = item.Header as string;
                if (name.Length < 15)
                {
                    name       += ".";
                    item.Header = name;
                }
                else
                {
                    name = name.TrimEnd('.');
                }
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// Traverses the specified directory recursively and adds subitem for each entry to addto.
        /// Based off the MSDN article.
        /// </summary>
        /// <param name="dir"></param>
        /// <param name="addto"></param>
        private static void TraverseDirectory(DirectoryInfo dir, ref DirectoryTreeItem addto)
        {
            DirectoryInfo[] subDirs  = dir.GetDirectories();
            FileInfo[]      subFiles = dir.GetFiles();

            m_lastSelectedItem = m_targetTreeView.SelectedItem as DirectoryTreeItem;

            foreach (DirectoryInfo directory in subDirs)
            {
                DirectoryTreeItem item = new DirectoryTreeItem();

                item.SetName(directory.Name);
                item.FullPath    = directory.FullName;
                item.IsDirectory = true;

                TraverseDirectory(directory, ref item);


                addto.Items.Add(item);
            }

            foreach (FileInfo file in subFiles)
            {
                DirectoryTreeItem item = new DirectoryTreeItem();

                item.SetName(file.Name);
                item.FullPath    = file.FullName;
                item.IsDirectory = false;
                item.ContextMenu = m_viewItemContextMenu;


                item.MouseDoubleClick += delegate
                {
                    System.Diagnostics.Process proc = new System.Diagnostics.Process();

                    System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(file.FullName);

                    proc.StartInfo = info;

                    proc.Start();
                };


                addto.Items.Add(item);

                if (m_lastSelectedItem != null)
                {
                    Stack <string>    selectedPath = new Stack <string>();
                    DirectoryTreeItem parentItem   = m_lastSelectedItem;

                    while (parentItem != null)
                    {
                        var temp = parentItem.Parent as DirectoryTreeItem;
                        if (temp == null)
                        {
                            break;
                        }

                        selectedPath.Push(parentItem.Header as string);
                        parentItem = temp;
                    }

                    if (m_targetTreeView.Items.Count > 0)
                    {
                        var rootItem = m_targetTreeView.Items[0] as DirectoryTreeItem;
                        rootItem.IsExpanded = true;

                        while (rootItem.HasItems)
                        {
                            for (int i = 0; i < rootItem.Items.Count; ++i)
                            {
                                var    temp        = rootItem.Items[i] as DirectoryTreeItem;
                                string currentName = temp.Header as string;

                                if (selectedPath.Count == 0)
                                {
                                    rootItem            = temp;
                                    rootItem.IsSelected = true;
                                    break;
                                }


                                if (currentName == selectedPath.Peek())
                                {
                                    rootItem            = temp;
                                    rootItem.IsExpanded = true;
                                    selectedPath.Pop();
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 19
0
        public static void SetupContextMenu()
        {
            if (m_viewItemContextMenu == null)
            {
                m_viewItemContextMenu = new ContextMenu();
            }

            m_viewItemContextMenu.Items.Clear();

            Separator sep = new Separator();

            // Setup all the different DCCPackages
            var item = new MenuItem();

            item.Header = "New asset";             // LOCALIZE

            List <string> dccdefs = CApplicationSettings.Instance.GetAllDCCProgramNames();


            foreach (string dccdef in dccdefs)
            {
                MenuItem notherItem = new MenuItem();

                notherItem.Header = dccdef;
                notherItem.Click += OnContextNewAssetClicked;

                item.Items.Add(notherItem);
            }

            if (item.Items.Count == 0)
            {
                item.IsEnabled = false;
            }
            m_viewItemContextMenu.Items.Add(item);

            //---------------------------------
            MenuItem runWithItem = new MenuItem();

            runWithItem.Header = "Run with...";             // LOCALIZE

            item        = new MenuItem();
            item.Header = "Run with rc";             // LOCALIZE
            item.Click += OnContextRunRCClicked;
            runWithItem.Items.Add(item);

            item        = new MenuItem();
            item.Header = "Run with gfxExporter";             // LOCALIZE
            item.Click += OnContextRunGFXClicked;
            runWithItem.Items.Add(item);

            List <string> defs = CApplicationSettings.Instance.GetAllDCCProgramNames();

            if (defs.Count > 0)
            {
                sep = new Separator();
                runWithItem.Items.Add(sep);
            }
            List <string> addedPrograms = new List <string>();

            foreach (string defName in defs)
            {
                CDCCDefinition def = CApplicationSettings.Instance.GetDCCProgram(defName);

                foreach (SDCCProgram program in def.Programs.Values)
                {
                    if (addedPrograms.Contains(program.Name))
                    {
                        continue;
                    }

                    MenuItem programItem = new MenuItem();

                    programItem.Header = program.Name;

                    programItem.Click += delegate
                    {
                        DirectoryTreeItem selectedItem = m_targetTreeView.SelectedItem as DirectoryTreeItem;
                        if (selectedItem != null)
                        {
                            if (!selectedItem.IsDirectory)
                            {
                                Process proc = new Process();
                                proc.StartInfo           = new ProcessStartInfo(program.ExecutablePath);
                                proc.StartInfo.Arguments = selectedItem.FullPath;

                                proc.Start();
                            }
                        }
                    };

                    runWithItem.Items.Add(programItem);
                    addedPrograms.Add(program.Name);
                }
            }

            m_viewItemContextMenu.Items.Add(runWithItem);
            //----------------------------------

            sep = new Separator();
            m_viewItemContextMenu.Items.Add(sep);

            item        = new MenuItem();
            item.Header = "Copy";             // LOCALIZE
            item.Click += OnContextCopyClicked;
            m_viewItemContextMenu.Items.Add(item);

            item = new MenuItem();

            item.Header = "Cut";             // LOCALIZE
            item.Click += OnContextCutClicked;

            m_viewItemContextMenu.Items.Add(item);

            item = new MenuItem();

            item.Header = "Paste";             // LOCALIZE
            item.Click += OnContextPasteClicked;

            m_viewItemContextMenu.Items.Add(item);


            item = new MenuItem();

            item.Header = "Move to Recycle Bin";             // LOCALIZE
            item.Click += OnContextRecycleClicked;

            m_viewItemContextMenu.Items.Add(item);

            item        = new MenuItem();
            item.Header = "Delete";             // LOCALIZE
            item.Click += OnContextDeleteClicked;
            m_viewItemContextMenu.Items.Add(item);

            item = new MenuItem();

            item.Header = "Rename";             // LOCALIZE
            item.Click += OnContextRenameClicked;

            m_viewItemContextMenu.Items.Add(item);


            sep = new Separator();
            m_viewItemContextMenu.Items.Add(sep);

            item = new MenuItem();


            item.Header = "New Directory";             // LOCALIZE
            item.Click += OnContextNewDirectoryClicked;

            m_viewItemContextMenu.Items.Add(item);

            item        = new MenuItem();
            item.Header = "Open in explorer";             // LOCALIZE
            item.Click += OnContextOpenInExplorerClicked;
            m_viewItemContextMenu.Items.Add(item);

            sep = new Separator();
            m_viewItemContextMenu.Items.Add(sep);

            item        = new MenuItem();
            item.Header = "Track file";             // LOCALIZE
            item.Click += OnContextTrackClicked;
            m_viewItemContextMenu.Items.Add(item);

            item        = new MenuItem();
            item.Header = "Stop tracking file";             // LOCALIZE
            item.Click += OnContextStopTrackClicked;
            m_viewItemContextMenu.Items.Add(item);
        }
Exemplo n.º 20
0
        public static void PopulateTreeView(string sRootPath)
        {
            if (!Directory.Exists(sRootPath))
            {
                var empty = new DirectoryTreeItem();
                empty.Header = "Specified path doesn't exist!";                 // LOCALIZE

                m_targetTreeView.Items.Clear();
                m_targetTreeView.Items.Add(empty);
                return;
            }

            DirectoryInfo     dirInfo = new DirectoryInfo(sRootPath);
            DirectoryTreeItem item    = new DirectoryTreeItem();



            /*item.SetName(dirInfo.Name);
             * item.FullPath = dirInfo.FullName;
             * item.IsDirectory = true;
             *
             * item.ContextMenu = m_viewItemContextMenu;
             *
             * //item.MouseRightButtonDown += delegate { item.IsSelected = true; };
             *
             *
             * TraverseDirectory(dirInfo, ref item);
             *
             * m_targetTreeView.Items.Add(item);*/

            if (sRootPath == m_sDirectoryToWatch)
            {
                m_lastSelectedItem = m_targetTreeView.SelectedItem as DirectoryTreeItem;
            }
            else
            {
                m_lastSelectedItem = null;
            }

            m_bFillFinished = false;

            CDirectoryEntry rootEntry = new CDirectoryEntry();

            rootEntry.Header      = dirInfo.Name;
            rootEntry.FullPath    = dirInfo.FullName;
            rootEntry.IsDirectory = true;

            CFillerThreadParam param = new CFillerThreadParam();

            param.rootEntry = rootEntry;
            param.callBack  = FillerCallback;
            m_timer.Start();

            m_targetTreeView.Items.Clear();

            item.Header = "Loading";
            m_targetTreeView.Items.Add(item);

            Thread filler = new Thread(TraverseDirectory);

            filler.Start(param as object);
        }