Advertisement
Guest User

Form1.cs

a guest
Nov 7th, 2012
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.02 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10.  
  11. namespace AX_Heuristic
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void OpenCSVButton_Click(object sender, EventArgs e)
  21.         {
  22.             string CSV_Path = "";
  23.             OpenCSVDialog.FileName = "";
  24.             OpenCSVDialog.ShowDialog();
  25.             CSV_Path = OpenCSVDialog.FileName;
  26.             CSVtextBox.Text = "";
  27.             CSVtextBox.Text = CSV_Path;
  28.         }
  29.  
  30.         private void exitToolStripMenuItem_Click(object sender, EventArgs e)
  31.         {
  32.             Application.Exit();
  33.         }
  34.  
  35.         private void OutputPathbutton_Click(object sender, EventArgs e)
  36.         {
  37.             string Save_Path = "";
  38.             OutputDialog.ShowDialog();
  39.             Save_Path = OutputDialog.FileName;
  40.             OutputtextBox.Text = "";
  41.             OutputtextBox.Text = Save_Path;
  42.         }
  43.  
  44.         private void ClearOutputbutton_Click(object sender, EventArgs e)
  45.         {
  46.             OutputrichTextBox.ResetText();
  47.         }
  48.  
  49.         private void Writebutton_Click(object sender, EventArgs e)
  50.         {
  51.             if (OutputtextBox.Text == "")
  52.             {
  53.                 DialogResult NoOutput = MessageBox.Show("Output path not Specified. Continue?","Warning",MessageBoxButtons.YesNo);
  54.  
  55.                 if (NoOutput == DialogResult.Yes)
  56.                 {
  57.  
  58.                     if (CSVtextBox.Text == "")
  59.                     {
  60.                         MessageBox.Show("No CSV File Selected.", "Error");
  61.                     }
  62.                     else
  63.                     {
  64.                         Program Pgm1 = new Program();
  65.                         Pgm1.AX1Program(CSVtextBox.Text);
  66.                         //StreamReader objstream = new StreamReader(CSVtextBox.Text);
  67.                         //OutputrichTextBox.Text = objstream.ReadToEnd();
  68.                     }
  69.                 }
  70.             }
  71.             else
  72.             {
  73.                 if (CSVtextBox.Text == "")
  74.                 {
  75.                     MessageBox.Show("No CSV File Selected.", "Error");
  76.                 }
  77.                 else
  78.                 {
  79.                     Program Pgm1 = new Program();
  80.                     Pgm1.AX1Program(CSVtextBox.Text);
  81.                     //StreamReader objstream = new StreamReader(CSVtextBox.Text);
  82.                     //OutputrichTextBox.Text = objstream.ReadToEnd();
  83.                 }
  84.                 File.WriteAllLines(OutputtextBox.Text, OutputrichTextBox.Lines);
  85.             }
  86.         }
  87.        
  88.         public void UpdateStatusBar(string status)
  89.         {
  90.             this.toolStripStatusLabel1.Text = status;
  91.             this.Refresh
  92.         }
  93.  
  94.         private void toolStripStatusLabel1_Click(object sender, EventArgs e)
  95.         {
  96.  
  97.         }
  98.        
  99.        
  100.  
  101.     }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement