private void btnOk_Click_1(object sender, EventArgs e) { if (!File.Exists("C:/program files/playdar/playdar.exe")) { MessageBox.Show("The Playdar executable could not be found. "+ Environment.NewLine + "I am currently looking in: "+ Environment.NewLine + @"C:\Program Files\Playdar\playdar.exe"+ Environment.NewLine + Environment.NewLine + "Please ensure the executable is there.","Playdar Critical Error",MessageBoxButtons.OK,MessageBoxIcon.Stop); Close(); } this.Cursor = Cursors.AppStarting; this.btnOk.Enabled = false; processCaller = new ProcessCaller(this); processCaller.WorkingDirectory = "C:/program files/playdar/"; processCaller.FileName = @"C:/program files/playdar/playdar.exe"; processCaller.Arguments = "-c playdar.ini --app.name \"" + WindowsIdentity.GetCurrent().Name + "\" "; processCaller.StdErrReceived += new DataReceivedHandler(writeStreamInfo); processCaller.StdOutReceived += new DataReceivedHandler(writeStreamInfo); processCaller.Completed += new EventHandler(processCompletedOrCanceled); processCaller.Cancelled += new EventHandler(processCompletedOrCanceled); // processCaller.Failed += no event handler for this one, yet. this.richTextBox1.Text = "Starting Playdar..." + Environment.NewLine; notifyIcon1.ShowBalloonTip(5000, "Playdar Start", "Playdar Server is now running and ready to serve search requests.", ToolTipIcon.Info); this.Hide(); // the following function starts a process and returns immediately, // thus allowing the form to stay responsive. this.Cursor = Cursors.Default; Uptime = 0; tmrUptime.Enabled = true; processCaller.Start(); }
private void StartScan() { folderBrowserDialog1.ShowDialog(); processCaller = new ProcessCaller(this); processCaller.WorkingDirectory = "C:/program files/playdar/"; processCaller.FileName = @"C:/program files/playdar/scanner.exe"; processCaller.Arguments = "collection.db \"" + folderBrowserDialog1.SelectedPath + "\""; processCaller.StdErrReceived += new DataReceivedHandler(writeStreamInfo); processCaller.StdOutReceived += new DataReceivedHandler(writeStreamInfo); processCaller.Completed += new EventHandler(processCompletedOrCanceled); processCaller.Cancelled += new EventHandler(processCompletedOrCanceled); // processCaller.Failed += no event handler for this one, yet. this.richTextBox1.Text = "Start scanning process in folder " + folderBrowserDialog1.SelectedPath + Environment.NewLine; frmMain.notifyIcon1.ShowBalloonTip(5000, "Playdar Scanner", "The Playdar Scanner is now adding your mp3 files the Playdar library.", ToolTipIcon.Info); processCaller.Start(); }