Exemplo n.º 1
0
        private void tvFoundBooks_AfterSelect(object sender, TreeViewEventArgs e)
        {
            DocumentEngine engine = new DocumentEngine();
            string         path   = e.Node.Tag?.ToString() ?? "";

            if (File.Exists(path))
            {
                var(dateCreated, dateLastAccessed, fileName,
                    fileExtension, fileLength, hasError) =
                    engine.GetFileProperties(e.Node.Tag.ToString());

                if (!hasError)
                {
                    txtFileName.Text = fileName;
                }
            }
        }
Exemplo n.º 2
0
        private void TvFoundBooks_AfterSelect(object sender, TreeViewEventArgs e)
        {
            var documentEngine = new DocumentEngine();
            var filePath       = e.Node.Tag?.ToString() ?? string.Empty;

            if (File.Exists(filePath))
            {
                var(fileName, fileExtension, dateCreated, dateLastAccessed, fileSize, hasError) =
                    documentEngine.GetFileProperties(filePath);

                if (!hasError)
                {
                    tbFileName.Text          = fileName;
                    tbFileExtension.Text     = fileExtension;
                    dtDateCreated.Value      = dateCreated;
                    dtDateLastAccessed.Value = dateLastAccessed;
                    tbPath.Text     = e.Node.Tag.ToString();
                    tbFileSize.Text = $"{Round(fileSize.ToMegabytes(), 2)} MB";
                }
            }
        }
        private void _tvFoundBooks_ItemInvoked(Windows.UI.Xaml.Controls.TreeView sender, Windows.UI.Xaml.Controls.TreeViewItemInvokedEventArgs args)
        {
            var selectedItem = (Models.Item)args.InvokedItem;

            DocumentEngine engine = new DocumentEngine();
            string         path   = selectedItem.FullName.ToString();

            if (File.Exists(path))
            {
                var(dateCreated, dateLastAccessed, fileName, fileExtention, fileLength, hasError) = engine.GetFileProperties(selectedItem.FullName.ToString());

                if (!hasError)
                {
                    txtFileName.Text     = fileName;
                    txtExtension.Text    = fileExtention;
                    dtCreated.Value      = dateCreated;
                    dtLastAccessed.Value = dateLastAccessed;
                    txtFilePath.Text     = selectedItem.FullName.ToString();
                    txtFileSize.Text     = $"{Round(fileLength.ToMegabytes(), 2).ToString()} MB";
                }
            }
        }
Exemplo n.º 4
0
        //Shows the item clicked on tvFoundBooks in File details Group
        private void tvFoundBooks_AfterSelect(object sender, TreeViewEventArgs e)
        {
            DocumentEngine engine = new DocumentEngine();
            string         path   = e.Node.Tag?.ToString() ?? "";

            if (File.Exists(path))
            {
                var(dateCreated, dateLastAccessed, fileName, fileExtention, fileLength, hasError) = engine.GetFileProperties(e.Node.Tag.ToString());

                if (!hasError)
                {
                    txtFileName.Text     = fileName;
                    txtExtension.Text    = fileExtention;
                    dtCreated.Value      = dateCreated;
                    dtLastAccessed.Value = dateLastAccessed;
                    txtFilePath.Text     = e.Node.Tag.ToString();
                    txtFileSize.Text     = $"{Round(fileLength.ToMegabytes(), 2).ToString()} MB";
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// What happens after you select a book inside the Tree View
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tvFoundBooks_AfterSelect(object sender, TreeViewEventArgs e)
        {
            DocumentEngine engine = new DocumentEngine();

            //?? only gets the right operand if it is not null, if it is null it takes from the right
            string path = e.Node.Tag?.ToString() ?? "";


            if (File.Exists(path))
            {
                //Initializes all these variables and get their file with GetFileProperties
                var(dateCreated, dateLastAccessed, fileName, fileExtention, fileLength, hasError) = engine.GetFileProperties(e.Node.Tag.ToString());
                if (!hasError)
                {
                    txtFileName.Text     = fileName;
                    txtExtension.Text    = fileExtention;
                    dtCreated.Value      = dateCreated;
                    dtLastAccessed.Value = dateLastAccessed;
                    txtFilePath.Text     = e.Node.Tag.ToString();
                    txtFileSize.Text     = $"{Round(fileLength.ToMegaBytes(), 2)} MB";
                }
            }
        }