From dfd2c08093e3424630c3ad9f4b7c3dd395eba3b8 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Fri, 10 Mar 2017 21:25:22 +0100 Subject: [PATCH 1/7] Delay welcome dialog until main window is created. - Fix: Improve the display of the welcome message on first run. --- XLToolboxForExcel/ThisAddIn.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/XLToolboxForExcel/ThisAddIn.cs b/XLToolboxForExcel/ThisAddIn.cs index b8fc5e33..26d74261 100755 --- a/XLToolboxForExcel/ThisAddIn.cs +++ b/XLToolboxForExcel/ThisAddIn.cs @@ -144,13 +144,17 @@ private bool GreetUser() Logger.Info("GreetUser: Current version: {0}; last was {1}", SemanticVersion.Current, lastVersionSeen); if (SemanticVersion.Current > lastVersionSeen) { - _dispatcher.BeginInvoke((Action)(() => - { - Logger.Info("GreetUser: showing welcome dialog"); - XLToolbox.UserSettings.UserSettings.Default.LastVersionSeen = SemanticVersion.Current.ToString(); - GreeterViewModel gvm = new GreeterViewModel(); - gvm.InjectInto().ShowInForm(); - })); + System.Threading.Timer timer = new System.Threading.Timer( + (obj) => { + _dispatcher.BeginInvoke((Action)(() => + { + Logger.Info("GreetUser: showing welcome dialog"); + XLToolbox.UserSettings.UserSettings.Default.LastVersionSeen = SemanticVersion.Current.ToString(); + GreeterViewModel gvm = new GreeterViewModel(); + gvm.InjectInto().ShowInForm(); + })); + }, + null, 250, System.Threading.Timeout.Infinite); result = true; } return result; From 848a8290952ca01936db67a1452acd955357eaa2 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Wed, 14 Jun 2017 06:10:14 +0200 Subject: [PATCH 2/7] Lock lazy value access in Instance singleton. - Fix: Prevent occasional 'ValueFactory' errors. Closes #436, closes #437, closes #498, closes #569, closees #589. --- XLToolbox/Excel/ViewModels/Instance.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/XLToolbox/Excel/ViewModels/Instance.cs b/XLToolbox/Excel/ViewModels/Instance.cs index 34b94852..9dc7b7bf 100755 --- a/XLToolbox/Excel/ViewModels/Instance.cs +++ b/XLToolbox/Excel/ViewModels/Instance.cs @@ -55,7 +55,15 @@ public class Instance : ViewModelBase, IDisposable public static Instance Default { - get { return _lazy.Value; } + get + { + Instance i; + lock (_valueLocker) + { + i = _lazy.Value; + } + return i; + } set { _lazy = new Lazy(() => value); } } @@ -977,6 +985,8 @@ private bool WorkWithVisibleWorkbooks(Predicate operation) } ); + private static readonly object _valueLocker = new object(); + #endregion #region Class logger From c07b27f3e51c3139707486714761513632daa361 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Sat, 24 Jun 2017 15:15:48 +0200 Subject: [PATCH 3/7] Do not report exceptions from the legacy add-in. - Change: Errors that occur in the legacy add-in are no longer submitted to the on-line bug tracker because the legacy code is no longer maintained. --- XLToolbox/Strings.resx | 623 +++++++++++++------------ XLToolbox/Vba/Api.cs | 4 +- XLToolbox/Vba/VbaExceptionView.xaml | 56 +++ XLToolbox/Vba/VbaExceptionView.xaml.cs | 32 ++ XLToolbox/Vba/VbaExceptionViewModel.cs | 80 ++++ XLToolbox/XLToolbox.csproj | 10 +- 6 files changed, 495 insertions(+), 310 deletions(-) create mode 100755 XLToolbox/Vba/VbaExceptionView.xaml create mode 100755 XLToolbox/Vba/VbaExceptionView.xaml.cs create mode 100755 XLToolbox/Vba/VbaExceptionViewModel.cs diff --git a/XLToolbox/Strings.resx b/XLToolbox/Strings.resx index 09ea0317..2ba10a9c 100755 --- a/XLToolbox/Strings.resx +++ b/XLToolbox/Strings.resx @@ -1,6 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + An error has occurred! - + Cancel - + Check for updates - + Checking for updates - + Please choose where to save the update file - + Close - + The downloaded file cannot be installed because it is different from the official update file. This can be caused by errors in the network connection, a faulty disk drive on your computer, or by someone hampering with the update process. The update will not be installed. - + Downloading XL Toolbox update - + Download now - + Unable to fetch the current version information from the internet. The error was: {0} Is your internet connection working? - + New version: - + A new version of the XL Toolbox is available for download. - + OK - + Update available - + XL Toolbox Error! - + You have: - + The update has been successfully downloaded and will be installed when you quit Excel. - + Donate - + This is version: - + Welcome - + Welcome to the XL Toolbox add-in! - + What's new? - + Your voluntary payment ('donation') is greatly appreciated. To donate, click the button below. - + Clear form - + E-Mail (optional) - + Name (optional) - + Please send a crash report by clicking the button below. If you give your name and e-mail, the developer may contact you when trying to solve the problem. Click "Technical information..." to view the contents of the bug report. - + Send crash report - + Technical information... - + Send me a copy of the e-mail to the developer - + CLR version - + Excel bitness - + Excel version - + Exception - + Inner exception - + Inner message - + Message - + OS bitness - + OS version - + Stack trace - + Technical information - + XL Toolbox version - + Failed to submit the error report. The following error occurred: {0} - + The error report was successfully submitted. - + Sending... - + Public comment (optional) - + Privacy statement: The technical details will be published in the bug tracker online. Your name and e-mail (both optional) will ONLY be sent to the developer and NOT be shared. If you enter a comment below, the COMMENT WILL BE PUBLISHED anonymously along with the technical data online. - + The update that you downloaded earlier will be installed now. - + You already have the latest version of the XL Toolbox. No update available at this time. - + About Daniel's XL Toolbox - + Version {0} - + Credits - + License - + Website - + XL Toolbox License - + Data analysis and visualization for Excel, for free. - + The download URL is: - + If you are the owner of this computer, you can download the update manually, then right-click the update installer and choose "Run as administrator" to acquire appropriate permissions to install. - + Not authorized to update - + This is free software. - + However, you do not have write permissions to the folder that the XL Toolbox add-in was installed. Therefore you will not be able to automatically update this add-in. Please ask your system administrator to perform the update for you. - + No, thanks - + FreeImage version - + Not available - + Worksheet Manager - + Bottom - + Down - + Top - + Up - + Delete - + Do you really want to delete? This operation cannot be undone. - + No - + Yes - + Please enter the desired new sheet name (1-31 characters, must not contain any of : [] /\ *? - + Rename - + Unable to submit the report. - + The report was successfully submitted. - + An error occurred while downloading the file: "{0}". You may want to try again. - + index For use as placeholder in file name templates - + workbook For use as placeholder in file name templates - + worksheet For use as placeholder in file name templates - + Edit - + Export - + Height - + Preserve aspect ratio - + Reset - + Single graphic export - + Width - + Output - + Preset - + Selection - + Edit export preset - + Add - + All files - + Color space - + Details - + EMF files (*.emf) - + File type - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + Layout - + Objects - + PNG files (*.png) - + Resolution - + Scope - + SVG files - + TIFF files (*.tif) - + Unit - + CMYK - + Grays - + Black & white - + Name - + RGB - + Transparency - + Transparent canvas - + Leaves the canvas transparent. If the graphics object (e.g. the chart) that is exported contains white background color, the transparency will not be evident. In this case, if you want transparency, choose "Transparent white". - + Transparent white - + Forces all whites in the image file to become transparent. - + White canvas - + Paints the graphic object on a white canvas without transparency. - + Do you really want to remove this preset? - + Remove preset - + Active worksheet - + Active workbook - + Batch export - + All graphic objects - + Only charts - + All open workbooks - + Preserve layout on sheet - + Individual items - + File name template - + Use {workbook}, {worksheet}, {name} (chart name) and {index} as placeholders. File extension can be omitted. Target directory will be queried when you click "Export". Should contain localized versions of Strings.Workbook, Strings.Worksheet, Strings.Index and Strings.Name. - + Unless required by applicable law or agreed to in writing, software distributed under the Apache 2.0 License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - + No warranties ‒ see license. - + Crash Report Submission - + Failed to submit crash report. - + Submitting report - + Color management - + Color profile - + Use color management - + Daniel's XL Toolbox Update - + Always on top - + Screenshot-Quality Export - + The screenshot-quality export works with graphical objects only. Please select a graphic (chart or shape). - + Ask me - + Discard all - + How do you want to quit? - + Quit Excel - + Save all - + Unsaved workbooks - + Open workbooks - + Are you sure? - + Ask me as needed - + Quit Excel, discarding changes - + Quit Excel, saving all changed workbooks - + CSV Settings - + Decimal separator - + Field separator - + Thousands separator - + Export CSV file - + Import CSV file - + This action requires a selection of cells. - + Range selection required - + Bovender framework - + CSV export failed - + Hint: Use \t to separate fields by tabs. - + Obsolete XL Toolbox version found - + An obsolete version of the XL Toolbox was found. It will be deactivated now. You can use old XL Toolbox commands in the new, Next-Generation version. You may want to uninstall the old version from your system using "Add/Remove Software". - + Default settings will be used. - + This is the error message: - + Personal settings - + Your personal XL Toolbox settings could not be loaded. - + Available commands - + Edit keyboard shortcuts - + % ALT - + Command: - + ^ CTRL - + ^+{PgUp} CTRL SHIFT PAGE-UP - + Edit keyboard shortcut - + Enable XL Toolbox keyboard shortcuts - + Example - + Legend - + Modifier keys: - + + SHIFT - + More help on shortcuts (Microsoft website) - + {F1}, {PgUp}, ... Special keys - + Enable XL Toolbox keyboard shortcuts - + (Invalid key sequence.) - + Do you want to enable logging now? - + Do want to examine the log files now? - + If you suspect that this could have been caused by a malfunction of the add-in, you may want to turn on the technical logging. The log file contents may be helpful in troubleshooting the issue. - + Incomplete shutdown detected - + You have already enabled logging. The log files may contain technical information that helps to identify the problem. Please consider sending the current log file to support@xltoolbox.net. - + It appears that the XL Toolbox add-in was not shut down properly. - + Current log: - + Enable Logging - + Edit legacy Toolbox preferences - + Legacy Toolbox preferences - + Logging - + Settings and log folder - + Some of the XL Toolbox features still reside in the 'legacy' add-in (prior to version 7); you can access their preferences here. - + Width of the task pane - + It is technically not possible to automatically store the current width of the task pane during shutdown and restore it the next time. However, the initial value here always represents the current task pane width if the worksheet manager is open. - + Image size: {0:0.00} megapixels/{1:0.00} MB uncompressed. - + Unable to access the windows clipboard, is another program using it? Error message: {0} - + Export failed - + An error occurred during export. The following error message was received: - + An error occurred during CSV export. The following message was received: - + Sprache - + You need to restart Excel for the changes to take full effect. - + VSTO Runtime - + An update is available, but you do not appear to be authorized to install it. Please ask the administrator of your system to upgrade, or download the update from the website and install it manually. - + Backup directory for this workbook - + Backups - + Backups of this workbook - + Delete all - + Enable backups - + Open - + Are you sure you want to delete all backups of this workbook? This cannot be undone. - + Delete all backups - + No backups were found for this workbook. Once you start saving the workbook with backups enabled, the backups will be listed here. Note that if you rename the workbook or choose a different backup folder, the backups will no longer be found. - + Today - + Yesterday - + Automatic backups affect your privacy: If you want to delete a workbook, you may also want to delete all backup copies of it. When working with backups, always make sure you are editing the current file, not an obsolete backup file. Use the backup feature at your own risk. - + Backup folder - + The backup folder is always relative to the folder that the workbook is saved in. Do not enter an absolute path here, e.g. "c:\backups" is not allowed. - + The backup folder must be filled in. - + The backup folder must not be an absolute path (e.g., "c:\backups"). - + Backup Error - + Do not show this message again - + Error message: - + Unable to create backup copy. - + Suppress error message on failed backup - + Copy to clipboard - + Workbook Properties - + Jump to target - + Unable to jump to this target. Please check the spelling. - + Folder - + Reference - + Workbook with path - + Worksheet and workbook (reference) - + Worksheet and workbook with path (reference) - + XL Toolbox DLL files not available - + Daniel's XL Toolbox is unable to load additional required DLL files. As a consequence, some commands have been disabled, notably the graphic export commands. Try uninstalling the XL Toolbox via Add/Remove Software, then re-install it using the official installer. Do NOT install the XL Toolbox by double-clicking a '.vsto' file. If you need additional help, see xltoolbox.net/support. - + Tabularize (align columns with spaces) - - Debug logging (detailed) + + Debug logging (detailed, SLOW) - + The graphic cannot be exported because Excel does not permit copying it. Unfortunately, this is a permanent problem. - + At least one graphic cannot be exported because Excel does not permit copying it. Unfortunately, this is a permanent problem. The graphic that triggered this message has been selected. + + + Legacy XL Toolbox Error + + + An error occurred in the 'legacy' part of the XL Toolbox add-in. The legacy parts are time-tested and usually work very well. Please make sure that you have selected the correct data or graph for the command. You may find the documentation at www.xltoolbox.net helpful. + + + Step by step, legacy XL Toolbox commands will be modernized, so hopefully in the future, this error will no longer occur. \ No newline at end of file diff --git a/XLToolbox/Vba/Api.cs b/XLToolbox/Vba/Api.cs index e28dbaec..0770c8f7 100755 --- a/XLToolbox/Vba/Api.cs +++ b/XLToolbox/Vba/Api.cs @@ -175,8 +175,8 @@ public void ShowException(string message) { VbaException e = new VbaException(message); Logger.Warn("VBA code called the XLToolbox.Vba.Api.Throw method", e); - ExceptionHandler.ExceptionViewModel vm = new ExceptionHandler.ExceptionViewModel(e); - vm.InjectInto().ShowDialogInForm(); + VbaExceptionViewModel vm = new VbaExceptionViewModel(e); + vm.InjectInto().ShowDialogInForm(); } /// diff --git a/XLToolbox/Vba/VbaExceptionView.xaml b/XLToolbox/Vba/VbaExceptionView.xaml new file mode 100755 index 00000000..ff0125dd --- /dev/null +++ b/XLToolbox/Vba/VbaExceptionView.xaml @@ -0,0 +1,56 @@ + + + + + + + + + + + + +