-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form2.cs
97 lines (90 loc) · 3.96 KB
/
Form2.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using S_net_Viewer.Properties;
using System;
using System.Configuration;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
namespace S_net_Viewer
{
public partial class SettingForm : Form
{
public SettingForm()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
DisplayWidth.Value = Settings.Default.MainSize.Width;
DisplayHeight.Value = Settings.Default.MainSize.Height;
if (Settings.Default.MaxSize)
DisplayMax.Checked = true;
else
DisplayMax.Checked = false;
Delay.Value = Settings.Default.GetDelay;
if (Settings.Default.ViewTime)
DisplayTime.Checked = true;
else
DisplayTime.Checked = false;
Color_Back.BackColor = Settings.Default.BackColor;
Color_Fore.BackColor = Settings.Default.ForeColor;
ReplaceColor.Checked = Settings.Default.ReplaceColor;
ReplaceColors.Text = Settings.Default.ReplaceColors;
URLbox.Text = Settings.Default.URL;
}
private void Save_Click(object sender, EventArgs e)
{
Settings.Default.MainSize = new Size((int)DisplayWidth.Value, (int)DisplayHeight.Value);
if (DisplayMax.Checked)
Settings.Default.MaxSize = true;
else
Settings.Default.MaxSize = false;
Settings.Default.GetDelay = (int)Delay.Value;
if (DisplayTime.Checked)
Settings.Default.ViewTime = true;
else
Settings.Default.ViewTime = false;
Settings.Default.BackColor = Color_Back.BackColor;
Settings.Default.ForeColor = Color_Fore.BackColor;
Settings.Default.ReplaceColor = ReplaceColor.Checked;
Settings.Default.ReplaceColors = ReplaceColors.Text;
Settings.Default.URL = URLbox.Text;
Settings.Default.Save();
Configuration Config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
File.Copy(Config.FilePath, "setting.xml", true);
MessageBox.Show("設定を保存しました。", "お知らせ", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void BackColorChange_Click(object sender, EventArgs e)
{
DialogResult Color = ColorDialog.ShowDialog();
if (Color == DialogResult.OK)
Color_Back.BackColor = ColorDialog.Color;
}
private void ForeColorChange_Click(object sender, EventArgs e)
{
DialogResult Color = ColorDialog.ShowDialog();
if (Color == DialogResult.OK)
Color_Fore.BackColor = ColorDialog.Color;
}
private void UmiSiru_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start("https://www.msil.go.jp/msil/htm/main.html?Lang=0");
}
private void Reset_Click(object sender, EventArgs e)
{
DialogResult Result = MessageBox.Show("リセットしてもよろしいですか?\nリセットすると設定画面を開き直します。", "確認", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
if (Result == DialogResult.Yes)
{
Settings.Default.Reset();
SettingForm Setting = new SettingForm();
Configuration Config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
if (File.Exists("setting.xml"))
File.Delete("setting.xml");
if (File.Exists(Config.FilePath))
File.Delete(Config.FilePath);
Setting.Show();
Close();
}
}
}
}