I have created a GUI in Visual Studio where I have two buttons. One button is used to show ip and second button is used to take that ip and run python script.
But I want to merge these both operations into only one button, that if clicked for the first time should show/take the ip, and when clicked a 2nd time, it should trigger the Python script and all that in single button click.
My code is:
private void button1_Click(object sender, EventArgs e)
{
var fileName = "C:\\test.txt";
var sr = new StreamReader(fileName);
string fileContent = sr.ReadToEnd();
var startBlock = "hello";
var endBlock = "exit";
var ip = ParseForIpRegex(fileContent, startBlock, endBlock);
myTextBox.Text = ip; //Change this to match your code
}
private readonly string IPV4_PATTERN = "[0-9.]";
private string ParseForIpRegex(string textToSearch, string startBlock, string endBlock)
{
var pattern = $#"{startBlock}\D*\s*({IPV4_PATTERN}+).*{endBlock}";
var ms = Regex.Match(textToSearch, pattern, RegexOptions.Singleline | RegexOptions.IgnoreCase);
if (ms.Groups.Count > 0)
{
return ms.Groups[1].Value;
}
return string.Empty;
}
private void button1_Click_1(object sender, EventArgs e)
{
var hostname = myTextBox.Text;
var username = textBox1.Text;
var password = textBox2.Text;
var psi = new ProcessStartInfo();
psi.FileName = #"C:\Python38\python.exe";
var script = #"C:pythonscript.py";
//var config_file = file_path;
psi.Arguments = $"{script} {hostname} {username} {password}";
psi.UseShellExecute = false;
psi.CreateNoWindow = true;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
var errors = "";
var results = "";
MessageBox.Show("script processing");
using (var process = Process.Start(psi))
{
errors = process.StandardError.ReadToEnd();
results = process.StandardOutput.ReadToEnd();
}
Console.WriteLine("ERRORS:");
Console.WriteLine(errors);
Console.WriteLine();
Console.WriteLine("Results:");
Console.WriteLine(results);
if (errors != "")
{
MessageBox.Show(errors);
}
else
{
MessageBox.Show(results);
}
}
Please let me know how I can merge this both operation into one. That in one click 1st button operation will perform and after that 2nd in single click.
I suppose you need to keep all buttons, so you dont use args, just call the method:
private void button1_Click(object sender, EventArgs e)
{
//DO job
// simulate the second click
button1_Click_1(sender, e)
}
private void button1_Click_1(object sender, EventArgs e)
{
//you could test args to check if its coming from first button
}
The answer of Frenchy, or you can add 2 handers on the event...
depending your preference.
this.button1.Click += new System.EventHandler(this.button1_Click);
this.button1.Click += new System.EventHandler(this.button1_Click_1);
take note that one of the two the designer will add it for you.
So add the second at form_load event (or where u see fit)
Cheers
Related
Server 1 Server2 Server Config Screen
I am trying to make a video game server manager and I have run into an issue. I want the user to be able to have as many servers as they would like. However I cannot figure out through google searching and just regular messing around how to store the information that the user selects to become associated with the Server they create in the list. Basically when you make Server1 it takes the info you selected from the boxes on the config screen and uses them on the server selection page. But, when you make Server2, the configuration overwrites Server1's configuration. I know my code isn't even setup to be able to do this but I would appreciate a push in the right direction as to which type of code I should use.
Tl:dr I want config options to be associated with ServerX in the server list and each server should have unique settings.
public partial class Form1 : Form
{
//Variables
string srvName;
string mapSelect;
string difSelect;
public Form1()
{
InitializeComponent();
this.srvList.SelectedIndexChanged += new System.EventHandler(this.srvList_SelectedIndexChanged);
}
private void srvList_SelectedIndexChanged(object sender, EventArgs e)
{
if(srvList.SelectedIndex == -1)
{
dltButton.Visible = false;
}
else
{
dltButton.Visible = true;
}
//Text being displayed to the left of the server listbox
mapLabel1.Text = mapSelect;
difLabel1.Text = difSelect;
}
private void crtButton_Click(object sender, EventArgs e)
{
//Add srvName to srvList
srvName = namBox1.Text;
srvList.Items.Add(srvName);
//Selections
mapSelect = mapBox1.Text;
difSelect = difBox1.Text;
//Write to config file
string[] lines = { mapSelect, difSelect };
System.IO.File.WriteAllLines(#"C:\Users\mlynch\Desktop\Test\Test.txt", lines);
//Clear newPanel form
namBox1.Text = String.Empty;
mapBox1.SelectedIndex = -1;
difBox1.SelectedIndex = -1;
//Return to srvList
newPanel.Visible = false;
}
}
You mentioned in a recent comment that you had tried saving to a .txt file but it overwrote it anytime you tried to make an additional one. If you wanted to continue with your .txt approach, you could simply set a global integer variable and append it to each file you save.
//Variables
string srvName;
string mapSelect;
string difSelect;
int serverNumber = 0;
...
serverNumber++;
string filepath = Path.Combine(#"C:\Users\mlynch\Desktop\Test\Test", serverNumber.ToString(), ".txt");
System.IO.File.WriteAllLines(filepath, lines);
I think below source code will give you some idea about the direction. Let us start with some initializations:
public Form1()
{
InitializeComponent();
this.srvList.SelectedIndexChanged += new System.EventHandler(this.srvList_SelectedIndexChanged);
mapBox1.Items.Add("Germany");
mapBox1.Items.Add("Russia");
difBox1.Items.Add("Easy");
difBox1.Items.Add("Difficult");
}
This is the event handler of the "Create Server" button. It takes server parameters from the screen and writes to a file named as the server.
private void crtButton_Click(object sender, EventArgs e)
{
//Add srvName to srvList
srvName = namBox1.Text;
srvList.Items.Add(srvName);
//Selections
mapSelect = mapBox1.Text;
difSelect = difBox1.Text;
//Write to config file
string path = #"C:\Test\" + srvName + ".txt";
StreamWriter sw = new StreamWriter(path);
sw.WriteLine(mapSelect);
sw.WriteLine(difSelect);
sw.Flush();
sw.Close();
//Clear newPanel form
namBox1.Text = String.Empty;
mapBox1.SelectedIndex = -1;
difBox1.SelectedIndex = -1;
//Return to srvList
//newPanel.Visible = false;
}
And finally list box event handler is below. Method reads the server parameters from file and displays on the screen.
private void srvList_SelectedIndexChanged(object sender, EventArgs e)
{
if (srvList.SelectedIndex == -1)
{
dltButton.Visible = false;
}
else
{
dltButton.Visible = true;
}
string path = #"C:\Test\" + srvList.SelectedItem + ".txt";
StreamReader sr = new StreamReader(path);
//Text being displayed to the left of the server listbox
mapLabel1.Text = sr.ReadLine(); // mapSelect;
difLabel1.Text = sr.ReadLine(); // difSelect;
}
Please feel free to ask any questions you have.
I ended up figuring out the issue. Basically I ended up deciding on a write to a txt file and then read from it to display the contents of the file in the server select menu. I also added a delete button so you can delete the servers that you created. it does not have full functionality yet but it is there. So here it what I ended up with and it works perfectly. Thank you all for trying to help.
public partial class Form1 : Form
{
//Variables
string srvName;
string mapSelect;
string mapFile;
string difSelect;
string difFile;
int maxPlayers;
string plrSelect;
string plrFile;
string finalFile;
string basepath = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
string fileName = "config.txt";
public Form1()
{
InitializeComponent();
this.srvList.SelectedIndexChanged += new System.EventHandler(this.srvList_SelectedIndexChanged);
}
private void srvList_SelectedIndexChanged(object sender, EventArgs e)
{
//Read Server Selection
string srvSelect = srvList.GetItemText(srvList.SelectedItem);
string srvOut = System.IO.Path.Combine(basepath, srvSelect, fileName);
mapFile = File.ReadLines(srvOut).Skip(1).Take(1).First();
difFile = File.ReadLines(srvOut).Skip(2).Take(1).First();
plrFile = File.ReadLines(srvOut).Skip(3).Take(1).First();
//Display Server Selection
if (srvList.SelectedIndex == -1)
{
dltButton.Visible = false;
}
else
{
dltButton.Visible = true;
mapLabel1.Text = mapFile;
difLabel1.Text = difFile;
plrLabel1.Text = plrFile;
}
private void crtButton_Click(object sender, EventArgs e)
{
//Set Server Name
srvName = namBox1.Text;
string finalpath = System.IO.Path.Combine(basepath, srvName);
//Check if server name is taken
if (System.IO.Directory.Exists(finalpath))
{
MessageBox.Show("A Server by this name already exists");
}
else
{
//Add Server to the Server List
srvList.Items.Add(srvName);
//Server Configuration
mapSelect = mapBox1.Text;
difSelect = difBox1.Text;
maxPlayers = maxBar1.Value * 2;
plrSelect = "" + maxPlayers;
//Clear New Server Form
namBox1.Text = String.Empty;
mapBox1.SelectedIndex = -1;
difBox1.SelectedIndex = -1;
//Create the Server File
Directory.CreateDirectory(finalpath);
finalFile = System.IO.Path.Combine(finalpath, fileName);
File.Create(finalFile).Close();
//Write to config file
string[] lines = { srvName, mapSelect, difSelect, plrSelect };
System.IO.File.WriteAllLines(#finalFile, lines);
//Return to srvList
newPanel.Visible = false;
}
}
}
How can I dynamically change the contents of what will be pasted in the TextBox.
Here is how I subscribe to the event:
DataObject.AddPastingHandler (uiTextBox, TextBoxPaste);
Here is how I define the event handler:
private void TextBoxPaste (object sender, DataObjectPastingEventArgs args)
{
string clipboard = args.DataObject.GetData (typeof (string)) as string;
Regex nonNumeric = new System.Text.RegularExpressions.Regex (#"\D");
string result = nonNumeric.Replace (clipboard, String.Empty);
// I can't just do "args.DataObject.SetData (result)" here.
}
You cannot call args.DataObject.SetData("some data") since the DataObject is frozen. What you can do is replace the DataObject altogether:
private void TextBoxPaste(object sender, DataObjectPastingEventArgs e) {
string text = (String)e.DataObject.GetData(typeof(String));
DataObject d = new DataObject();
d.SetData(DataFormats.Text, text.Replace(Environment.NewLine, " "));
e.DataObject = d;
}
I can think of two ways, none of which are very attractive :) And both ways include canceling the paste command.
The first way would be to cancel the paste command and then calculate what the text would look like after the paste if result was pasted instead.
private void TextBoxPaste(object sender, DataObjectPastingEventArgs args)
{
string clipboard = args.DataObject.GetData(typeof(string)) as string;
Regex nonNumeric = new System.Text.RegularExpressions.Regex(#"\D");
string result = nonNumeric.Replace(clipboard, String.Empty);
int start = uiTextBox.SelectionStart;
int length = uiTextBox.SelectionLength;
int caret = uiTextBox.CaretIndex;
string text = uiTextBox.Text.Substring(0, start);
text += uiTextBox.Text.Substring(start + length);
string newText = text.Substring(0, uiTextBox.CaretIndex) + result;
newText += text.Substring(caret);
uiTextBox.Text = newText;
uiTextBox.CaretIndex = caret + result.Length;
args.CancelCommand();
}
The other way would be to cancel the paste command, change the text in the Clipboard and then re-execute paste. This would also require you to differ between the real paste command and the manually invoked paste command. Something like this
bool m_modifiedPaste = false;
private void TextBoxPaste(object sender, DataObjectPastingEventArgs args)
{
if (m_modifiedPaste == false)
{
m_modifiedPaste = true;
string clipboard = args.DataObject.GetData(typeof(string)) as string;
Regex nonNumeric = new System.Text.RegularExpressions.Regex(#"\D");
string result = nonNumeric.Replace(clipboard, String.Empty);
args.CancelCommand();
Clipboard.SetData(DataFormats.Text, result);
ApplicationCommands.Paste.Execute(result, uiTextBox);
}
else
{
m_modifiedPaste = false;
}
}
I use VB.net quite a bit, I've tested this C# bit, I used a converter because I'm lame :)
string oClipboard;
private void TextBox1_GotFocus(object sender, System.EventArgs e)
{
oClipboard = Clipboard.GetText();
Clipboard.SetText("foo");
}
private void TextBox1_LostFocus(object sender, System.EventArgs e)
{
Clipboard.SetText(oClipboard);
}
I set the clipboard to the new text when the control gets focus. It stores the old value. Later, when the control loses focus, the clipboard is set back to the old value.
Just some modifications of #Fredrik's code, since I've been trying out both of his methods.
First one is just a shortened version
private void TextBox_Pasting(object sender, DataObjectPastingEventArgs e)
{
string clipboard = e.DataObject.GetData(typeof(string)) as string;
Regex nonNumeric = new System.Text.RegularExpressions.Regex (#"\D");
string result = nonNumeric.Replace(clipboard, string.Empty);
int caret = CaretIndex;
Text = Text.Substring(0, SelectionStart) + result +
Text.Substring(SelectionStart + SelectionLength);
CaretIndex = caret + result.Length;
e.CancelCommand();
}
and the other one is updated with keeping the clipboard content
private string oldClipboardContent { get; set; } = "";
private bool pasteModified { get; set; } = false;
private void TextBox_Pasting(object sender, DataObjectPastingEventArgs e)
{
if (pasteModified)
{
pasteModified = false;
}
else
{
pasteModified = true;
string text = (string)e.DataObject.GetData(typeof(string));
oldClipboardContent = text;
Regex nonNumeric = new System.Text.RegularExpressions.Regex (#"\D");
text = nonNumeric.Replace(text, string.Empty);
e.CancelCommand();
Clipboard.SetData(DataFormats.Text, text);
ApplicationCommands.Paste.Execute(text, this);
Clipboard.SetData(DataFormats.Text, OldClipboardContent);
oldClipboardContent = "";
}
}
I was using those inside my custom TextBox control, that is why I could access TextBox properties without writing the name first.
Today when I type something any text in textBox1 and then click the start button it will search inside files for the text i typed in textBox1.
Now I want to add something somehow that if the user type in the textBox1 for example: hello,hi it will search for hello and also for hi in the files. Not as one string/text but two separated. If I type: hello,hi,world now it will search in same time same files also for hello hi and world.
The textchanged event
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (textBox1.Text != "" && textBox3.Text != "" && Directory.Exists(textBox3.Text))
{
startButton.Enabled = true;
Properties.Settings.Default["Setting2"] = textBox1.Text;
Properties.Settings.Default.Save();
}
else
{
startButton.Enabled = false;
}
}
The start button click event
private void startButton_Click(object sender, EventArgs e)
{
label21.Visible = true;
startButton.Enabled = false;
stopButton.Enabled = true;
pauseresumeButton.Enabled = true;
timer1.Start();
if (!backgroundWorker1.IsBusy)
{
SetWorkerMode(true);
backgroundWorker1.RunWorkerAsync();
}
}
Dowork event
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
BackgroundWorker worker = sender as BackgroundWorker;
_stopwatch.Restart();
DirSearch(textBox3.Text, textBox2.Text, textBox1.Text, worker, e);
_stopwatch.Stop();
}
The DirSearch method where I search for the text in files.
void DirSearch(string rootDirectory, string filesExtension, string textToSearch, BackgroundWorker worker, DoWorkEventArgs e)
{
List<string> filePathList = new List<string>();
List<string> restrictedFiles = new List<string>();
int overallfiles = 0;
int numberoffiles = 0;
int numberofdirs = 0;
try
{
filePathList = SearchAccessibleFilesNoDistinct(rootDirectory, null).ToList();
}
catch (Exception err)
{
string ad = err.ToString();
}
foreach (string file in filePathList)
{
try
{
_busy.WaitOne();
if (worker.CancellationPending == true)
{
e.Cancel = true;
return;
}
List<MyProgress> prog = new List<MyProgress>();
int var = File.ReadAllText(file).Contains(textToSearch) ? 1 : 0;
overallfiles++;
if (var == 1)
{
numberoffiles++;
prog.Add(new MyProgress { Report1 = file, Report2 = numberoffiles.ToString() });
backgroundWorker1.ReportProgress(0, prog);
}
numberofdirs++;
label1.Invoke((MethodInvoker)delegate
{
label1.Text = numberofdirs.ToString();
label1.Visible = true;
});
}
catch (Exception)
{
restrictedFiles.Add(file);
continue;
}
}
}
In DirSearch the variable textToSearch contains the text I typed in textBox1.
If I typed in textBox1 only HI so like it is now it will search in each file for the existing of HI.
But if I type HI,HELLO,WORLD
Now I want it to search for existing in each file of HI HELLO WORLD not as one text string but each word on it's own existing.
If I type Hi HELLO WORLD then it will search it as one string/text but once the user put , between it should search each word/text.
You can split the input in the textbox based on space, comma's or any other separator and then pass these as individual inputs to your search method, hope this helps
I'm trying to make a monitoring page to monitor various filesystem watcher running to do some job. What I need to know is how do you get multiple filesystem watcher's to access the list boxes in the UI thread.. Here is some code:
private void WatchFile(TextBox ctrlTB,ListBox ctrlLB,FileSystemWatcher _watcher)
{
// FileSystemWatcher _watcher = new FileSystemWatcher();
//var localTB = ctrlTB as TextBox;
//var localLB = ctrlLB as ListBox;
_watcher.Path = ctrlTB.Text;
_watcher.Path = ctrlTB.Text;
_watcher.NotifyFilter = NotifyFilters.LastWrite;
_watcher.Filter = "*.xml";
_watcher.Changed += new FileSystemEventHandler(convertXML);
// _watcher.Changed += (s, e) => convertXML(s,e);
// _watcher.Error += new ErrorEventHandler(WatcherError);
_watcher.EnableRaisingEvents = true;
_watcher.IncludeSubdirectories = false;
ctrlLB.Items.Add("Started Monitoring # " + ctrlTB.Text);
ctrlLB.SelectedIndex = ctrlLB.Items.Count - 1;
}
public void convertXML(object source, FileSystemEventArgs f)
{
/// some job
}
I need to post back the status for each filesystemwatcher back to it's respective listbox. I'm declaring the FSW's at the click of the start button. Every List box has a start button where it would be declared separately. An e.g.:
private void button9_Click(object sender, EventArgs e)
{
if (!Directory.Exists(this.textBox1.Text))
{
//Form2.ActiveForm.Text = "Please select Source Folder";
// popup.Show("Please Select Source Folder");
MessageBox.Show("Please Select Proper Source Folder");
return;
}
else
{
textBox1.Enabled = false;
button9.Enabled = false;
button1.Enabled = false;
// button4.Enabled = false;
FileSystemWatcher _watcher = new FileSystemWatcher();
_watcher.SynchronizingObject = this;
WatchFile(textBox1,listBox1 ,_watcher);
}
}
How does the thread know which contrl listbox to access.
Encapsulate your WatchFile and convertXml into its own class like so
public class MyFileWatcher {
private TextBox _textBox;
private ListBox _listBox;
FileSystemWatcher _watcher;
public MyFileWatcher(TextBox textBox, ListBox listBox, ISynchronizeInvoke syncObj) {
this._textBox = textBox;
this._listBox = listBox;
this._watcher = new FileSystemWatcher();
this._watcher.SynchronizingObject = syncObj;
this._watcher.Path = textBox.Text;
this._watcher.Changed += new FileSystemEventHandler(convertXML);
this._watcher.EnableRaisingEvents = true;
this._watcher.IncludeSubdirectories = false;
// add any other required initialization of the FileSystemWatcher here.
}
protected virtual void convertXML(object source, FileSystemEventArgs f) {
// interact with this._textBox and this._listBox here as required.
// e.g.
// this._listBox.Items.Add(f.FullPath);
}
}
This way you can tie the FileSystemWatcher instance to a particular TextBox and ListBox, or any other object you desire.
Then to replace your button9_Click method:
private void button9_Click(object sender, EventArgs e)
{
if (!Directory.Exists(this.textBox1.Text))
{
//Form2.ActiveForm.Text = "Please select Source Folder";
// popup.Show("Please Select Source Folder");
MessageBox.Show("Please Select Proper Source Folder");
return;
}
else
{
textBox1.Enabled = false;
button9.Enabled = false;
button1.Enabled = false;
// instantiate your new instance of your MyFileWatcher class.
MyFileWatcher myWatcher = new MyFileWatcher(textBox1,listBox1 ,this);
}
}
Note: I have not actually compiled or executed this code so there may be exceptions. But the overall pattern should solve what you're after.
I have some code that uses a custom popupNotifier that subscribes to a click event like so:
popupNotifier1.Click += new EventHandler(PopUpClicked);
That means when someone clicks open the popup it launches a url string. Assume _url is global for the time being.
I do this in PopUpClicked:
public void PopUpClicked(object sender, EventArgs e)
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(_url);
proc.StartInfo = startInfo;
proc.Start();
}
The url, _url contains a string like:
http://mysite/mypage.aspx?MyID=100
This works all fine..it opens the page but I noticed it will open up multiple tabs of the same page.
I cant understand why?
edit
Just to add more code I call this from a timer event that hits every minute, but notice the if condition, it only subscribes to the event if there is data:
private void timer1_Tick(object sender, EventArgs e)
{
SqlDataReader sr;
string ticketInfo = String.Empty;
string url = String.Empty;
bool hasData = false;
using (SqlConnection sc = new SqlConnection(_connString))
{
using (SqlCommand scmd = new SqlCommand("select_poll"))
{
scmd.Connection = sc;
scmd.CommandType = CommandType.StoredProcedure;
scmd.Parameters.Add("LoginID", SqlDbType.BigInt).Value = _userLoginID;
scmd.Parameters.Add("FacilityID", SqlDbType.BigInt).Value = _userFacilityID;
sc.Open();
sr = scmd.ExecuteReader(CommandBehavior.CloseConnection);
if (sr != null)
{
while (sr.Read())
{
hasData = true;
ticketInfo += sr["TicketID"].ToString() + " - " + sr["Ticket"].ToString() + Environment.NewLine;
_url = "http://mysite/mypage.aspx?ID=" + sr["TicketID"].ToString();
}
}
}
}
if (hasData)
{
popupNotifier1.TitleColor = System.Drawing.Color.Green;
popupNotifier1.ContentText = ticketInfo;
popupNotifier1.Scroll = true;
popupNotifier1.TitlePadding = new System.Windows.Forms.Padding(2);
popupNotifier1.ContentPadding = new System.Windows.Forms.Padding(2);
popupNotifier1.Image = Properties.Resources.medical;
popupNotifier1.ImagePadding = new System.Windows.Forms.Padding(10);
popupNotifier1.Click += new EventHandler(PopUpClicked);
popupNotifier1.Popup();
}
}
public void PopUpClicked(object sender, EventArgs e)
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(_url);
proc.StartInfo = startInfo;
proc.Start();
}
You're subscribing to the event multiple times. In this particular case, you're subscribing to the event any time a particular condition is met when your timer fires. It would appear that this happens more than once.
You almost certainly want to attach the event handler outside of the tick event, probably when the form is first loaded.
popupNotifier1.Click += new EventHandler(PopUpClicked);
the above lines subscribes to the event multiple times, so when first time, when PopUp is fires, it opens one tab, next time 2 tab, then next time three tab n so on
add handler only once, the best way will be, just before u enable the timer in your code
Like
popupNotifier1.Click += new EventHandler(PopUpClicked);
timer1.Enabled = true;
Fixed Code
private void timer1_Tick(object sender, EventArgs e)
{
SqlDataReader sr;
string ticketInfo = String.Empty;
string url = String.Empty;
bool hasData = false;
using (SqlConnection sc = new SqlConnection(_connString))
{
using (SqlCommand scmd = new SqlCommand("select_poll"))
{
scmd.Connection = sc;
scmd.CommandType = CommandType.StoredProcedure;
scmd.Parameters.Add("LoginID", SqlDbType.BigInt).Value = _userLoginID;
scmd.Parameters.Add("FacilityID", SqlDbType.BigInt).Value = _userFacilityID;
sc.Open();
sr = scmd.ExecuteReader(CommandBehavior.CloseConnection);
if (sr != null)
{
while (sr.Read())
{
hasData = true;
ticketInfo += sr["TicketID"].ToString() + " - " + sr["Ticket"].ToString() + Environment.NewLine;
_url = "http://mysite/mypage.aspx?ID=" + sr["TicketID"].ToString();
}
}
}
}
if (hasData)
{
popupNotifier1.TitleColor = System.Drawing.Color.Green;
popupNotifier1.ContentText = ticketInfo;
popupNotifier1.Scroll = true;
popupNotifier1.TitlePadding = new System.Windows.Forms.Padding(2);
popupNotifier1.ContentPadding = new System.Windows.Forms.Padding(2);
popupNotifier1.Image = Properties.Resources.medical;
popupNotifier1.ImagePadding = new System.Windows.Forms.Padding(10);
popupNotifier1.Popup();
}
}
public void PopUpClicked(object sender, EventArgs e)
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(_url);
proc.StartInfo = startInfo;
proc.Start();
}