using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.IO;

namespace RelativePaths
{
    public partial class frm79RelativePaths : Form
    {
        public frm79RelativePaths()
        {
            InitializeComponent();
        }

        // Use the startup path for Path 1.
        private void frm79RelativePaths_Load(object sender, EventArgs e)
        {
            path1TextBox.Text = Application.StartupPath;

            string sourceDir = Path.GetFullPath(
                Path.Combine(Application.StartupPath, "..\\.."));
            Console.WriteLine(sourceDir);
        }

        // Combine the paths.
        private void combineButton_Click(object sender, EventArgs e)
        {
            string combined = Path.GetFullPath(
                Path.Combine(path1TextBox.Text, path2TextBox.Text));
            resultTextBox.Text = combined;
        }


        /// <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()
        {
            this.resultTextBox = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.combineButton = new System.Windows.Forms.Button();
            this.path2TextBox = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.path1TextBox = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            // 
            // resultTextBox
            // 
            this.resultTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.resultTextBox.Location = new System.Drawing.Point(59, 93);
            this.resultTextBox.Name = "resultTextBox";
            this.resultTextBox.ReadOnly = true;
            this.resultTextBox.Size = new System.Drawing.Size(263, 20);
            this.resultTextBox.TabIndex = 13;
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(12, 96);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(40, 13);
            this.label3.TabIndex = 12;
            this.label3.Text = "Result:";
            // 
            // combineButton
            // 
            this.combineButton.Anchor = System.Windows.Forms.AnchorStyles.Top;
            this.combineButton.Location = new System.Drawing.Point(130, 64);
            this.combineButton.Name = "combineButton";
            this.combineButton.Size = new System.Drawing.Size(75, 23);
            this.combineButton.TabIndex = 11;
            this.combineButton.Text = "Combine";
            this.combineButton.UseVisualStyleBackColor = true;
            this.combineButton.Click += new System.EventHandler(this.combineButton_Click);
            // 
            // path2TextBox
            // 
            this.path2TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.path2TextBox.Location = new System.Drawing.Point(59, 38);
            this.path2TextBox.Name = "path2TextBox";
            this.path2TextBox.Size = new System.Drawing.Size(263, 20);
            this.path2TextBox.TabIndex = 10;
            this.path2TextBox.Text = "..\\..\\test.txt";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(12, 41);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(41, 13);
            this.label2.TabIndex = 9;
            this.label2.Text = "Path 2:";
            // 
            // path1TextBox
            // 
            this.path1TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.path1TextBox.Location = new System.Drawing.Point(59, 12);
            this.path1TextBox.Name = "path1TextBox";
            this.path1TextBox.Size = new System.Drawing.Size(263, 20);
            this.path1TextBox.TabIndex = 8;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(12, 15);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(41, 13);
            this.label1.TabIndex = 7;
            this.label1.Text = "Path 1:";
            // 
            // frm79RelativePaths
            // 
            this.AcceptButton = this.combineButton;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(334, 127);
            this.Controls.Add(this.resultTextBox);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.combineButton);
            this.Controls.Add(this.path2TextBox);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.path1TextBox);
            this.Controls.Add(this.label1);
            this.Name = "frm79RelativePaths";
            this.Text = "RelativePaths";
            this.Load += new System.EventHandler(this.frm79RelativePaths_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.TextBox resultTextBox;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Button combineButton;
        private System.Windows.Forms.TextBox path2TextBox;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.TextBox path1TextBox;
        private System.Windows.Forms.Label label1;
    }
}