C# opening a Form out of a TrayIcon -


i used snippet creating tray application 2 buttons (settings , exit):

using system; using system.windows.forms; using system.drawing; using windowsformsapplication1;  //***************************************************************************** abstract class notico { private static notifyicon notico;  //========================================================================== public static void main(string[] astrarg) {     contextmenu cm;     menuitem micurr;      cm = new contextmenu();      micurr = new menuitem();     micurr.index = 0;     micurr.text = "&settings";     micurr.click += new system.eventhandler(settingsclick);     cm.menuitems.add(micurr);      micurr = new menuitem();     micurr.index = 1;     micurr.text = "beenden";     micurr.click += new system.eventhandler(exitclick);     cm.menuitems.add(micurr);      notico = new notifyicon();     notico.icon = new icon("tanss.ico");     notico.text = "tanss busylight connector";     notico.visible = true;     notico.contextmenu = cm;     notico.doubleclick += new eventhandler(notifyicondoubleclick);      application.run();     }  //========================================================================== protected static void exitclick(object sender, eventargs e) {     notico.dispose();     application.exit(); }  //========================================================================== protected static void settingsclick(object sender, eventargs e) {      /// <summary>     /// der haupteinstiegspunkt für die anwendung.     /// </summary>      // should open "settings"-popup, containing 3 textboxes , button      save them xml.  }  //========================================================================== protected static void notifyicondoubleclick(object sender, eventargs e) {     // ... }  } 

now want open new form popup containing 3 textboxes write values in , button save them.

in background, never ending loop requesting url , parsing value out of json.

could me opening new form (its not made yet, need open first :/)

and embedd background loop-code?

thanks much!

it simple as

myform form1 = new myform(); form1.show(); 

you have create new form object , show on screen.

and, if want to, can set others properties

form1.location = new point(20, 20); form1.formborderstyle = system.windows.forms.formborderstyle.sizabletoolwindow; form1.maximizebox = true; form1.controlbox = true; ...... 

i think better (easier actually) create form designer , avoid creation of every textbox , code.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -