winforms - Execute a c# Windows Application exe on client machine everyday -


i've created c# windows application , installed , deployed on client machine using click once, i've execute exe on client machine everyday @ 5pm. i've idea of putting exe in startup folder, run on every machine restart or when user logoff , logon, there scenario, when user not logoff or restart machine several days.. tried creating windows service , thought of running windows form there , make windows service run everyday, later found calling gui (form) or making windows service interact user bad practice design , solution's perspective. researched interactive windows service, have not idea , cannot envision how can solution using that. solution appreciated. thanks! here application

static void main() {            byte[] filedata;  using (webclient client = new webclient())   {filedata = client.downloaddata("http://server.com/xyz.csv");}  using (filestream fs = new filestream(@"c:\temp\xyz.csv", filemode.openorcreate))    {      fs.write(filedata, 0, filedata.length);     }      using (textfieldparser parser = new textfieldparser(@"c:\temp\xyz.csv"))     {       parser.textfieldtype = fieldtype.delimited;       parser.setdelimiters(",");       while (!parser.endofdata)        {          //processing row          string[] machinelist = parser.readfields();          foreach (string machinename in machinelist)          {            //todo: process field            if (machinename == system.environment.machinename)            {                                      form1 f1 = new form1();             f1.minimizebox = false;             f1.maximizebox = false;             system.windows.forms.application.run(f1);                                  }           }          }        }  

this application downloading csv file server client machine , parsing match machine name, if found shows form1. if i've use windows task scheduler suggested, should use task service ?

taskservice ts = new taskservice(); taskdefinition td = ts.newtask(); td.triggers.add(new weeklytrigger(daysoftheweek.friday, 1)); td.triggers.add(new dailytrigger( weeklytrigger(daysoftheweek.friday, 1)); td.actions.add(new execaction("whatever.exe", null, null)); ts.rootfolder.registertaskdefinition("taskname", td); 

i understand task service used execute exe.. i'm not understanding how use taskservice within application call same application exe ?

pls suggest ?


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -