diff --git a/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj b/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj
index c4f1da2..3a511a4 100644
--- a/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj
+++ b/src/L10NSharp.Windows.Forms/L10NSharp.Windows.Forms.csproj
@@ -38,12 +38,6 @@
Form
-
- Form
-
-
- Form
-
Form
diff --git a/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlg.cs b/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlg.cs
deleted file mode 100644
index 89a1f90..0000000
--- a/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlg.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Drawing;
-using System.Reflection;
-using L10NSharp.CodeReader;
-
-namespace L10NSharp.Windows.Forms.UIComponents
-{
- internal class InitializationProgressDlg: InitializationProgressDlgBase
- {
- public IEnumerable ExtractedInfo { get; private set; }
-
- /// ------------------------------------------------------------------------------------
- public InitializationProgressDlg(string appName, IEnumerable additionalLocalizationMethods,
- params string[] namespaceBeginnings):
- base(appName, additionalLocalizationMethods, namespaceBeginnings)
- {
- }
-
- public InitializationProgressDlg(string appName, Icon formIcon,
- IEnumerable additionalLocalizationMethods,
- params string[] namespaceBeginnings) :
- base(appName, formIcon, additionalLocalizationMethods, namespaceBeginnings)
- {
- }
-
- protected override void backgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
- {
- var extractor = new StringExtractor();
- e.Result = extractor.DoExtractingWork(_additionalLocalizationMethods, _namespaceBeginnings, sender as BackgroundWorker);
- }
-
- protected override void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
- {
- if (e.Error != null)
- {
- var message = $"Error in extracting localizable strings: {e.Error.Message} ({e.Error})";
- Console.WriteLine(message);
-
- ReportError(message);
- }
- else
- {
- try
- {
- if (e.Result is IEnumerable info)
- {
- ExtractedInfo = info;
- }
- else
- {
- var got = e.Result == null ? "null" : $"{e.Result.GetType()}: {e.Result}";
- ReportError($"Expected IEnumerable but got {got}");
- }
- }
- catch (Exception ex)
- {
- var message = $"Error in extracting localizable strings: {ex.Message}";
- Debug.WriteLine(message);
- ReportError(message);
- }
- }
-
- Close();
- }
-
- private void ReportError(string message)
- {
- // Adding the error to the ExtractedInfo here serves two purposes.
- // 1. It makes sure we get a valid file. Otherwise we get failures later.
- // 2. It provides a way for the developer to see the actual error which caused extraction to fail.
- ExtractedInfo = new[]
- {
- new LocalizingInfoWinforms("StringExtractor_Error")
- {
- LangId = "en",
- Text = "An error occurred while collecting strings or there were no strings to collect. " +
- "Check comment for exception. Note, the exception may not occur again until you delete this file.",
- Comment = message
- }
- };
- }
- }
-}
diff --git a/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlgBase.Designer.cs b/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlgBase.Designer.cs
deleted file mode 100644
index 955f6ab..0000000
--- a/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlgBase.Designer.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-namespace L10NSharp.Windows.Forms.UIComponents
-{
- partial class InitializationProgressDlgBase
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this._tableLayout = new System.Windows.Forms.TableLayoutPanel();
- this._labelMessage = new System.Windows.Forms.Label();
- this._progressBar = new System.Windows.Forms.ProgressBar();
- this._labelDetails = new System.Windows.Forms.Label();
- this._backgroundWorker = new System.ComponentModel.BackgroundWorker();
- this._tableLayout.SuspendLayout();
- this.SuspendLayout();
- //
- // _tableLayout
- //
- this._tableLayout.ColumnCount = 1;
- this._tableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
- this._tableLayout.Controls.Add(this._labelMessage, 0, 0);
- this._tableLayout.Controls.Add(this._progressBar, 0, 1);
- this._tableLayout.Controls.Add(this._labelDetails, 0, 2);
- this._tableLayout.Dock = System.Windows.Forms.DockStyle.Fill;
- this._tableLayout.Location = new System.Drawing.Point(15, 20);
- this._tableLayout.Name = "_tableLayout";
- this._tableLayout.RowCount = 3;
- this._tableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle());
- this._tableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle());
- this._tableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
- this._tableLayout.Size = new System.Drawing.Size(326, 91);
- this._tableLayout.TabIndex = 1;
- //
- // _labelMessage
- //
- this._labelMessage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this._labelMessage.AutoSize = true;
- this._labelMessage.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this._labelMessage.Location = new System.Drawing.Point(0, 0);
- this._labelMessage.Margin = new System.Windows.Forms.Padding(0, 0, 0, 6);
- this._labelMessage.Name = "_labelMessage";
- this._labelMessage.Size = new System.Drawing.Size(326, 15);
- this._labelMessage.TabIndex = 1;
- this._labelMessage.Text = "Preparing User Interface for Localization..";
- //
- // _progressBar
- //
- this._progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this._progressBar.Location = new System.Drawing.Point(0, 21);
- this._progressBar.Margin = new System.Windows.Forms.Padding(0);
- this._progressBar.Name = "_progressBar";
- this._progressBar.Size = new System.Drawing.Size(326, 18);
- this._progressBar.TabIndex = 2;
- //
- // _labelDetails
- //
- this._labelDetails.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this._labelDetails.AutoEllipsis = true;
- this._labelDetails.AutoSize = true;
- this._labelDetails.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this._labelDetails.Location = new System.Drawing.Point(0, 49);
- this._labelDetails.Margin = new System.Windows.Forms.Padding(0, 10, 0, 0);
- this._labelDetails.Name = "_labelDetails";
- this._labelDetails.Size = new System.Drawing.Size(326, 30);
- this._labelDetails.TabIndex = 3;
- this._labelDetails.Text = "Looking for user interface text that can be localized...";
- //
- // _backgroundWorker
- //
- this._backgroundWorker.WorkerReportsProgress = true;
- this._backgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker_DoWork);
- this._backgroundWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker_ProgressChanged);
- this._backgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker_RunWorkerCompleted);
- //
- // InitializationProgressDlg
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(356, 126);
- this.Controls.Add(this._tableLayout);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "InitializationProgressDlg";
- this.Padding = new System.Windows.Forms.Padding(15, 20, 15, 15);
- this.Text = "#";
- this.TopMost = true;
- this._tableLayout.ResumeLayout(false);
- this._tableLayout.PerformLayout();
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- protected System.Windows.Forms.TableLayoutPanel _tableLayout;
- protected System.Windows.Forms.Label _labelMessage;
- protected System.Windows.Forms.ProgressBar _progressBar;
- protected System.Windows.Forms.Label _labelDetails;
- protected System.ComponentModel.BackgroundWorker _backgroundWorker;
- }
-}
diff --git a/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlgBase.cs b/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlgBase.cs
deleted file mode 100644
index e751a6b..0000000
--- a/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlgBase.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Reflection;
-using System.Windows.Forms;
-
-namespace L10NSharp.Windows.Forms.UIComponents
-{
- /// ----------------------------------------------------------------------------------------
- internal partial class InitializationProgressDlgBase : Form
- {
- protected readonly IEnumerable _additionalLocalizationMethods;
- protected readonly string[] _namespaceBeginnings;
- private readonly Icon _formIcon;
-
- /// ------------------------------------------------------------------------------------
- protected InitializationProgressDlgBase(string appName,
- IEnumerable additionalLocalizationMethods,
- params string[] namespaceBeginnings)
- {
- InitializeComponent();
- Text = appName;
- _additionalLocalizationMethods = additionalLocalizationMethods;
- _namespaceBeginnings = namespaceBeginnings;
- }
-
- protected InitializationProgressDlgBase(string appName, Icon formIcon,
- IEnumerable additionalLocalizationMethods, params string[] namespaceBeginnings) :
- this(appName, additionalLocalizationMethods, namespaceBeginnings)
- {
- _formIcon = formIcon;
- }
-
- /// ------------------------------------------------------------------------------------
- protected override void OnShown(EventArgs e)
- {
- base.OnShown(e);
- _backgroundWorker.RunWorkerAsync();
- }
-
- protected virtual void backgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
- {
- }
-
-
- private void backgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
- {
- _progressBar.Value = Math.Min(e.ProgressPercentage, 100);
- }
-
- protected virtual void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
- {
- }
-
- protected override void OnHandleCreated(EventArgs e)
- {
- base.OnHandleCreated(e);
-
- // a bug in Mono requires us to wait to set Icon until handle created.
- if (_formIcon != null) Icon = _formIcon;
- }
- }
-}
diff --git a/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlgBase.resx b/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlgBase.resx
deleted file mode 100644
index 0278764..0000000
--- a/src/L10NSharp.Windows.Forms/UIComponents/InitializationProgressDlgBase.resx
+++ /dev/null
@@ -1,123 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 17, 17
-
-
\ No newline at end of file
diff --git a/src/L10NSharp.Windows.Forms/UIComponents/NodeComparer.cs b/src/L10NSharp.Windows.Forms/UIComponents/NodeComparer.cs
deleted file mode 100644
index 74df141..0000000
--- a/src/L10NSharp.Windows.Forms/UIComponents/NodeComparer.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using System.Collections.Generic;
-using System.Globalization;
-using System.Windows.Forms;
-
-namespace L10NSharp.Windows.Forms.UIComponents
-{
- /// ----------------------------------------------------------------------------------------
- internal class NodeComparer : IComparer>
- {
- internal enum SortField
- {
- Id = 0,
- SourceText = 1,
- TargetText = 2,
- SourceToolTip = 3,
- TargetToolTip = 4
- }
-
- private readonly string _srcLangId;
- private readonly string _tgtLangId;
- private readonly SortOrder _sortOrder;
- private readonly SortField _sortField;
-
- /// ------------------------------------------------------------------------------------
- internal NodeComparer(string srcLangId, string tgtLangId, SortOrder sortOrder, SortField sortField)
- {
- _srcLangId = srcLangId;
- _tgtLangId = tgtLangId;
- _sortOrder = sortOrder;
- _sortField = sortField;
- }
-
- /// ------------------------------------------------------------------------------------
- public int Compare(LocTreeNode x, LocTreeNode y)
- {
- string xText = string.Empty;
- string yText = string.Empty;
-
- var prefixToRemove = (x.TreeView != null && x.TreeView.SelectedNode != null ?
- x.TreeView.SelectedNode.Name : string.Empty);
-
- const string kNonsenseIfNoPrefixExists = "5%ij#a"; //replace fails if the pattern is "", so use this
- if (string.IsNullOrEmpty(prefixToRemove))
- prefixToRemove = kNonsenseIfNoPrefixExists;
-
- var ci = CultureInfo.GetCultureInfo("en");
-
- switch ((int)_sortField)
- {
- case 0:
- xText = x.Id.Replace(prefixToRemove, string.Empty).Trim('.');
- yText = y.Id.Replace(prefixToRemove, string.Empty).Trim('.');
- break;
-
- case 1:
- xText = x.GetText(_srcLangId) ?? string.Empty;
- yText = y.GetText(_srcLangId) ?? string.Empty;
- ci = CultureInfo.GetCultureInfo(_srcLangId);
- break;
-
- case 2:
- xText = (x.GetTranslatedText(_tgtLangId) ?? x.GetText(_tgtLangId)) ?? string.Empty;
- yText = (y.GetTranslatedText(_tgtLangId) ?? y.GetText(_tgtLangId)) ?? string.Empty;
- ci = CultureInfo.GetCultureInfo(_tgtLangId);
- break;
-
- case 3:
- xText = x.GetToolTip(_srcLangId) ?? string.Empty;
- yText = y.GetToolTip(_srcLangId) ?? string.Empty;
- ci = CultureInfo.GetCultureInfo(_srcLangId);
- break;
-
- case 4:
- xText = (x.GetTranslatedToolTip(_tgtLangId) ?? x.GetToolTip(_tgtLangId)) ?? string.Empty;
- yText = (y.GetTranslatedToolTip(_tgtLangId) ?? y.GetToolTip(_tgtLangId)) ?? string.Empty;
- ci = CultureInfo.GetCultureInfo(_tgtLangId);
- break;
- }
-
- return (_sortOrder == SortOrder.Ascending ?
- string.Compare(xText, yText, false, ci) :
- string.Compare(yText, xText, false, ci));
- }
- }
-}
diff --git a/src/L10NSharp.Windows.Forms/UtilsWinforms.cs b/src/L10NSharp.Windows.Forms/UtilsWinforms.cs
deleted file mode 100644
index 05fce8c..0000000
--- a/src/L10NSharp.Windows.Forms/UtilsWinforms.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-using System;
-using System.Windows.Forms;
-using System.Runtime.InteropServices;
-
-namespace L10NSharp.Windows.Forms
-{
- /// ----------------------------------------------------------------------------------------
- internal static class UtilsWinforms
- {
- private const int WM_SETREDRAW = 0xB;
-
-
- [DllImport("user32.dll", CharSet = CharSet.Auto, EntryPoint = "SendMessage")]
- private static extern void SendMessageWindows(IntPtr hWnd, int msg, int wParam, int lParam);
-
- public static void SendMessage(IntPtr hWnd, int msg, int wParam, int lParam)
- {
- SendMessageWindows(hWnd, msg, wParam, lParam);
- }
-
- /// ------------------------------------------------------------------------------------
- ///
- /// Turns window redrawing on or off. After turning on, the window will be invalidated.
- ///
- /// ------------------------------------------------------------------------------------
- public static void SetWindowRedraw(Control ctrl, bool turnOn)
- {
- SetWindowRedraw(ctrl, turnOn, true);
- }
-
- /// ------------------------------------------------------------------------------------
- public static void SetWindowRedraw(Control ctrl, bool turnOn,
- bool invalidateAfterTurningOn)
- {
- if (ctrl != null && !ctrl.IsDisposed && ctrl.IsHandleCreated)
- {
- if (L10NSharp.Utils.IsMono)
- {
- if (turnOn)
- ctrl.ResumeLayout(invalidateAfterTurningOn);
- else
- ctrl.SuspendLayout();
- }
- else
- {
- SendMessage(ctrl.Handle, WM_SETREDRAW, (turnOn ? 1 : 0), 0);
- }
-
- if (turnOn && invalidateAfterTurningOn)
- ctrl.Invalidate(true);
- }
- }
- }
-}