Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.IO;
- namespace Exo_Windows_Backup
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- public NotifyIcon ni = new NotifyIcon();
- private void button2_Click(object sender, EventArgs e)
- {
- folderBrowserDialog1.ShowDialog();
- textBox1.Text = folderBrowserDialog1.SelectedPath;
- }
- private void quitProgramToolStripMenuItem_Click(object sender, EventArgs e)
- {
- Application.Exit();
- }
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- string startupvar = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
- if (checkBox1.Checked == true)
- {
- //File.Create((Environment.SpecialFolder.ApplicationData + (@"\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" + "\\Exo Windows Backup Autostart.url")));
- Properties.Settings.Default.autostart = true;
- Properties.Settings.Default.Save();
- CreateShortcut(startupvar + (@"\Microsoft\Windows\Start Menu\Programs\Startup" + @"\Exo Windows Backup Autostart.url"), Application.ExecutablePath.ToString());
- }
- else
- {
- Properties.Settings.Default.autostart = false;
- Properties.Settings.Default.Save();
- if (File.Exists(startupvar + (@"\Microsoft\Windows\Start Menu\Programs\Startup" + @"\Exo Windows Backup Autostart.url")))
- {
- File.Delete(startupvar + (@"\Microsoft\Windows\Start Menu\Programs\Startup" + @"\Exo Windows Backup Autostart.url"));
- }
- }
- }
- private void checkBox2_CheckedChanged(object sender, EventArgs e)
- {
- if (checkBox2.Checked == true)
- {
- Properties.Settings.Default.welcomeform = true;
- Properties.Settings.Default.Save();
- }
- else
- {
- Properties.Settings.Default.welcomeform = false;
- Properties.Settings.Default.Save();
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- }
- private void button4_Click(object sender, EventArgs e)
- {
- if (checkBox3.Checked == true)
- {
- Properties.Settings.Default.backuptime = 15;
- Properties.Settings.Default.Save();
- }
- }
- private void button3_Click(object sender, EventArgs e)
- {
- if (radioButton1.Checked == true)
- {
- Properties.Settings.Default.language = "english";
- Properties.Settings.Default.Save();
- MessageBox.Show("A Restart is required. Restart Now!");
- Application.Restart();
- }
- else if (radioButton2.Checked == true)
- {
- Properties.Settings.Default.language = "german";
- Properties.Settings.Default.Save();
- MessageBox.Show("Ein neustart wird benötigt. Starte jetzt neu!");
- Application.Restart();
- }
- }
- private void CreateShortcut(string shortcutPath, string shortcutDest)
- {
- StreamWriter sw = new StreamWriter(shortcutPath);
- sw.WriteLine("[InternetShortcut]");
- sw.WriteLine("URL=file:///" + shortcutDest);
- sw.WriteLine("IconIndex=0");
- sw.Close();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- if (Properties.Settings.Default.autofirststart == true)
- {
- this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
- }
- if (Properties.Settings.Default.autostart == true)
- {
- radioButton1.Checked = true;
- }
- }
- private void Form1_Resize(object sender, EventArgs e)
- {
- if (FormWindowState.Minimized == this.WindowState)
- {
- ni.Visible = true;
- ni.ShowBalloonTip(500);
- this.Hide();
- }
- else if (FormWindowState.Normal == this.WindowState)
- {
- ni.Visible = false;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement