private void TreeViewOpenList_Click(object sender, RoutedEventArgs e) { var server = TV.GetSelectedTag <Server>(true); if (server == null) { return; } var list = new List(); var dlg = new OpenList(list); dlg.Owner = this; if (dlg.ShowDialog().GetValueOrDefault()) { var serverList = server.LoadList(list.IdN); if (serverList != null && serverList.Id != Guid.Empty) { var dlg2 = new Rows(serverList, true); dlg2.Title = serverList.DisplayName; dlg2.Owner = this; dlg2.ShowDialog(); } else { this.ShowError("An error occurred while trying to read the list " + list.IdN + "."); } } }
private void TreeViewImportList_Click(object sender, RoutedEventArgs e) { var folder = TV.GetSelectedTag <Folder>(); if (folder == null) { return; } var dlg = new OpenFileDialog(); dlg.AddExtension = true; dlg.CheckPathExists = true; dlg.CheckPathExists = true; dlg.DefaultExt = ".json"; dlg.RestoreDirectory = true; dlg.Title = "Choose a list to import"; dlg.Filter = "JSON files (*.json)|*.json|All files (*.*)|*.*"; dlg.FilterIndex = 1; if (dlg.ShowDialog(this).GetValueOrDefault()) { string s = File.ReadAllText(dlg.FileName, Encoding.UTF8); var lwr = JsonUtilities.Deserialize <ListWithRows>(s); if (lwr.List != null) { string name = lwr.List.DisplayName; bool showOptions = false; if (folder.HasLazyChild) { folder.LazyLoadChildren(); } var list = folder.Children.OfType <List>().FirstOrDefault(l => l.DisplayName.EqualsIgnoreCase(name)); List existingList = list; int i = 1; while (list != null) { showOptions = true; name = lwr.List.DisplayName + " - Copy(" + i + ")"; list = folder.Children.OfType <List>().FirstOrDefault(l => l.DisplayName.EqualsIgnoreCase(name)); i++; } var def = new ImportOptionsDefinition(lwr.List, existingList, name); if (showOptions) { var options = new ImportOptions(def); options.Owner = this; if (!options.ShowDialog().GetValueOrDefault()) { return; } } lwr.Import(folder, name, def); this.ShowMessage("Ok"); } } }
private void TreeViewBrowse_Click(object sender, RoutedEventArgs e) { var item = TV.GetSelectedTag <TreeItem>(); if (item != null) { WpfExtensions.Browse(item.Url); return; } }
private void TV_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { PG.SelectedObject = e.NewValue; var login = TV.GetSelectedTag <Model.Login>(); if (login != null) { Login(login.Parent); } }
private void TreeViewCopyFrom_Click(object sender, RoutedEventArgs e) { var folder = TV.GetSelectedTag <Folder>(); if (folder == null) { return; } _copyFolder = folder; }
private void TreeViewExportTo_Click(object sender, RoutedEventArgs e) { var folder = TV.GetSelectedTag <Folder>(); if (folder == null) { return; } var exporter = new FolderExporter(folder); var popup = new ExportFolder(exporter); popup.ShowDialog(); }
private void TreeViewEditRows_Click(object sender, RoutedEventArgs e) { var list = TV.GetSelectedTag <List>(); if (list == null) { return; } var dlg = new Rows(list, false); dlg.Title = list.DisplayName; dlg.Owner = this; dlg.ShowDialog(); }
private void TreeViewCopyTo_Click(object sender, RoutedEventArgs e) { if (_copyFolder == null) { return; } var folder = TV.GetSelectedTag <Folder>(); if (folder == null) { return; } if (this.ShowConfirm("Are you sure you want to copy folder '" + _copyFolder.DisplayName + "' from server '" + _copyFolder.Server.DisplayName + "' to folder '" + folder.DisplayName + "' ?") == MessageBoxResult.No) { return; } var importer = new FolderImporter(_copyFolder, folder); var popup = new ImportFolder(importer); popup.ShowDialog(); }