private void ComboProvider_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { if (comboProvider.SelectedItem != null) { VM_CloudAccount account = (VM_CloudAccount)comboProvider.SelectedItem; GridLocalMapping.Visibility = (account.CloudID) == 0 ? Visibility.Visible : Visibility.Collapsed; } }
public void Init(VM_CloudAccount cl, string initialpath) { account = cl; if (string.IsNullOrEmpty(initialpath)) { initialpath = "null"; } PopulateMainDir(initialpath); }
void btnSave_Click(object sender, RoutedEventArgs e) { try { // An import folder cannot be both the drop source and the drop destination if (chkDropDestination.IsChecked.HasValue && chkDropSource.IsChecked.HasValue && chkDropDestination.IsChecked.Value && chkDropSource.IsChecked.Value) { MessageBox.Show(Shoko.Commons.Properties.Resources.MSG_ERR_DropSourceDestCheck, Shoko.Commons.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); return; } // The import folder location cannot be blank. Enter a valid path on OMM Server if (string.IsNullOrEmpty(txtImportFolderLocation.Text)) { MessageBox.Show(Shoko.Commons.Properties.Resources.MSG_ERR_ImportFolderLocationCheck, Shoko.Commons.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); txtImportFolderLocation.Focus(); return; } // default the local path to the server path if (string.IsNullOrEmpty(txtLocalPath.Text)) { importFldr.LocalPathTemp = txtImportFolderLocation.Text.Trim(); } else { importFldr.LocalPathTemp = txtLocalPath.Text.Trim(); } 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; importFldr.IsDropSource = chkDropSource.IsChecked ?? false ? 1 : 0; importFldr.IsWatched = chkIsWatched.IsChecked ?? false ? 1 : 0; if (!importFldr.Save()) { return; } VM_ShokoServer.Instance.RefreshImportFolders(); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } DialogResult = true; Close(); }
private void BtnProvChooseFolder_Click(object sender, RoutedEventArgs e) { if (comboProvider.SelectedItem == null) { return; } VM_CloudAccount cl = comboProvider.SelectedItem as VM_CloudAccount; FolderBrowser fld = new FolderBrowser(); fld.Init(cl, txtImportFolderLocation.Text); fld.Owner = this; bool?result = fld.ShowDialog(); if (result.HasValue && result.Value) { txtImportFolderLocation.Text = fld.SelectedPath; } }
private void ComboProvider_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { if (comboProvider.SelectedItem != null) { VM_CloudAccount account = comboProvider.SelectedItem as VM_CloudAccount; switch (account?.CloudID ?? 0) { case 0: GridLocalMapping.Visibility = Visibility.Visible; chkIsWatched.IsEnabled = true; break; default: GridLocalMapping.Visibility = Visibility.Collapsed; chkIsWatched.IsChecked = false; chkIsWatched.IsEnabled = false; break; } } }
public void Init(VM_CloudAccount cl, string initialpath) { account = cl; PopulateMainDir(initialpath); }