// mouse double click
        private void Border_MouseDown(object sender, MouseButtonEventArgs e)
        {
            //if (e.ClickCount == 2)
            {
                BrowserListBoxItemModel model = (BrowserListBoxItemModel)browserListBox.SelectedItem;
                if (model == null)
                {
                    return;
                }
                if (model.FileType.Equals("Folder"))
                {
                    GetFiles(model.FilePath);
                }

                string ftype = model.FileType.ToLower();
                if (ftype == ".dds" || ftype == ".png" || ftype == ".jpg" || ftype == ".tga")
                {
                    if (model.FilePath.IndexOf(workDirectory) != -1)
                    {
                        string txtName = model.FilePath.Substring(model.FilePath.IndexOf(workDirectory) + workDirectory.Length);
                        mainWindow.GetTextureProperties(txtName);
                    }
                }
                else if (ftype == ".gmat")
                {
                    if (model.FilePath.IndexOf(workDirectory) != -1)
                    {
                        string matName = model.FilePath.Substring(workDirectory.Length);
                        mainWindow.GetMaterialPropertiesByUniqueName(matName);
                    }
                }
            }
        }
Exemple #2
0
 private BrowserListBoxItemModel GetListBoxItemByName(string itemName)
 {
     foreach (object item in browserListBox.Items)
     {
         BrowserListBoxItemModel model = item as BrowserListBoxItemModel;
         if (model.FileName == itemName)
         {
             return(model);
         }
     }
     return(null);
 }
Exemple #3
0
        public string GetSelectedFileUniqueName()
        {
            BrowserListBoxItemModel selected = browserListBox.SelectedItem as BrowserListBoxItemModel;

            if (selected != null)
            {
                return(selected.FilePath.Substring(workDirectory.Length));
            }
            else
            {
                return(string.Empty);
            }
        }
Exemple #4
0
        public string GetSelectedFilePath()
        {
            BrowserListBoxItemModel selected = browserListBox.SelectedItem as BrowserListBoxItemModel;

            if (selected != null)
            {
                return(selected.FilePath);
            }
            else
            {
                return(string.Empty);
            }
        }
        private void GetFiles(string FilePath)
        {
            listBoxData.Clear();

            foreach (var path in Directory.GetDirectories(FilePath))
            {
                // if @path is a folder
                if (Directory.Exists(@path))
                {
                    DirectoryInfo dir = new DirectoryInfo(path);

                    // if this directory is not readonly or hidden
                    if (FileAttributes.Directory == dir.Attributes || dir.Attributes.ToString().Equals("ReadOnly, Directory"))
                    {
                        BrowserListBoxItemModel model = new BrowserListBoxItemModel();
                        model.Icon     = listBoxIcons["folder"];
                        model.FileName = dir.Name;
                        model.FileType = "Folder";
                        model.FilePath = @path;
                        listBoxData.Add(model);
                    }
                }
            }

            foreach (var path in Directory.GetFiles(FilePath))
            {
                if (File.Exists(@path))
                {
                    FileInfo file = new FileInfo(@path);

                    //if (file.Extension.Equals(".jpg") || file.Extension.Equals(".pdf"))
                    {
                        BrowserListBoxItemModel model = new BrowserListBoxItemModel();
                        model.Icon     = listBoxIcons["document"];
                        model.FileName = file.Name;
                        model.FileType = file.Extension;
                        model.FilePath = @path;

                        listBoxData.Add(model);
                    }
                }
            }

            //if (listBoxData.Count > 0)
            {
                browserListBox.ItemsSource = listBoxData;
            }
        }
 // mouse double click
 private void Border_MouseDown(object sender, MouseButtonEventArgs e)
 {
     //if (e.ClickCount == 2)
     {
         BrowserListBoxItemModel model = (BrowserListBoxItemModel)browserListBox.SelectedItem;
         if (model == null)
         {
             return;
         }
         if (model.FileType.Equals("Folder"))
         {
             strDirectory = model.FilePath;
             GetFiles(model.FilePath);
         }
     }
 }