コード例 #1
0
ファイル: Form1.cs プロジェクト: dunste123/DragRace
        private void UpdateCarDSte(object sender, EventArgs e)
        {
            monitor.PrintLn("Pressed button to set car color");
            monitor.PrintLn("Creating dialog");
            ColorDialog dialog = new ColorDialog();

            monitor.PrintLn("Openeing dialog");
            dialog.ShowDialog();
            monitor.PrintLn("Loading storage");
            PreviewStorage preview = (PreviewStorage)((Control)sender).Tag;

            monitor.PrintLn("Setting color on car");
            preview.carObj.CarColor = dialog.Color;
            monitor.PrintLn("Setting color on preview");
            preview.previewPnl.BackColor = dialog.Color;
            monitor.PrintLn("Color changed");
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: dunste123/DragRace
        private void SetCarName(object sender, EventArgs e)
        {
            monitor.PrintLn("Pressed button to change car name");
            monitor.PrintLn("Loading storage");
            PreviewStorage preview = (PreviewStorage)((Button)sender).Tag;

            monitor.PrintLn("Creating dialog");
            //Use the visual basic for the input 😛
            string input = Microsoft.VisualBasic.Interaction.InputBox(
                String.Format("Change the name for {0}?", preview.carObj.CarName),
                "Change name?", preview.carObj.CarName, -1, -1);

            monitor.PrintLn("Checking if input is null");
            input = input == null || input == "" ? preview.carObj.CarName : input;

            monitor.PrintLn("Setting name on car");
            preview.carObj.CarName = input;
            monitor.PrintLn("Setting name on preview");
            preview.previewName.Text = input;
            monitor.PrintLn("Name changed");
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: dunste123/DragRace
        private void Form1_Load(object sender, EventArgs e)
        {
            monitor.PrintLn("Booting App", false);
            //Hide tabs
            //Remove 3d effects
            this.tabMainDSte.Appearance = TabAppearance.FlatButtons;
            //sets ‘thinness’
            this.tabMainDSte.ItemSize = new Size(0, 1);
            this.tabMainDSte.SizeMode = TabSizeMode.Fixed;

            monitor.PrintLn("Loading default cars", false);
            monitor.PrintLn("Creating car 1");
            this.cars[0] = new Car("Car 1", Color.Red, this.pnlCar1DSte, randomDSte.Next(3, 7));
            monitor.PrintLn("Creating car 2");
            this.cars[1] = new Car("Car 2", Color.Tomato, this.pnlCar2DSte, randomDSte.Next(3, 7));
            monitor.PrintLn("Creating car 3");
            this.cars[2] = new Car("Car 3", Color.Coral, this.pnlCar3DSte, randomDSte.Next(3, 7));
            monitor.PrintLn("Creating car 4");
            this.cars[3] = new Car("Car 4", Color.Maroon, this.pnlCar4DSte, randomDSte.Next(3, 7));
            monitor.PrintLn("Cars have been loaded");

            #region init car settings
            //Set all the tags of the buttons
            monitor.PrintLn("Preparing settings", false);
            monitor.PrintLn("Creating PreviewStorage for car 1");
            PreviewStorage car1Storage = new PreviewStorage {
                carObj      = this.cars[0],
                previewPnl  = this.pnlPreviewCar1,
                previewName = this.lblCar1NameDSte
            };
            monitor.PrintLn("Upading car 1");
            car1Storage.update();
            this.btnColorCar1DSte.Tag = car1Storage;
            this.pnlPreviewCar1.Tag   = car1Storage;
            this.btnNameCar1DSte.Tag  = car1Storage;

            monitor.PrintLn("Creating PreviewStorage for car 2");
            PreviewStorage car2Storage = new PreviewStorage {
                carObj      = this.cars[1],
                previewPnl  = this.pnlPreviewCar2,
                previewName = this.lblCar2NameDSte
            };
            monitor.PrintLn("Upading car 2");
            car2Storage.update();
            this.btnColorCar2DSte.Tag = car2Storage;
            this.pnlPreviewCar2.Tag   = car2Storage;
            this.btnNameCar2DSte.Tag  = car2Storage;

            monitor.PrintLn("Creating PreviewStorage for car 3");
            PreviewStorage car3Storage = new PreviewStorage {
                carObj      = this.cars[2],
                previewPnl  = this.pnlPreviewCar3,
                previewName = this.lblCar3NameDSte
            };
            monitor.PrintLn("Upading car 2");
            car3Storage.update();
            this.btnColorCar3DSte.Tag = car3Storage;
            this.pnlPreviewCar3.Tag   = car3Storage;
            this.btnNameCar3DSte.Tag  = car3Storage;

            monitor.PrintLn("Creating PreviewStorage for car 4");
            PreviewStorage car4Storage = new PreviewStorage {
                carObj      = this.cars[3],
                previewPnl  = this.pnlPreviewCar4,
                previewName = this.lblCar4NameDSte
            };
            monitor.PrintLn("Upading car 4");
            car4Storage.update();
            this.btnColorCar4DSte.Tag = car4Storage;
            this.pnlPreviewCar4.Tag   = car4Storage;
            this.btnNameCar4DSte.Tag  = car4Storage;
            monitor.PrintLn("Car settings have been loaded", false);
            #endregion
        }