Пример #1
0
        /***************************
        * My Files populate data
        ***************************/
        private void PopulateMyFiles(object sender, MouseButtonEventArgs e)
        {
            VersionCol.Visibility          = Visibility.Visible;
            InMyFiles                      = true;
            SidebarReviseButton.Visibility = Visibility.Visible;
            DatabaseCon con = new DatabaseCon();

            con.OpenConnection();
            List <string> paths = FileData.GetMyFilePath();

            DataGridController data = new DataGridController();
            ObservableCollection <FileAndDirAttributes> GridData = new ObservableCollection <FileAndDirAttributes>();
            FileProperties file;

            if (paths.Count > 0)
            {
                foreach (string dir in paths)
                {
                    file = new FileProperties(dir);
                    GridData.Add(new FileAndDirAttributes {
                        Type = false, FileIcon = "/Resources/Icons/file.png", FileName = file.GetFileName(), FileSize = file.GetFileSize(), FileDirectory = file.GetDirectory(), FileCreated = file.GetFileCreated(), FileAccessed = file.GetFileLastAccess(), FileModified = file.GetFileLastModify(), Versions = FileData.VersionCount(dir)
                    });
                }

                DirsAndFiles.ItemsSource = GridData;
                items.Content            = (GridData.Count - 1) + " items";
                size.Content             = "No file selected.";
            }
            else
            {
                MessageBox.Show("Error", "No file found!");
            }
        }