Skip to content

Instantly share code, notes, and snippets.

@bolenton
Last active August 29, 2015 14:27
Show Gist options
  • Save bolenton/cb2f6fb93ea032c108a4 to your computer and use it in GitHub Desktop.
Save bolenton/cb2f6fb93ea032c108a4 to your computer and use it in GitHub Desktop.
using System;
using System.Windows.Forms;
using System.IO;
namespace Bethel_DFWMessageTool
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void selectFileBtn_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
}
private void outputFileBtn_Click(object sender, EventArgs e)
{
var outputFolder = outputFileTB;
folderBrowserDialog1.ShowDialog();
outputFolder.Text = folderBrowserDialog1.SelectedPath;
}
private void openFileDialog1_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
{
selectFileTB.Text = openFileDialog1.FileName;
}
private void saveBtn_Click(object sender, EventArgs e)
{
if (selectFileTB.TextLength > 0 && outputFileTB.TextLength > 0)
{
File.Move(selectFileTB.Text, outputFileTB.Text + "/" + dateTimePicker1.Value.ToString("yyyy_MM_dd") + "_" + speakerTitleTB.Text + firstNameTB.Text +
lastNameTB.Text + "_" + messageTitleTB.Text + ".mp3");
Close();
}
else
{
MessageBox.Show("Please select a File, and the Output Folder First!");
}
}
}
}
namespace Bethel_DFWMessageTool
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.speakerTitleTB = new System.Windows.Forms.TextBox();
this.firstNameTB = new System.Windows.Forms.TextBox();
this.lastNameTB = new System.Windows.Forms.TextBox();
this.messageTitleTB = new System.Windows.Forms.TextBox();
this.selectFileBtn = new System.Windows.Forms.Button();
this.outputFileTB = new System.Windows.Forms.TextBox();
this.selectFileTB = new System.Windows.Forms.TextBox();
this.outputFileBtn = new System.Windows.Forms.Button();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.saveBtn = new System.Windows.Forms.Button();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// speakerTitleTB
//
this.speakerTitleTB.Location = new System.Drawing.Point(24, 192);
this.speakerTitleTB.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.speakerTitleTB.Name = "speakerTitleTB";
this.speakerTitleTB.Size = new System.Drawing.Size(148, 27);
this.speakerTitleTB.TabIndex = 3;
//
// firstNameTB
//
this.firstNameTB.Location = new System.Drawing.Point(183, 192);
this.firstNameTB.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.firstNameTB.Name = "firstNameTB";
this.firstNameTB.Size = new System.Drawing.Size(185, 27);
this.firstNameTB.TabIndex = 4;
//
// lastNameTB
//
this.lastNameTB.Location = new System.Drawing.Point(377, 192);
this.lastNameTB.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.lastNameTB.Name = "lastNameTB";
this.lastNameTB.Size = new System.Drawing.Size(174, 27);
this.lastNameTB.TabIndex = 5;
//
// messageTitleTB
//
this.messageTitleTB.Location = new System.Drawing.Point(24, 280);
this.messageTitleTB.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.messageTitleTB.Name = "messageTitleTB";
this.messageTitleTB.Size = new System.Drawing.Size(223, 27);
this.messageTitleTB.TabIndex = 7;
//
// selectFileBtn
//
this.selectFileBtn.Location = new System.Drawing.Point(442, 52);
this.selectFileBtn.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.selectFileBtn.Name = "selectFileBtn";
this.selectFileBtn.Size = new System.Drawing.Size(112, 35);
this.selectFileBtn.TabIndex = 8;
this.selectFileBtn.Text = "Select File";
this.selectFileBtn.UseVisualStyleBackColor = true;
this.selectFileBtn.Click += new System.EventHandler(this.selectFileBtn_Click);
//
// outputFileTB
//
this.outputFileTB.Location = new System.Drawing.Point(24, 100);
this.outputFileTB.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.outputFileTB.Multiline = true;
this.outputFileTB.Name = "outputFileTB";
this.outputFileTB.ReadOnly = true;
this.outputFileTB.Size = new System.Drawing.Size(408, 33);
this.outputFileTB.TabIndex = 9;
//
// selectFileTB
//
this.selectFileTB.AllowDrop = true;
this.selectFileTB.Location = new System.Drawing.Point(24, 52);
this.selectFileTB.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.selectFileTB.Name = "selectFileTB";
this.selectFileTB.ReadOnly = true;
this.selectFileTB.Size = new System.Drawing.Size(408, 27);
this.selectFileTB.TabIndex = 10;
//
// outputFileBtn
//
this.outputFileBtn.Location = new System.Drawing.Point(445, 97);
this.outputFileBtn.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.outputFileBtn.Name = "outputFileBtn";
this.outputFileBtn.Size = new System.Drawing.Size(112, 35);
this.outputFileBtn.TabIndex = 11;
this.outputFileBtn.Text = "Output File";
this.outputFileBtn.UseVisualStyleBackColor = true;
this.outputFileBtn.Click += new System.EventHandler(this.outputFileBtn_Click);
//
// dateTimePicker1
//
this.dateTimePicker1.CustomFormat = "2015_08_21";
this.dateTimePicker1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.dateTimePicker1.Location = new System.Drawing.Point(258, 280);
this.dateTimePicker1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.Size = new System.Drawing.Size(298, 27);
this.dateTimePicker1.TabIndex = 12;
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
this.openFileDialog1.FileOk += new System.ComponentModel.CancelEventHandler(this.openFileDialog1_FileOk);
//
// saveBtn
//
this.saveBtn.Location = new System.Drawing.Point(238, 340);
this.saveBtn.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.saveBtn.Name = "saveBtn";
this.saveBtn.Size = new System.Drawing.Size(112, 35);
this.saveBtn.TabIndex = 13;
this.saveBtn.Text = "Save !!!";
this.saveBtn.UseVisualStyleBackColor = true;
this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(48, 168);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(102, 20);
this.label1.TabIndex = 14;
this.label1.Text = "Speaker Title";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(234, 168);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(88, 20);
this.label2.TabIndex = 15;
this.label2.Text = "First Name";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(422, 168);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(85, 20);
this.label3.TabIndex = 16;
this.label3.Text = "Last Name";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(82, 255);
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(106, 20);
this.label4.TabIndex = 17;
this.label4.Text = "Message Title";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(388, 255);
this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(41, 20);
this.label5.TabIndex = 18;
this.label5.Text = "Date";
//
// Form1
//
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(570, 394);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.saveBtn);
this.Controls.Add(this.dateTimePicker1);
this.Controls.Add(this.outputFileBtn);
this.Controls.Add(this.selectFileTB);
this.Controls.Add(this.outputFileTB);
this.Controls.Add(this.selectFileBtn);
this.Controls.Add(this.messageTitleTB);
this.Controls.Add(this.lastNameTB);
this.Controls.Add(this.firstNameTB);
this.Controls.Add(this.speakerTitleTB);
this.Font = new System.Drawing.Font("Razer Text Regular", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.MaximizeBox = false;
this.Name = "Form1";
this.Text = "Bethel_DFW Messsage Tool";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox speakerTitleTB;
private System.Windows.Forms.TextBox firstNameTB;
private System.Windows.Forms.TextBox lastNameTB;
private System.Windows.Forms.TextBox messageTitleTB;
private System.Windows.Forms.Button selectFileBtn;
private System.Windows.Forms.TextBox outputFileTB;
private System.Windows.Forms.TextBox selectFileTB;
private System.Windows.Forms.Button outputFileBtn;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.Button saveBtn;
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
}
}
using System;
using System.Windows.Forms;
namespace Bethel_DFWMessageTool
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment