ArchiveKind was a hardcoded two-value enum (ssh_access/config_update),
wired through FilenameParser's regex, MailTemplateSet's two fixed
slots, and SettingsForm's two fixed tabs. Operators wanted arbitrary
custom templates (own file-name suffix, subject, body) without a code
change per new archive kind ssh-access-tui might start producing.
Replaced with MailTemplateDefinition (DisplayName/FileSuffix/Subject/
BodyHtml) in an open-ended list: FilenameParser now accepts any
"{login}_{suffix}.7z" and ArchiveScanner matches the suffix against
the configured list; SendJob.Kind/SendLogEntry.Kind became plain
strings; SettingsForm gained a template list (+/- buttons, editor
panel) replacing the two static tabs. ssh_access/config_update are now
just the two default entries in that list, not special-cased.
Handles the two backward-compat edges that matter for a tool already
in real use: old config.json's object-shaped "templates" migrates to
the new list shape transparently on first load (DataContractJsonSerializer
turned out to silently produce an empty list rather than throw on the
old shape, so detection is structural, not exception-based), and old
send-log.csv rows with PascalCase Kind values (SshAccess/ConfigUpdate)
still dedupe correctly against the new snake_case suffixes.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
355 lines
19 KiB
C#
355 lines
19 KiB
C#
namespace BulkArchiveMailer.AddIn.UI
|
|
{
|
|
partial class SettingsForm
|
|
{
|
|
private System.ComponentModel.IContainer components = null;
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (disposing && components != null)
|
|
{
|
|
components.Dispose();
|
|
}
|
|
|
|
base.Dispose(disposing);
|
|
}
|
|
|
|
private System.Windows.Forms.TabControl tabControl;
|
|
private System.Windows.Forms.TabPage tabGeneral;
|
|
private System.Windows.Forms.TabPage tabTemplates;
|
|
|
|
private System.Windows.Forms.Label lblArchiveFolder;
|
|
private System.Windows.Forms.TextBox txtArchiveFolder;
|
|
private System.Windows.Forms.Button btnBrowseFolder;
|
|
|
|
private System.Windows.Forms.Label lblDomain;
|
|
private System.Windows.Forms.TextBox txtDomain;
|
|
|
|
private System.Windows.Forms.Label lblSignaturePath;
|
|
private System.Windows.Forms.TextBox txtSignaturePath;
|
|
private System.Windows.Forms.Button btnBrowseSignature;
|
|
private System.Windows.Forms.Button btnAutoDetectSignature;
|
|
|
|
private System.Windows.Forms.CheckBox chkTestModeDefault;
|
|
|
|
private System.Windows.Forms.Label lblFromAccount;
|
|
private System.Windows.Forms.ComboBox cboFromAccount;
|
|
|
|
private System.Windows.Forms.ListBox lstTemplates;
|
|
private System.Windows.Forms.Button btnAddTemplate;
|
|
private System.Windows.Forms.Button btnRemoveTemplate;
|
|
|
|
private System.Windows.Forms.Label lblTplDisplayName;
|
|
private System.Windows.Forms.TextBox txtTplDisplayName;
|
|
private System.Windows.Forms.Label lblTplFileSuffix;
|
|
private System.Windows.Forms.TextBox txtTplFileSuffix;
|
|
private System.Windows.Forms.Label lblTplFileSuffixHint;
|
|
private System.Windows.Forms.Label lblTplSubject;
|
|
private System.Windows.Forms.TextBox txtTplSubject;
|
|
private System.Windows.Forms.Label lblTplBody;
|
|
private System.Windows.Forms.TextBox txtTplBody;
|
|
private System.Windows.Forms.Label lblTplHint;
|
|
|
|
private System.Windows.Forms.Button btnSave;
|
|
private System.Windows.Forms.Button btnCancel;
|
|
private System.Windows.Forms.Button btnResetDefaults;
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
this.tabControl = new System.Windows.Forms.TabControl();
|
|
this.tabGeneral = new System.Windows.Forms.TabPage();
|
|
this.tabTemplates = new System.Windows.Forms.TabPage();
|
|
|
|
this.lblArchiveFolder = new System.Windows.Forms.Label();
|
|
this.txtArchiveFolder = new System.Windows.Forms.TextBox();
|
|
this.btnBrowseFolder = new System.Windows.Forms.Button();
|
|
|
|
this.lblDomain = new System.Windows.Forms.Label();
|
|
this.txtDomain = new System.Windows.Forms.TextBox();
|
|
|
|
this.lblSignaturePath = new System.Windows.Forms.Label();
|
|
this.txtSignaturePath = new System.Windows.Forms.TextBox();
|
|
this.btnBrowseSignature = new System.Windows.Forms.Button();
|
|
this.btnAutoDetectSignature = new System.Windows.Forms.Button();
|
|
|
|
this.chkTestModeDefault = new System.Windows.Forms.CheckBox();
|
|
|
|
this.lblFromAccount = new System.Windows.Forms.Label();
|
|
this.cboFromAccount = new System.Windows.Forms.ComboBox();
|
|
|
|
this.lstTemplates = new System.Windows.Forms.ListBox();
|
|
this.btnAddTemplate = new System.Windows.Forms.Button();
|
|
this.btnRemoveTemplate = new System.Windows.Forms.Button();
|
|
|
|
this.lblTplDisplayName = new System.Windows.Forms.Label();
|
|
this.txtTplDisplayName = new System.Windows.Forms.TextBox();
|
|
this.lblTplFileSuffix = new System.Windows.Forms.Label();
|
|
this.txtTplFileSuffix = new System.Windows.Forms.TextBox();
|
|
this.lblTplFileSuffixHint = new System.Windows.Forms.Label();
|
|
this.lblTplSubject = new System.Windows.Forms.Label();
|
|
this.txtTplSubject = new System.Windows.Forms.TextBox();
|
|
this.lblTplBody = new System.Windows.Forms.Label();
|
|
this.txtTplBody = new System.Windows.Forms.TextBox();
|
|
this.lblTplHint = new System.Windows.Forms.Label();
|
|
|
|
this.btnSave = new System.Windows.Forms.Button();
|
|
this.btnCancel = new System.Windows.Forms.Button();
|
|
this.btnResetDefaults = new System.Windows.Forms.Button();
|
|
|
|
this.tabControl.SuspendLayout();
|
|
this.tabGeneral.SuspendLayout();
|
|
this.tabTemplates.SuspendLayout();
|
|
this.SuspendLayout();
|
|
|
|
//
|
|
// tabControl
|
|
//
|
|
this.tabControl.Location = new System.Drawing.Point(12, 12);
|
|
this.tabControl.Size = new System.Drawing.Size(660, 470);
|
|
this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
| System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
this.tabControl.TabPages.AddRange(new System.Windows.Forms.TabPage[] {
|
|
this.tabGeneral,
|
|
this.tabTemplates});
|
|
|
|
//
|
|
// tabGeneral
|
|
//
|
|
this.tabGeneral.Text = "Общие";
|
|
this.tabGeneral.Padding = new System.Windows.Forms.Padding(12);
|
|
this.tabGeneral.UseVisualStyleBackColor = true;
|
|
this.tabGeneral.Controls.Add(this.lblArchiveFolder);
|
|
this.tabGeneral.Controls.Add(this.txtArchiveFolder);
|
|
this.tabGeneral.Controls.Add(this.btnBrowseFolder);
|
|
this.tabGeneral.Controls.Add(this.lblDomain);
|
|
this.tabGeneral.Controls.Add(this.txtDomain);
|
|
this.tabGeneral.Controls.Add(this.lblSignaturePath);
|
|
this.tabGeneral.Controls.Add(this.txtSignaturePath);
|
|
this.tabGeneral.Controls.Add(this.btnBrowseSignature);
|
|
this.tabGeneral.Controls.Add(this.btnAutoDetectSignature);
|
|
this.tabGeneral.Controls.Add(this.chkTestModeDefault);
|
|
this.tabGeneral.Controls.Add(this.lblFromAccount);
|
|
this.tabGeneral.Controls.Add(this.cboFromAccount);
|
|
|
|
// lblArchiveFolder
|
|
this.lblArchiveFolder.Location = new System.Drawing.Point(15, 20);
|
|
this.lblArchiveFolder.Size = new System.Drawing.Size(400, 20);
|
|
this.lblArchiveFolder.Text = "Папка с архивами ssh-access-tui (общий выходной каталог):";
|
|
|
|
// txtArchiveFolder
|
|
this.txtArchiveFolder.Location = new System.Drawing.Point(15, 43);
|
|
this.txtArchiveFolder.Size = new System.Drawing.Size(500, 23);
|
|
|
|
// btnBrowseFolder
|
|
this.btnBrowseFolder.Location = new System.Drawing.Point(525, 41);
|
|
this.btnBrowseFolder.Size = new System.Drawing.Size(100, 25);
|
|
this.btnBrowseFolder.Text = "Обзор...";
|
|
this.btnBrowseFolder.UseVisualStyleBackColor = true;
|
|
this.btnBrowseFolder.Click += new System.EventHandler(this.btnBrowseFolder_Click);
|
|
|
|
// lblDomain
|
|
this.lblDomain.Location = new System.Drawing.Point(15, 85);
|
|
this.lblDomain.Size = new System.Drawing.Size(400, 20);
|
|
this.lblDomain.Text = "Домен электронной почты (login → login@домен):";
|
|
|
|
// txtDomain
|
|
this.txtDomain.Location = new System.Drawing.Point(15, 108);
|
|
this.txtDomain.Size = new System.Drawing.Size(300, 23);
|
|
|
|
// lblSignaturePath
|
|
this.lblSignaturePath.Location = new System.Drawing.Point(15, 150);
|
|
this.lblSignaturePath.Size = new System.Drawing.Size(610, 20);
|
|
this.lblSignaturePath.Text = "Файл подписи (.htm). Пусто = определять автоматически по умолчанию Outlook при каждой отправке:";
|
|
|
|
// txtSignaturePath
|
|
this.txtSignaturePath.Location = new System.Drawing.Point(15, 173);
|
|
this.txtSignaturePath.Size = new System.Drawing.Size(500, 23);
|
|
|
|
// btnBrowseSignature
|
|
this.btnBrowseSignature.Location = new System.Drawing.Point(525, 171);
|
|
this.btnBrowseSignature.Size = new System.Drawing.Size(100, 25);
|
|
this.btnBrowseSignature.Text = "Обзор...";
|
|
this.btnBrowseSignature.UseVisualStyleBackColor = true;
|
|
this.btnBrowseSignature.Click += new System.EventHandler(this.btnBrowseSignature_Click);
|
|
|
|
// btnAutoDetectSignature
|
|
this.btnAutoDetectSignature.Location = new System.Drawing.Point(15, 205);
|
|
this.btnAutoDetectSignature.Size = new System.Drawing.Size(280, 25);
|
|
this.btnAutoDetectSignature.Text = "Определить автоматически сейчас";
|
|
this.btnAutoDetectSignature.UseVisualStyleBackColor = true;
|
|
this.btnAutoDetectSignature.Click += new System.EventHandler(this.btnAutoDetectSignature_Click);
|
|
|
|
// chkTestModeDefault
|
|
this.chkTestModeDefault.Location = new System.Drawing.Point(15, 250);
|
|
this.chkTestModeDefault.Size = new System.Drawing.Size(610, 24);
|
|
this.chkTestModeDefault.Text = "По умолчанию открывать предпросмотр в тестовом режиме (сохранять в Черновики)";
|
|
this.chkTestModeDefault.UseVisualStyleBackColor = true;
|
|
|
|
// lblFromAccount
|
|
this.lblFromAccount.Location = new System.Drawing.Point(15, 284);
|
|
this.lblFromAccount.Size = new System.Drawing.Size(400, 20);
|
|
this.lblFromAccount.Text = "Отправлять от (аккаунт Outlook текущей сессии):";
|
|
|
|
// cboFromAccount
|
|
this.cboFromAccount.Location = new System.Drawing.Point(15, 307);
|
|
this.cboFromAccount.Size = new System.Drawing.Size(500, 23);
|
|
this.cboFromAccount.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
|
|
//
|
|
// tabTemplates
|
|
//
|
|
this.tabTemplates.Text = "Шаблоны";
|
|
this.tabTemplates.Padding = new System.Windows.Forms.Padding(12);
|
|
this.tabTemplates.UseVisualStyleBackColor = true;
|
|
this.tabTemplates.Controls.Add(this.lstTemplates);
|
|
this.tabTemplates.Controls.Add(this.btnAddTemplate);
|
|
this.tabTemplates.Controls.Add(this.btnRemoveTemplate);
|
|
this.tabTemplates.Controls.Add(this.lblTplDisplayName);
|
|
this.tabTemplates.Controls.Add(this.txtTplDisplayName);
|
|
this.tabTemplates.Controls.Add(this.lblTplFileSuffix);
|
|
this.tabTemplates.Controls.Add(this.txtTplFileSuffix);
|
|
this.tabTemplates.Controls.Add(this.lblTplFileSuffixHint);
|
|
this.tabTemplates.Controls.Add(this.lblTplSubject);
|
|
this.tabTemplates.Controls.Add(this.txtTplSubject);
|
|
this.tabTemplates.Controls.Add(this.lblTplBody);
|
|
this.tabTemplates.Controls.Add(this.txtTplBody);
|
|
this.tabTemplates.Controls.Add(this.lblTplHint);
|
|
|
|
// lstTemplates
|
|
this.lstTemplates.Location = new System.Drawing.Point(15, 20);
|
|
this.lstTemplates.Size = new System.Drawing.Size(190, 329);
|
|
this.lstTemplates.IntegralHeight = false;
|
|
this.lstTemplates.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
| System.Windows.Forms.AnchorStyles.Left)));
|
|
this.lstTemplates.SelectedIndexChanged += new System.EventHandler(this.lstTemplates_SelectedIndexChanged);
|
|
|
|
// btnAddTemplate
|
|
this.btnAddTemplate.Location = new System.Drawing.Point(15, 355);
|
|
this.btnAddTemplate.Size = new System.Drawing.Size(90, 27);
|
|
this.btnAddTemplate.Text = "+ Добавить";
|
|
this.btnAddTemplate.UseVisualStyleBackColor = true;
|
|
this.btnAddTemplate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
this.btnAddTemplate.Click += new System.EventHandler(this.btnAddTemplate_Click);
|
|
|
|
// btnRemoveTemplate
|
|
this.btnRemoveTemplate.Location = new System.Drawing.Point(115, 355);
|
|
this.btnRemoveTemplate.Size = new System.Drawing.Size(90, 27);
|
|
this.btnRemoveTemplate.Text = "Удалить";
|
|
this.btnRemoveTemplate.UseVisualStyleBackColor = true;
|
|
this.btnRemoveTemplate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
this.btnRemoveTemplate.Click += new System.EventHandler(this.btnRemoveTemplate_Click);
|
|
|
|
// lblTplDisplayName
|
|
this.lblTplDisplayName.Location = new System.Drawing.Point(220, 20);
|
|
this.lblTplDisplayName.Size = new System.Drawing.Size(200, 20);
|
|
this.lblTplDisplayName.Text = "Название:";
|
|
|
|
// txtTplDisplayName
|
|
this.txtTplDisplayName.Location = new System.Drawing.Point(220, 43);
|
|
this.txtTplDisplayName.Size = new System.Drawing.Size(410, 23);
|
|
this.txtTplDisplayName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right));
|
|
this.txtTplDisplayName.Leave += new System.EventHandler(this.txtTplDisplayName_Leave);
|
|
|
|
// lblTplFileSuffix
|
|
this.lblTplFileSuffix.Location = new System.Drawing.Point(220, 78);
|
|
this.lblTplFileSuffix.Size = new System.Drawing.Size(200, 20);
|
|
this.lblTplFileSuffix.Text = "Суффикс файла:";
|
|
|
|
// txtTplFileSuffix
|
|
this.txtTplFileSuffix.Location = new System.Drawing.Point(220, 101);
|
|
this.txtTplFileSuffix.Size = new System.Drawing.Size(200, 23);
|
|
|
|
// lblTplFileSuffixHint
|
|
this.lblTplFileSuffixHint.Location = new System.Drawing.Point(220, 127);
|
|
this.lblTplFileSuffixHint.Size = new System.Drawing.Size(410, 20);
|
|
this.lblTplFileSuffixHint.Text = "Файл: {login}_<суффикс>.7z";
|
|
this.lblTplFileSuffixHint.ForeColor = System.Drawing.SystemColors.GrayText;
|
|
|
|
// lblTplSubject
|
|
this.lblTplSubject.Location = new System.Drawing.Point(220, 160);
|
|
this.lblTplSubject.Size = new System.Drawing.Size(200, 20);
|
|
this.lblTplSubject.Text = "Тема письма:";
|
|
|
|
// txtTplSubject
|
|
this.txtTplSubject.Location = new System.Drawing.Point(220, 183);
|
|
this.txtTplSubject.Size = new System.Drawing.Size(410, 23);
|
|
this.txtTplSubject.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right));
|
|
|
|
// lblTplBody
|
|
this.lblTplBody.Location = new System.Drawing.Point(220, 218);
|
|
this.lblTplBody.Size = new System.Drawing.Size(200, 20);
|
|
this.lblTplBody.Text = "Тело письма (HTML):";
|
|
|
|
// txtTplBody
|
|
this.txtTplBody.Location = new System.Drawing.Point(220, 241);
|
|
this.txtTplBody.Size = new System.Drawing.Size(410, 160);
|
|
this.txtTplBody.Multiline = true;
|
|
this.txtTplBody.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
|
this.txtTplBody.AcceptsReturn = true;
|
|
this.txtTplBody.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
| System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
|
|
// lblTplHint
|
|
this.lblTplHint.Location = new System.Drawing.Point(220, 408);
|
|
this.lblTplHint.Size = new System.Drawing.Size(410, 20);
|
|
this.lblTplHint.Text = "Доступные плейсхолдеры: {Login}, {Email}, {Date}";
|
|
this.lblTplHint.ForeColor = System.Drawing.SystemColors.GrayText;
|
|
this.lblTplHint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
|
|
//
|
|
// btnSave / btnCancel / btnResetDefaults
|
|
//
|
|
this.btnResetDefaults.Location = new System.Drawing.Point(12, 494);
|
|
this.btnResetDefaults.Size = new System.Drawing.Size(220, 30);
|
|
this.btnResetDefaults.Text = "Сбросить шаблоны по умолчанию";
|
|
this.btnResetDefaults.UseVisualStyleBackColor = true;
|
|
this.btnResetDefaults.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
this.btnResetDefaults.Click += new System.EventHandler(this.btnResetDefaults_Click);
|
|
|
|
this.btnCancel.Location = new System.Drawing.Point(479, 494);
|
|
this.btnCancel.Size = new System.Drawing.Size(90, 30);
|
|
this.btnCancel.Text = "Отмена";
|
|
this.btnCancel.UseVisualStyleBackColor = true;
|
|
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
|
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
|
|
|
this.btnSave.Location = new System.Drawing.Point(575, 494);
|
|
this.btnSave.Size = new System.Drawing.Size(97, 30);
|
|
this.btnSave.Text = "Сохранить";
|
|
this.btnSave.UseVisualStyleBackColor = true;
|
|
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
|
|
|
|
//
|
|
// SettingsForm
|
|
//
|
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
this.ClientSize = new System.Drawing.Size(684, 536);
|
|
this.MinimumSize = new System.Drawing.Size(560, 420);
|
|
this.Controls.Add(this.tabControl);
|
|
this.Controls.Add(this.btnResetDefaults);
|
|
this.Controls.Add(this.btnCancel);
|
|
this.Controls.Add(this.btnSave);
|
|
this.Text = "BulkArchiveMailer — настройки";
|
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
|
|
this.MaximizeBox = true;
|
|
this.AcceptButton = null;
|
|
this.CancelButton = this.btnCancel;
|
|
|
|
this.tabControl.ResumeLayout(false);
|
|
this.tabGeneral.ResumeLayout(false);
|
|
this.tabGeneral.PerformLayout();
|
|
this.tabTemplates.ResumeLayout(false);
|
|
this.tabTemplates.PerformLayout();
|
|
this.ResumeLayout(false);
|
|
}
|
|
}
|
|
}
|