Exemple #1
0
 public void InitCDRom()
 {
     CDRom.Close();
     //Assert.IsFalse(CDRom.IsInitialized);
     CDRom.Initialize();
     //Assert.IsTrue(CDRom.IsInitialized);
     CDRom.Close();
 }
Exemple #2
0
        public void AddTestObjects(List <Item> items)
        {
            var item = new Book("Ivan vazov", "Pod igoto", "Roman", "1999", "Free");

            items.Add(item);
            var item2 = new AudioCD("Eminem", "Dadada", "Rap", "2000", "Reserved");

            items.Add(item2);
            var item3 = new CDRom("CD Room1 Author", "CD Room1", "CD", "1980", "Free");

            items.Add(item3);
            var item4 = new Magazine("Magazine1 Author", "Magazine1", "Magazine", "1999", "Free");

            items.Add(item4);
            var item5 = new Diskette("Diskette1 Author", "Diskette1", "Diskette", "1999", "Free");

            items.Add(item5);
            var item6 = new VideoDiskette("Video Diskette Author", "Video Diskette", "2000", "Reserved");

            items.Add(item6);
            var item7 = new VideoDiskette("Video Diskette Author", "Video Diskette", "Video Diskette", "2000", "Reserved");

            items.Add(item7);
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        public CDPlayerApp()
        {
            stringManager =
                new ResourceManager("SdlDotNetExamples.CDPlayer.Properties.Resources", Assembly.GetExecutingAssembly());
            InitializeComponent();
            this.Text = SdlDotNetExamples.CDPlayer.CDPlayerApp.StringManager.GetString(
                "Title", CultureInfo.CurrentUICulture);
            this.label1.Text = SdlDotNetExamples.CDPlayer.CDPlayerApp.StringManager.GetString(
                "SelectDrive", CultureInfo.CurrentUICulture);
            this.buttonPlay.Text = SdlDotNetExamples.CDPlayer.CDPlayerApp.StringManager.GetString(
                "Play", CultureInfo.CurrentUICulture);
            this.buttonPause.Text = SdlDotNetExamples.CDPlayer.CDPlayerApp.StringManager.GetString(
                "Pause", CultureInfo.CurrentUICulture);
            this.buttonStop.Text = SdlDotNetExamples.CDPlayer.CDPlayerApp.StringManager.GetString(
                "Stop", CultureInfo.CurrentUICulture);
            this.buttonEject.Text = SdlDotNetExamples.CDPlayer.CDPlayerApp.StringManager.GetString(
                "Eject", CultureInfo.CurrentUICulture);
            this.labelStatus.Text = SdlDotNetExamples.CDPlayer.CDPlayerApp.StringManager.GetString(
                "Track", CultureInfo.CurrentUICulture);
            this.buttonPrevious.Text = SdlDotNetExamples.CDPlayer.CDPlayerApp.StringManager.GetString(
                "Previous", CultureInfo.CurrentUICulture);
            this.buttonNext.Text = SdlDotNetExamples.CDPlayer.CDPlayerApp.StringManager.GetString(
                "Next", CultureInfo.CurrentUICulture);
            this.KeyPreview = true;
            surf            =
                new Surface(
                    this.surfaceControl.Width,
                    this.surfaceControl.Height);
            if (File.Exists(Path.Combine(dataDirectory, "marble1.png")))
            {
                filePath = "";
            }
            SurfaceCollection marbleSurfaces = new SurfaceCollection();

            marbleSurfaces.Add(new Surface(Path.Combine(filePath, Path.Combine(dataDirectory, "marble1.png"))), new Size(50, 50));

            for (int i = 0; i < 1; i++)
            {
                //Create a new Sprite at a random location on the screen
                BounceSprite bounceSprite =
                    new BounceSprite(marbleSurfaces,
                                     new Point(rand.Next(0, 350),
                                               rand.Next(0, 200)));
                bounceSprite.Bounds = new Rectangle(new Point(0, 0), this.surfaceControl.Size);

                // Randomize rotation direction
                bounceSprite.AnimateForward = rand.Next(2) == 1 ? true : false;

                //Add the sprite to the SpriteCollection
                master.Add(bounceSprite);
            }

            //The collection will respond to mouse button clicks, mouse movement and the ticker.
            master.EnableMouseButtonEvent();
            master.EnableMouseMotionEvent();
            master.EnableVideoResizeEvent();
            master.EnableKeyboardEvent();
            master.EnableTickEvent();

            SdlDotNet.Core.Events.Fps   = 30;
            SdlDotNet.Core.Events.Tick += new EventHandler <TickEventArgs>(this.Tick);
            SdlDotNet.Core.Events.Quit += new EventHandler <QuitEventArgs>(this.Quit);

            try
            {
                int num = CDRom.NumberOfDrives;
                _drive = CDRom.OpenDrive(0);
                for (int i = 0; i < num; i++)
                {
                    comboBoxDrive.Items.Add(CDRom.DriveName(i));
                }

                if (comboBoxDrive.Items.Count > 0)
                {
                    comboBoxDrive.SelectedIndex = 0;
                }
            }
            catch (SdlException ex)
            {
                Console.WriteLine(ex);
            }
        }
        public void CreateAndAddItem(List <Item> items, Item item)
        {
            Console.Write("Choose type(Book, AudioCD, CDRom, Diskette, Magazine, VideoDiskette):");
            var type = Console.ReadLine();

            Console.Write("Choose author:");
            var author = Console.ReadLine();

            Console.Write("Choose title:");
            var title = Console.ReadLine();

            Console.Write("Choose year of creation:");
            var date = Console.ReadLine();

            Console.Write("Choose condition (Free or Reserved):");
            var condition = Console.ReadLine();

            Console.Write("Choose style(optional) if you dont add style type no:");
            var style = Console.ReadLine();

            try
            {
                switch (type)
                {
                case "Book":
                    if (style != "no")
                    {
                        item = new Book(author, title, style, date, condition);
                    }
                    else
                    {
                        item = new Book(author, title, date, condition);
                    }
                    items.Add(item);
                    break;

                case "AudioCD":
                    if (style != "no")
                    {
                        item = new AudioCD(author, title, style, date, condition);
                    }
                    else
                    {
                        item = new AudioCD(author, title, date, condition);
                    }
                    items.Add(item);
                    break;

                case "CDRom":
                    if (style != "no")
                    {
                        item = new CDRom(author, title, style, date, condition);
                    }
                    else
                    {
                        item = new CDRom(author, title, date, condition);
                    }
                    items.Add(item);
                    break;

                case "Diskette":
                    if (style != "no")
                    {
                        item = new Diskette(author, title, style, date, condition);
                    }
                    else
                    {
                        item = new Diskette(author, title, date, condition);
                    }
                    items.Add(item);
                    break;

                case "Magazine":
                    if (style != "no")
                    {
                        item = new Magazine(author, title, style, date, condition);
                    }
                    else
                    {
                        item = new Magazine(author, title, date, condition);
                    }
                    items.Add(item);
                    break;

                case "VideoDiskette":
                    if (style != "no")
                    {
                        item = new VideoDiskette(author, title, style, date, condition);
                    }
                    else
                    {
                        item = new VideoDiskette(author, title, date, condition);
                    }
                    items.Add(item);
                    break;

                default:
                    throw new Exception("Can't create this type of item!!!");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }