Exemple #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         string appPath =  Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase.Remove(0, 8));
         httpServer = new VsMediaProxyServer(int.Parse(textBox2.Text), textBox3.Text
             ,appPath);
         httpServer.Start();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        void vsWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            File.AppendAllText(Path.Combine(appPath, "MediaProxyServiceMsg.txt"), DateTime.Now.ToString() + "DoWork\r\n");
           // string appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase.Remove(0, 8));
            //File.AppendAllText("c:\\serviceMsg.txt", appPath + "appPath\r\n");


            try
            {
                string ProviderPath = Path.Combine(appPath, "Provider");
                httpServer = new VsMediaProxyServer(8080, "C:\\VsData"
                    , appPath, ProviderPath);

            }
            catch (Exception ex)
            {
                File.AppendAllText(Path.Combine(appPath, "MediaProxyServiceMsg.txt"), DateTime.Now.ToString() + ex.Message + "\r\n");
                return;
            }
            httpServer.Start();

            control = true;
          
            while (control)//(!vsWorker.CancellationPending && !bLoop)
            {
                // DateTime date = DateTime.Now;

                // if (date.Hour == vsHour && date.Minute >= vsMinute && date.Minute <= vsMinute + 1) bLoop = true;
               // File.AppendAllText("c:\\serviceMsg.txt", HttpServer.output + "output\r\n");
                Thread.Sleep(5000);
            }
           // File.AppendAllText("c:\\serviceMsg.txt", "out loop\r\n");
        }