-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettingsForm.cs
More file actions
65 lines (59 loc) · 2.36 KB
/
SettingsForm.cs
File metadata and controls
65 lines (59 loc) · 2.36 KB
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
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DesktopWeather
{
public partial class SettingsForm : Form
{
private weatherForm myParent;
private string optWeatherURL;
private string optNatlMapURL;
private string optForecastPage;
private string weatherURLdef = "https://forecast.weather.gov/data/obhistory/KVNY.html";
private string natlMapURLdef = "https://www.wpc.ncep.noaa.gov/sfc/usfntsfcwbg.gif";
private string forecastPagedef = "https://forecast.weather.gov/MapClick.php?x=264&y=129&site=lox&zmx=&zmy=&map_x=264&map_y=129";
public SettingsForm(DesktopWeather.weatherForm Parent)
{
myParent = Parent;
InitializeComponent();
getParentSettings();
}
private void getParentSettings()
{
optWeatherURL = myParent.weatherURL;
optNatlMapURL = myParent.natlMapURL;
optForecastPage = myParent.forecastPage;
tbGaugeSource.Text = optWeatherURL;
tbNationalMap.Text = optNatlMapURL;
tbForecastSource.Text = optForecastPage;
this.Refresh();
}
private void btnOK_Click(object sender, EventArgs e)
{
RegistryKey ThisUser = Registry.CurrentUser;
RegistryKey weatherURL = ThisUser.CreateSubKey("Software\\DesktopWeather\\weatherURL");
weatherURL.SetValue("URLText", tbGaugeSource.Text);
RegistryKey natlMapURL = ThisUser.CreateSubKey("Software\\DesktopWeather\\natlMapURL");
natlMapURL.SetValue("URLText", tbNationalMap.Text);
RegistryKey forecastPage = ThisUser.CreateSubKey("Software\\DesktopWeather\\forecastPage");
forecastPage.SetValue("URLText", tbForecastSource.Text);
myParent.restartProgramFlag = true;
myParent.tmrStartup.Enabled = true;
this.Close();
}
private void btnReset_Click(object sender, EventArgs e)
{
tbGaugeSource.Text = weatherURLdef;
tbNationalMap.Text = natlMapURLdef;
tbForecastSource.Text = forecastPagedef;
}
}
}