using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.IO;
namespace WpfApplication1
{
/// <summary>
/// Interaction logic for Window5.xaml
/// </summary>
public partial class Window5 : Window
{
public
Window5()
{
InitializeComponent();
}
private
void Window_Loaded(object
sender, RoutedEventArgs e)
{
DriveInfo[]
strdrives = DriveInfo.GetDrives();
foreach
(DriveInfo strdrive in
strdrives)
{
listBox1.Items.Add(string.Format("Drive{0}",strdrive.Name));
listBox1.Items.Add(string.Format("File
type:{0}",strdrive.DriveType));
listBox1.Items.Add(string.Format("Volume
Label:{0}", strdrive.VolumeLabel));
listBox1.Items.Add(string.Format("File System:{0}",
strdrive.DriveFormat));
listBox1.Items.Add(string.Format("Available
space to current user:{0,15}bytes", strdrive.AvailableFreeSpace));
listBox1.Items.Add(string.Format("Total
available space:{0,15}bytes", strdrive.TotalFreeSpace));
listBox1.Items.Add(string.Format("Total
size of drive:{0,15}bytes", strdrive.TotalSize));
}
}
}
}
No comments:
Post a Comment