forked from XenHat/TrayReader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAddFeed.cs
69 lines (63 loc) · 1.85 KB
/
AddFeed.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
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
using System;
using System.Drawing;
using System.Windows.Forms;
namespace TrayApp
{
public partial class AddFeed : Form
{
private bool can_add;
private string currentURLInput;
public AddFeed()
{
InitializeComponent();
}
private void AddFeed_Load(object sender, EventArgs e)
{
}
private void FeedSubmitButton_Click(object sender, EventArgs e)
{
// Get value of field
if (!can_add)
{
return;
}
try
{
var potential_url = this.currentURLInput;
if (Helper.ValidateInput(potential_url))
{
TrayApp.Properties.Settings.Default.KnownGPUProcesses.Add(potential_url);
TrayApp.Properties.Settings.Default.Save();
MenuGenerator.ContextMenus.RegenerateMenu();
this.Close();
}
}
catch (Exception exception)
{
Program.ExceptionHandler(exception);
}
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
var text = textBox1.Text;
//if (text.Contains(".exe"))
//{
// text += ".exe";
//}
can_add = Helper.ValidateInput(text);
if (can_add)
{
textBox1.BackColor = Color.Empty;
can_add = true;
}
else
{
textBox1.BackColor = Color.Red;
can_add = false;
}
currentURLInput = text;
}
}
}