예제 #1
0
        static void Main(string[] args)
        {
            System.IO.StreamWriter outputFile = new System.IO.StreamWriter(@"c:\VisualStudioOhjelmointi\tv.txt");

            TV tv1 = new TV { ShowName = "Uutiset", Channel = "Yle TV1", StartTime = "20.30", EndTime = "20.50", Info = "Illan uutislähetys" };
            outputFile.WriteLine(tv1);

            TV tv2 = new TV { ShowName = "Kymmenen uutiset", Channel = "MTV3", StartTime = "22.00", EndTime = "22.20", Info = "Illan pääuutislähetys" };
            outputFile.WriteLine(tv2);

            TV tv3 = new TV { ShowName = "Urheilua", Channel = "Yle TV2", StartTime = "14.30", EndTime = "16.50", Info = "Urheilua suorana lähetyksenä" };
            outputFile.WriteLine(tv3);

            outputFile.Close();

            try
            {
                string tvshows = System.IO.File.ReadAllText(@"c:\VisualStudioOhjelmointi\tv.txt");
                Console.WriteLine(tvshows);
            }
            catch (System.IO.FileNotFoundException)
            {
                Console.WriteLine("File not found!!!");
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: H8262/Demo07
        static void Main(string[] args)
        {
            TV program = new TV();

            TV program1 = new TV { Name = "Teletapit", Channel = "Kakkonen", Start = "3:00", End = "20:00", Description = "Uudestaan" };
            TV program2 = new TV { Name = "Salapoliisiohjelma", Channel = "Perkele", Start = "1:00", End = "1:15", Description = "Paras ikinä" };
            TV program3 = new TV { Name = "Tosi-Tv", Channel = "Muijienitkukanava", Start = "6:66", End = "Ajan rakenne muuttunut", Description = "Ihana David" };

            program.AddTv(program1);
            program.AddTv(program2);
            program.AddTv(program3);

            System.IO.StreamWriter tvPrograms = new System.IO.StreamWriter("programs.txt");
           
            tvPrograms.WriteLine(program1.ToString());
            tvPrograms.WriteLine(program2.ToString());
            tvPrograms.WriteLine(program3.ToString());
            tvPrograms.Close();
            string text = System.IO.File.ReadAllText("programs.txt");
            System.Console.WriteLine("Programs: " + text);          
        }
예제 #3
0
파일: Program.cs 프로젝트: temesky/demo03
        static void Main(string[] args)
        {
            //create a new TV object
            TV tv = new TV();
            tv.IsOn = true;
            tv.Contrast = 55;
            tv.Brightness = 70;
            tv.Volume = 18;
            tv.Mute = false;
            tv.Channel = "TV2";
            //tv.PrintData();

            Console.WriteLine("Tv On {0}, Volume {1} and Channel {2}", tv.IsOn, tv.Volume, tv.Channel);
            tv.TurnOff();
            Console.WriteLine("Tv On {0}, Volume {1} and Channel {2}", tv.IsOn, tv.Volume, tv.Channel);




            Console.ReadLine();

        }
예제 #4
0
        static void Main(string[] args)
        {
            // create TV object
            TV tv = new TV();

            tv.Brand  = "Sony";
            tv.Model  = "X809C";
            tv.IsOpen = false;
            Console.WriteLine(tv.ToString());

            // put tv on
            tv.IsOpen  = true;
            tv.Channel = 22;
            tv.Volume  = 8;
            Console.WriteLine(tv.ToString());

            // close tv
            tv.IsOpen = false;
            Console.WriteLine(tv.ToString());

            Console.WriteLine("Press enter key to continue...");
            Console.ReadLine();
        }
예제 #5
0
        static void Main(string[] args)
        {
            TV lg = new TV();

            lg.Model = "LG";
            lg.SetPower();
            lg.CheckPower();
            lg.ChUp();
            lg.ChUp();
            lg.ChUp();
            lg.ChUp();
            lg.ChUp();
            lg.ChDown();
            lg.ChDown();
            Console.WriteLine();
            lg.PrintData();

            TV sony = new TV();

            sony.Model = "SONY";
            sony.SetPower();
            sony.CheckPower();
            sony.ChUp();
            sony.ChUp();
            sony.ChUp();
            sony.ChDown();
            sony.ChUp();
            sony.ChDown();
            sony.ChDown();
            Console.WriteLine();
            sony.PrintData();

            TV samsung = new TV();

            samsung.Model = "Samsung";
            samsung.SetPower();
            samsung.CheckPower();
            samsung.ChUp();
            samsung.ChUp();
            samsung.ChUp();
            samsung.ChDown();
            samsung.ChUp();
            samsung.ChDown();
            samsung.ChDown();
            samsung.ChUp();
            samsung.ChUp();
            samsung.ChUp();
            samsung.ChDown();
            samsung.ChUp();
            samsung.ChDown();
            samsung.ChDown();
            samsung.ChUp();
            samsung.ChUp();
            samsung.ChUp();
            samsung.ChDown();
            samsung.ChUp();
            samsung.ChDown();
            samsung.ChDown();
            samsung.ChUp();
            samsung.ChUp();
            samsung.ChUp();
            samsung.ChDown();
            samsung.ChUp();
            samsung.ChDown();
            samsung.ChDown();
            Console.WriteLine();
            samsung.PrintData();

            TV panasonic = new TV();

            panasonic.Model = "Panasonic";
            panasonic.SetPower();
            panasonic.CheckPower();
            panasonic.ChInput();
            Console.WriteLine();
            panasonic.PrintData();
        }
예제 #6
0
파일: TV.cs 프로젝트: H8262/Demo07
 public void AddTv(TV tv)
 {
     programs.Add(tv);
 }