Greetings ppl..im doing this assignment on C# programming and im really really stucked right now.
What i need to do is to read either '0' or '1' from a circuit ( circuit is connected to my laptop via serial port ), and based on either '0' or '1', different videos ( video 1 or video 2) will be played.
The following is my source code by far, and there're 6 errors which popped out and i have no idea how to fix it.
Code:using System; using System.Collections.Generic; using System.Text; using System.IO.Ports; namespace cs_open_videos { class Program { static void Main(string[] args) { OpenSerialPort(); //String fileToOpen = "C:/myog.avi"; System.Diagnostics.ProcessStartInfo ps = new System.Diagnostics.ProcessStartInfo("C:/Program Files/Windows Media Player/wmplayer.exe/play/fullscreen", fileToOpen); System.Diagnostics.Process.Start(ps); } SerialPort com=new SerialPort(); private void OpenSerialPort() { SerialPort com=new SerialPort(); com.BaudRate=38400; com.Open(); com.DataReceived = OnRecieved; } private void OnRecieved(object sender, SerialDataReceivedEventArgs c) { char c = com.ReadChar(); switch (c) { case "0": String fileToOpen = "C:/video1.avi"; System.Diagnostics.ProcessStartInfo ps = new System.Diagnostics.ProcessStartInfo("C:/Program Files/Windows Media Player/wmplayer.exe/play/fullscreen", fileToOpen); System.Diagnostics.Process.Start(ps); case "1" : String fileToOpen = "C:/video2.avi"; System.Diagnostics.ProcessStartInfo ps = new System.Diagnostics.ProcessStartInfo("C:/Program Files/Windows Media Player/wmplayer.exe/play/fullscreen", fileToOpen); System.Diagnostics.Process.Start(ps); play(); } } } }
apologies if it's kinda messy, but ppl pls help this beginner here if u can
Thank you in advance.



LinkBack URL
About LinkBacks



