Generated files saves and registers
This commit is contained in:
69
CobXmlSupport/SaveRegCopyFile.cs
Normal file
69
CobXmlSupport/SaveRegCopyFile.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CobXmlSupport
|
||||
{
|
||||
public partial class SaveRegCopyFile : Form
|
||||
{
|
||||
public savedFile SavedFile { get; set; }
|
||||
public string FileData { get; set; }
|
||||
|
||||
public SaveRegCopyFile()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnChooseFnameAndPlace_Click(object sender, EventArgs e)
|
||||
{
|
||||
saveFileDialog.Title = "Välj plats för den aktuella filen !";
|
||||
saveFileDialog.Filter = "Copy files (*.cpy)|*.cpy|Text Files (*.txt)|*.txt|All files (*.*)|*.*";
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
SavedFile.fNameSaved = txtFileName.Text = saveFileDialog.FileName.Substring(saveFileDialog.FileName.LastIndexOf("\\") + 1); ;
|
||||
SavedFile.directorySaved = txtChosenDirectory.Text = saveFileDialog.FileName.Substring(0, saveFileDialog.FileName.LastIndexOf("\\"));
|
||||
if (SavedFile.idConnect.Length > 0)
|
||||
{
|
||||
btnSave.Enabled = true;
|
||||
}
|
||||
else MessageBox.Show("idConnect för filtypen saknas !");
|
||||
}
|
||||
}
|
||||
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.WriteAllText(saveFileDialog.FileName, FileData);
|
||||
savedFile tmpSF = new savedFile();
|
||||
tmpSF = (savedFile)SavedFile.Clone();
|
||||
S.ettingListAdd(tmpSF);
|
||||
this.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Problem att spara :\r\n" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void SaveRegCopyFile_Load(object sender, EventArgs e)
|
||||
{
|
||||
txtUsageName.Text = SavedFile.usageName;
|
||||
txtChosenDirectory.Text = "";
|
||||
txtFileName.Text = "";
|
||||
btnSave.Enabled = false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user