1
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
saviour-backup-system/Saviour Backup System/mainWindow.cs

48 lines
1.3 KiB
C#

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace Saviour_Backup_System
{
public partial class mainWindow : Form
{
public string selectedDevice;
public mainWindow()
{
InitializeComponent();
refreshDriveList();
}
public void refreshDriveList()
{
DriveInfo[] drives = USBTools.getConnectedDrives();
connectedDrivesList.Items.Clear();
foreach (DriveInfo drive in drives){
ListViewItem driveItem = new ListViewItem(drive.Name + " " + drive.VolumeLabel);
driveItem.SubItems.Add("X");
connectedDrivesList.Items.Add(driveItem);
}
connectedDrivesList.Sort();
}
private void connectedDrivesListRefresh_Click(object sender, EventArgs e)
{
refreshDriveList();
}
private void connectedDrivesList_Select(object sender, EventArgs e)
{
deviceTab.Visible = true;
ribbonControl1.RecalcLayout();
selectedDevice = connectedDrivesList.SelectedItems[0].Text;
MessageBox.Show(selectedDevice);
}
}
}