Permalink
Browse files

Fix up some import folder stuff

  • Loading branch information...
da3dsoul committed Jun 13, 2018
1 parent c212fd0 commit 0543df82b9fd83fda912991295f58c25b0b87f4f
Showing with 7 additions and 7 deletions.
  1. +1 −1 Shoko.Commons
  2. +1 −1 Shoko.Desktop/Forms/FolderBrowser.xaml.cs
  3. +5 −5 Shoko.Desktop/Forms/ImportFolder.xaml.cs
@@ -95,7 +95,7 @@ public void PopulateMainDir(string initialpath)
while (initialpath.StartsWith("\\"))
initialpath = initialpath.Substring(1);
string[] pars = initialpath.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries);
RecursiveAddFromDirectory(TrView.Items, initialpath, pars, (account.CloudID)==0 ? 0 : 1);
RecursiveAddFromDirectory(TrView.Items, initialpath, pars, (account?.CloudID ?? 0) == 0 ? 0 : 1);
Cursor = Cursors.Arrow;
}
@@ -38,8 +38,8 @@ private void ComboProvider_SelectionChanged(object sender, System.Windows.Contro
{
if (comboProvider.SelectedItem != null)
{
VM_CloudAccount account = (VM_CloudAccount)comboProvider.SelectedItem;
switch (account.CloudID)
VM_CloudAccount account = comboProvider.SelectedItem as VM_CloudAccount;
switch (account?.CloudID ?? 0)
{
case 0:
GridLocalMapping.Visibility = Visibility.Visible;
@@ -58,7 +58,7 @@ private void BtnProvChooseFolder_Click(object sender, RoutedEventArgs e)
{
if (comboProvider.SelectedItem == null)
return;
VM_CloudAccount cl = (VM_CloudAccount)comboProvider.SelectedItem;
VM_CloudAccount cl = comboProvider.SelectedItem as VM_CloudAccount;
FolderBrowser fld = new FolderBrowser();
fld.Init(cl, txtImportFolderLocation.Text);
fld.Owner = this;
@@ -145,8 +145,8 @@ void btnSave_Click(object sender, RoutedEventArgs e)
importFldr.LocalPathTemp = txtImportFolderLocation.Text.Trim();
else
importFldr.LocalPathTemp = txtLocalPath.Text.Trim();
VM_CloudAccount cl = (VM_CloudAccount)comboProvider.SelectedItem;
importFldr.CloudID = cl.CloudID == 0 ? null : cl.CloudID;
VM_CloudAccount cl = comboProvider.SelectedItem as VM_CloudAccount;
importFldr.CloudID = cl?.CloudID ?? 0;
importFldr.ImportFolderName = "NA";
importFldr.ImportFolderLocation = txtImportFolderLocation.Text.Trim();
importFldr.IsDropDestination = chkDropDestination.IsChecked ?? false ? 1 : 0;

0 comments on commit 0543df8

Please sign in to comment.