This repository has been archived by the owner on Oct 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
/
Settings.cs
75 lines (61 loc) · 2.63 KB
/
Settings.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace ValorantStreamOverlay
{
public partial class Settings : Form
{
public Settings()
{
InitializeComponent();
}
private void applyButton_Click(object sender, EventArgs e)
{
ApplySettings();
}
void ApplySettings()
{
// Save Overlay Settings
Properties.Settings.Default.username = usernameTextBox.Text;
Properties.Settings.Default.password = passwordTextBox.Text;
Properties.Settings.Default.region = regionDrop.SelectedIndex;
Properties.Settings.Default.skin = skinDrop.SelectedIndex;
Properties.Settings.Default.refresh = refreshDrop.SelectedIndex;
// Save Twitch bot settings
Properties.Settings.Default.twitchbotEnabled = twitchBotCheck.Checked;
Properties.Settings.Default.twitchBotToken = twitchBotToken.Text;
Properties.Settings.Default.twitchBotUsername = twitchbotUsername.Text;
Properties.Settings.Default.twitchChannel = twitchChannelname.Text;
Properties.Settings.Default.Save();
//After Setting user inputs to settings, ask user to reboot program :)
DialogResult dialogResult =
MessageBox.Show("Please reboot overlay, for new settings to apply.", "Reboot to apply", MessageBoxButtons.OK);
if (dialogResult == DialogResult.OK)
Environment.Exit(1);
else
Environment.Exit(1);
}
private void Settings_Load(object sender, EventArgs e)
{
//Overlay Loading
usernameTextBox.Text = Properties.Settings.Default.username;
passwordTextBox.Text = Properties.Settings.Default.password;
regionDrop.SelectedIndex = Properties.Settings.Default.region;
skinDrop.SelectedIndex = Properties.Settings.Default.skin;
refreshDrop.SelectedIndex = Properties.Settings.Default.refresh;
//Twitch Bot Loading
twitchChannelname.Text = Properties.Settings.Default.twitchChannel;
twitchBotToken.Text = Properties.Settings.Default.twitchBotToken;
twitchbotUsername.Text = Properties.Settings.Default.twitchBotUsername;
twitchBotCheck.Checked = Properties.Settings.Default.twitchbotEnabled;
}
private void cancelButton_Click(object sender, EventArgs e)
{
this.Close();
}
}
}