Skip to content

Commit

Permalink
Merged PR 701: Tasks 1187 and 1188
Browse files Browse the repository at this point in the history
- Tweaking of list of names to be shown
- Prohibit search for empty string

Related work items: #1188, #1187
  • Loading branch information
MikeWilliams-UK committed Dec 24, 2024
1 parent 00c4c76 commit 7cb989f
Show file tree
Hide file tree
Showing 501 changed files with 715 additions and 665 deletions.
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2024, The .NET Foundation. The software is licensed under the (the "License");
Copyright (c) 2025, The .NET Foundation. The software is licensed under the (the "License");
you may not use the software except in compliance with the License.

Apache License
Expand Down Expand Up @@ -178,7 +178,7 @@ you may not use the software except in compliance with the License.

END OF TERMS AND CONDITIONS

Copyright (c) 2024 Chem4Word
Copyright (c) 2025 Chem4Word

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/AssemblyReflectionManager.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/AssemblyReflectionProxy.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Chem4WordOptions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Chem4WordV3.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
10 changes: 5 additions & 5 deletions src/Chem4Word.V3/Data/Chem4Word-Versions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<Version>
<Number>3.3.10 Release 8</Number>
<IsBeta>false</IsBeta>
<Released>31-Oct-2024</Released>
<Released>01-Jan-2025</Released>
<Changes>
<Change>...</Change>
<Change>...</Change>
<Change>Deduplicate dropdown list for ShowAs</Change>
<Change>Prohibit search for empty string</Change>
<Change>Tweaking of list of names to be shown and deduplicate dropdown list for ShowAs</Change>
<Change>BugFix: Copy/Paste of 1D structure into new document - Pasted structure not editable.</Change>
<Change>Please note any previous beta versions V3.3.2 and below will cease to allow insertion or editing of chemistry</Change>
<Change>If you like our product, please consider buying us a coffee at https://www.buymeacoffee.com/chem4word</Change>
Expand Down Expand Up @@ -104,7 +104,7 @@
<Change>Fix Right Click Convert to chemistry issues</Change>
<Change>Fix Windows 11 detection issue</Change>
<Change>Update user manual</Change>
<Change>Private Beta of Chem4Word 2024 (V3.3)</Change>
<Change>Private Beta of Chem4Word 2025 (V3.3)</Change>
</Changes>
</Version>
<Version>
Expand All @@ -123,7 +123,7 @@
<Change>Added basic library manager</Change>
<Change>Add new Plug-In type (Driver) to manage multiple libraries</Change>
<Change>Add new converter to model which reads/writes byte[] from Google protocol buffer of model</Change>
<Change>Private Alpha of Chem4Word 2024 (V3.3)</Change>
<Change>Private Alpha of Chem4Word 2025 (V3.3)</Change>
</Changes>
</Version>
<EndOfLife>31-Dec-2345</EndOfLife>
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Data/This-Version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<Version>
<Number>3.3.10 Release 8</Number>
<IsBeta>false</IsBeta>
<Released>31-Oct-2024</Released>
<Released>01-Jan-2025</Released>
</Version>
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Helpers/ApiHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Helpers/C4wAddInInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Helpers/ChemistryHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Helpers/ChemistryObjectComparer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Helpers/ConfigWatcher.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Helpers/CustomXMLPartHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
24 changes: 20 additions & 4 deletions src/Chem4Word.V3/Helpers/DtoHelper.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
// ---------------------------------------------------------------------------

using System.Collections.Generic;
using Chem4Word.ACME.Models;
using Chem4Word.Model2;
using Chem4Word.Model2.Converters.CML;
Expand Down Expand Up @@ -100,15 +101,30 @@ public static ChemistryObject CreateFromDto(ChemistryDataObject chemistryDto)
MolecularWeight = chemistryDto.MolWeight,
Tags = chemistryDto.Tags.Select(t => t.Text).ToList(),

// List of names to be shown inline in custom UserControl ChemistryItem
ChemicalNames = chemistryDto.Names.Select(t => t.Name).Distinct().ToList(),

// Lists of ChemistryNameDataObject for TreeView
Names = chemistryDto.Names,
Formulae = chemistryDto.Formulae,
Captions = chemistryDto.Captions
};

// List of captions and names to be shown inline in the custom UserControl ChemistryItem
var listOfNames = chemistryDto.Captions.Select(c => c.Name).ToList();
listOfNames.AddRange(chemistryDto.Names.Select(t => t.Name).ToList());

obj.ChemicalNames = new List<string>();
foreach (var name in listOfNames.Distinct())
{
// Is long enough, not a special string, not a number
if (name.Length > 3
&& !name.ToLower().Equals("unable to calculate")
&& !name.ToLower().Equals("not found")
&& !name.ToLower().Equals("not requested")
&& !decimal.TryParse(name, out _))
{
obj.ChemicalNames.Add(name);
}
}

if (chemistryDto.DataType.Equals("cml"))
{
obj.Chemistry = Encoding.UTF8.GetString(chemistryDto.Chemistry);
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Helpers/LibraryFileHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Helpers/ReferenceKeeper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Helpers/RegistryHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Helpers/RegistryMessage.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Helpers/TargetWord.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Helpers/TaskPaneHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Helpers/UpdateHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Helpers/Upgrader.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Helpers/WordSettings.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Library/LibraryController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Library/LibraryHost.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
11 changes: 7 additions & 4 deletions src/Chem4Word.V3/Library/LibraryViewControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand All @@ -21,6 +21,7 @@
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media;
using Chem4Word.Core.Helpers;

namespace Chem4Word.Library
{
Expand Down Expand Up @@ -240,12 +241,14 @@ private void OnTextChanged_SearchBox(object sender, TextChangedEventArgs e)
private void OnClick_SearchButton(object sender, RoutedEventArgs e)
{
string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()";
Globals.Chem4WordV3.Telemetry.Write(module, "Action", "Triggered");
try
{
if (!string.IsNullOrWhiteSpace(SearchBox.Text)
var searchFor = TextHelper.StripControlCharacters(SearchBox.Text).Trim();
if (!string.IsNullOrEmpty(searchFor)
&& DataContext != null)
{
Globals.Chem4WordV3.Telemetry.Write(module, "Information", $"Filter library by '{SearchBox.Text}'");
Globals.Chem4WordV3.Telemetry.Write(module, "Information", $"Filter library by '{searchFor}'");

//get the view from the listbox's source
ICollectionView view = CollectionViewSource.GetDefaultView(((LibraryController)DataContext).ChemistryItems);
Expand All @@ -255,7 +258,7 @@ private void OnClick_SearchButton(object sender, RoutedEventArgs e)
view.Filter = ci =>
{
var item = ci as ChemistryObject;
var queryString = SearchBox.Text.ToUpper();
var queryString = searchFor.ToUpper();
return item != null
&& (item.Name.ToUpper().Contains(queryString)
|| item.ChemicalNames.Any(n => n.ToUpper().Contains(queryString)));
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Models/CatalogueEntry.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Models/LibrariesSettingsGridSource.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Models/LibraryDetails.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Models/LibraryDownloadGridSource.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Navigator/NavigatorController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Navigator/NavigatorHost.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Navigator/NavigatorSupport.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Navigator/NavigatorViewControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Properties/Annotations.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down
6 changes: 3 additions & 3 deletions src/Chem4Word.V3/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------
// Copyright (c) 2024, The .NET Foundation.
// Copyright (c) 2025, The .NET Foundation.
// This software is released under the Apache License, Version 2.0.
// The license and further copyright text can be found in the file LICENSE.md
// at the root directory of the distribution.
Expand Down Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.3.10.9070")]
[assembly: AssemblyFileVersion("3.3.10.9070")]
[assembly: AssemblyVersion("3.3.10.9132")]
[assembly: AssemblyFileVersion("3.3.10.9132")]
Loading

0 comments on commit 7cb989f

Please sign in to comment.