random-file-runner/MemoBoxForm.cs
Ray 9184eeee85 Added new icon and logo
Changed to latest RyzStudio8
Changed build script
2024-07-21 00:33:50 +01:00

210 lines
7.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms;
namespace RandomFileRunner
{
public class MemoBoxForm : Form
{
private ThMemoBox memoBox1;
private ThButton button3;
private ThButton button4;
private ContextMenuStrip contextMenuStrip1;
private System.ComponentModel.IContainer components;
private ToolStripMenuItem addDirectoryToolStripMenuItem;
private ToolStripMenuItem addFileToolStripMenuItem;
private FolderBrowserDialog folderBrowserDialog1;
private RyzStudio.Windows.ThemedForms.Composite.DialogFooter dialogFooter1;
private OpenFileDialog openFileDialog1;
public MemoBoxForm(List<string> lines)
{
InitializeComponent();
UISetup.Dialog(this);
if (lines != null)
{
memoBox1.TextBox.Lines = lines.ToArray();
}
memoBox1.TextBox.WordWrap = false;
}
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
memoBox1 = new ThMemoBox();
button3 = new ThButton();
contextMenuStrip1 = new ContextMenuStrip(components);
addDirectoryToolStripMenuItem = new ToolStripMenuItem();
addFileToolStripMenuItem = new ToolStripMenuItem();
button4 = new ThButton();
folderBrowserDialog1 = new FolderBrowserDialog();
openFileDialog1 = new OpenFileDialog();
dialogFooter1 = new RyzStudio.Windows.ThemedForms.Composite.DialogFooter();
contextMenuStrip1.SuspendLayout();
SuspendLayout();
//
// memoBox1
//
memoBox1.AllowDrop = true;
memoBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
memoBox1.BackColor = System.Drawing.Color.Transparent;
memoBox1.EnableReactiveVisual = true;
memoBox1.Font = new System.Drawing.Font("Segoe UI", 9F);
memoBox1.Location = new System.Drawing.Point(10, 70);
memoBox1.Name = "memoBox1";
memoBox1.ReadOnly = false;
memoBox1.ScrollBars = ScrollBars.Vertical;
memoBox1.Size = new System.Drawing.Size(364, 357);
memoBox1.TabIndex = 191;
memoBox1.TabStop = false;
memoBox1.WordWrap = false;
//
// button3
//
button3.ActiveImage = null;
button3.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
button3.BackColor = System.Drawing.Color.Transparent;
button3.ContextMenuStrip = contextMenuStrip1;
button3.EnableMenuOnClick = true;
button3.EnableReactiveVisual = true;
button3.HoverImage = null;
button3.IdleImage = null;
button3.LabelText = "&Add";
button3.Location = new System.Drawing.Point(10, 21);
button3.Name = "button3";
button3.Size = new System.Drawing.Size(177, 33);
button3.TabIndex = 189;
button3.TabStop = false;
//
// contextMenuStrip1
//
contextMenuStrip1.Items.AddRange(new ToolStripItem[] { addDirectoryToolStripMenuItem, addFileToolStripMenuItem });
contextMenuStrip1.Name = "contextMenuStrip1";
contextMenuStrip1.Size = new System.Drawing.Size(148, 48);
//
// addDirectoryToolStripMenuItem
//
addDirectoryToolStripMenuItem.Name = "addDirectoryToolStripMenuItem";
addDirectoryToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
addDirectoryToolStripMenuItem.Text = "&Add Directory";
addDirectoryToolStripMenuItem.Click += addDirectoryToolStripMenuItem_Click;
//
// addFileToolStripMenuItem
//
addFileToolStripMenuItem.Name = "addFileToolStripMenuItem";
addFileToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
addFileToolStripMenuItem.Text = "Add &File";
addFileToolStripMenuItem.Click += addFileToolStripMenuItem_Click;
//
// button4
//
button4.ActiveImage = null;
button4.Anchor = AnchorStyles.Top | AnchorStyles.Right;
button4.BackColor = System.Drawing.Color.Transparent;
button4.EnableMenuOnClick = false;
button4.EnableReactiveVisual = true;
button4.HoverImage = null;
button4.IdleImage = null;
button4.LabelText = "&Clear";
button4.Location = new System.Drawing.Point(197, 21);
button4.Name = "button4";
button4.Size = new System.Drawing.Size(177, 33);
button4.TabIndex = 190;
button4.TabStop = false;
button4.MouseClick += button4_MouseClick;
//
// folderBrowserDialog1
//
folderBrowserDialog1.ShowNewFolderButton = false;
//
// openFileDialog1
//
openFileDialog1.Filter = "All files (*.*)|*.*";
//
// dialogFooter1
//
dialogFooter1.BackColor = System.Drawing.Color.FromArgb(240, 240, 240);
dialogFooter1.Button1Text = "&OK";
dialogFooter1.Dialog = this;
dialogFooter1.Dock = DockStyle.Bottom;
dialogFooter1.Location = new System.Drawing.Point(0, 437);
dialogFooter1.Name = "dialogFooter1";
dialogFooter1.Size = new System.Drawing.Size(384, 84);
//
// MemoBoxForm
//
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
BackColor = System.Drawing.Color.White;
ClientSize = new System.Drawing.Size(384, 521);
Controls.Add(dialogFooter1);
Controls.Add(memoBox1);
Controls.Add(button3);
Controls.Add(button4);
MinimumSize = new System.Drawing.Size(400, 560);
Name = "MemoBoxForm";
ShowIcon = false;
ShowInTaskbar = false;
Text = "Manage Search Paths";
contextMenuStrip1.ResumeLayout(false);
ResumeLayout(false);
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
memoBox1.Focus();
}
public List<string> Result
{
get => memoBox1.Lines;
}
/// <summary>
/// Add Directory.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void addDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
{
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
memoBox1.TextBox.AddLine(folderBrowserDialog1.SelectedPath);
}
}
/// <summary>
/// Add File.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void addFileToolStripMenuItem_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
memoBox1.TextBox.AddLine(openFileDialog1.FileName);
}
}
/// <summary>
/// Clear.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button4_MouseClick(object sender, MouseEventArgs e)
{
memoBox1.Text = string.Empty;
}
}
}