Skip to content

Commit

Permalink
VFS drive bug, sorting of listview with drives
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Dimov committed Jul 30, 2014
1 parent 3c10d05 commit c6f8d66
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 102 deletions.
4 changes: 2 additions & 2 deletions Sshfs/Sshfs/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 15 additions & 3 deletions Sshfs/Sshfs/MainForm.cs
Expand Up @@ -97,8 +97,11 @@ protected override void OnLoad(EventArgs e)
driveListView.BeginUpdate();
for (int i = 0; i < _drives.Count; i++)
{
driveListView.Items.Add((_drives[i].Tag =
new ListViewItem(_drives[i].Name, 0) {Tag = _drives[i]}) as ListViewItem);
driveListView.Items.Add(
(
_drives[i].Tag = new ListViewItem(_drives[i].Name, 0) {Tag = _drives[i]}
) as ListViewItem
);
_drives[i].StatusChanged += drive_StatusChanged;
if (_drives[i].Name.StartsWith("New Drive")) _namecount++;

Expand All @@ -111,6 +114,7 @@ protected override void OnLoad(EventArgs e)
driveListView.SelectedIndices.Add(0);
}

driveListView.Sorting = SortOrder.Ascending;

driveListView.EndUpdate();

Expand Down Expand Up @@ -264,8 +268,11 @@ private void addButton_Click(object sender, EventArgs e)
Letter = letter,
MountPoint = ""
};


drive.StatusChanged += drive_StatusChanged;
_drives.Add(drive);
this.virtualDrive.AddSubFS(drive);
var item =
(drive.Tag = new ListViewItem(drive.Name, 0) {Tag = drive, Selected = true}) as
ListViewItem;
Expand All @@ -277,6 +284,7 @@ private void addButton_Click(object sender, EventArgs e)

SetupPanels();
_dirty = true;

}

private void drive_StatusChanged(object sender, EventArgs e)
Expand Down Expand Up @@ -327,6 +335,7 @@ private void removeButton_Click(object sender, EventArgs e)

drive.StatusChanged -= drive_StatusChanged;
drive.Unmount();
virtualDrive.RemoveSubFS(drive);
_drives.Remove(drive);


Expand Down Expand Up @@ -413,8 +422,11 @@ private void saveButton_Click(object sender, EventArgs e)
nameBox.Text = String.Format("{0}@'{1}'", userBox.Text, hostBox.Text);
}


driveListView.SelectedItems[0].Text = drive.Name = nameBox.Text;
driveListView.SelectedItems[0].EnsureVisible();
driveListView.Sorting = SortOrder.None;
driveListView.Sorting = SortOrder.Ascending;

drive.Host = hostBox.Text;
drive.Port = (int) portBox.Value;
drive.Username = userBox.Text;
Expand Down

0 comments on commit c6f8d66

Please sign in to comment.