kindlebox/Kindlebox/CreateRabbitry.cs

77 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Kindlebox
{
public partial class CreateRabbitry : Form
{
public CreateRabbitry()
{
InitializeComponent();
}
private void CreateRabbitry_Load(object sender, EventArgs e)
{
}
private void btnSave_Click(object sender, EventArgs e)
{
Properties.Settings.Default.FarmName = tbFarmName.Text;
Properties.Settings.Default.FarmStreet = tbFarmAddress.Text;
Properties.Settings.Default.FarmCity = tbFarmCity.Text;
Properties.Settings.Default.FarmState = cbFarmState.Text;
Properties.Settings.Default.FarmZIP = tbFarmZIP.Text;
Properties.Settings.Default.FarmPhone = tbFarmPhone.Text;
Properties.Settings.Default.FarmEmail = tbFarmEmail.Text;
Properties.Settings.Default.FarmWWW = tbFarmWWW.Text;
var path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
string directory = Path.Combine(path, "Kindlebox");
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
string file = Path.Combine(directory, "rabbits.json");
if (!File.Exists(file))
{
File.Create(file);
}
file = Path.Combine(directory, "litters.json");
if (!File.Exists(file))
{
File.Create(file);
}
file = Path.Combine(directory, "breedings.json");
if (!File.Exists(file))
{
File.Create(file);
}
Properties.Settings.Default.RabbitFile = directory + "\\rabbits.json";
Properties.Settings.Default.LitterFile = directory + "\\litters.json";
Properties.Settings.Default.BreedingFile = directory + "\\breedings.json";
Properties.Settings.Default.Save();
this.Hide();
Launch launch = new Launch();
launch.Show();
}
}
}