private void Form_TaskDesigner_Load(object sender, EventArgs e)
        {
            comboBxObjectToAdd.Text          = "<Select>";
            comboBxObjectToAdd.SelectedIndex = 1;
            pictureBxTextureImage.Visible    = checkBoxUseTexture.Checked;
            numericUpDownImageNumber.Enabled = checkBoxUseTexture.Checked;
            labelImage.Enabled = checkBoxUseTexture.Checked;

            string        textureFilesPath;
            DirectoryInfo dInfoTextures = new DirectoryInfo(Environment.CurrentDirectory);

            dInfoTextures    = dInfoTextures.Parent;
            textureFilesPath = dInfoTextures.FullName + @"\Textures";

            string[] textureFiles = new string[20];
            if (Directory.Exists(textureFilesPath))
            {
                textureFiles = Directory.GetFiles(textureFilesPath, "*.bmp");
            }

            foreach (string currentFile in textureFiles)
            {
                try
                {
                    Bitmap currentImage = new Bitmap(currentFile);
                    currentImage.RotateFlip(RotateFlipType.RotateNoneFlipY);
                    imageList.Images.Add(currentImage);
                }
                catch (ArgumentNullException ex)
                {
                    System.Windows.Forms.MessageBox.Show("Cannot find texture files. Please ensure that the \"Textures\" folder is in the executable parent directory. Exception message: " + ex.Message, "Cannot Find Texture Files");
                    Environment.Exit(-1);
                }
            }

            this.numericUpDownImageNumber.Maximum = (imageList.Images.Count - 1);

            pictureBxTextureImage.Image = imageList.Images[(int)this.numericUpDownImageNumber.Value];


            Externals.LoadVisualiser(m_objectsToDraw);

            //if (Externals.VisualiserLoaded())
            {
                WindowAlignment.BringVisualiserToFrontAndAlignWindows();
            }

            Externals.SendNotification("TDSOK");
        }
Exemple #2
0
        private void Form_TaskDesigner_Load(object sender, EventArgs e)
        {
            comboBxObjectToAdd.Text          = "<Select>";
            comboBxObjectToAdd.SelectedIndex = 1;
            pictureBxTextureImage.Visible    = checkBoxUseTexture.Checked;
            numericUpDownImageNumber.Enabled = checkBoxUseTexture.Checked;
            labelImage.Enabled = checkBoxUseTexture.Checked;

            string        textureFilesPath;
            DirectoryInfo dInfoTextures = new DirectoryInfo(Environment.CurrentDirectory);

            dInfoTextures    = dInfoTextures.Parent;
            textureFilesPath = dInfoTextures.FullName + @"\Textures";

            string[] textureFiles = new string[20];

            foreach (string currentTextureFilePath in Textures.ListOfTextureFilePaths("bmp"))
            {
                Bitmap currentBitmap = new Bitmap(currentTextureFilePath);
                currentBitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
                imageList.Images.Add(currentBitmap);
                this.numericUpDownImageNumber.Maximum = (imageList.Images.Count - 1);
                pictureBxTextureImage.Image           = imageList.Images[(int)this.numericUpDownImageNumber.Value];
            }

            //if (Directory.Exists(textureFilesPath))
            //{
            //    textureFiles = Directory.GetFiles(textureFilesPath, "*.bmp");
            //}

            //if (textureFiles[0] == null)
            //{
            //    if (System.Windows.Forms.MessageBox.Show("Cannot find texture files. Navigate to directory?", "Cannot Find Texture Files", MessageBoxButtons.YesNo) == DialogResult.Yes)
            //    {
            //        FolderBrowserDialog folderBrowser = new FolderBrowserDialog();
            //        folderBrowser.Description = "Select texture files folder for Task Designer.";
            //        folderBrowser.ShowDialog();
            //        textureFilesPath = folderBrowser.SelectedPath;
            //        textureFiles = Directory.GetFiles(textureFilesPath, "*.bmp");
            //    }
            //    else
            //    {
            //        Environment.Exit(-1);
            //    }
            //}
            //    foreach (string currentFile in textureFiles)
            //    {
            //        try
            //        {
            //            Bitmap currentImage = new Bitmap(currentFile);
            //            currentImage.RotateFlip(RotateFlipType.RotateNoneFlipY);
            //            imageList.Images.Add(currentImage);
            //            this.numericUpDownImageNumber.Maximum = (imageList.Images.Count - 1);
            //            pictureBxTextureImage.Image = imageList.Images[(int)this.numericUpDownImageNumber.Value];
            //        }
            //        catch (ArgumentNullException ex)
            //        {
            //            //                    System.Windows.Forms.MessageBox.Show("Cannot find texture files. Please ensure that the \"Textures\" folder is in the executable parent directory. Exception message: " + ex.Message, "Cannot Find Texture Files");
            //            if (System.Windows.Forms.MessageBox.Show("Cannot find texture files. Navigate to directory?", "Cannot Find Texture Files", MessageBoxButtons.YesNo) == DialogResult.Yes)
            //            {
            //                FolderBrowserDialog folderBrowser = new FolderBrowserDialog();
            //                folderBrowser.ShowDialog();
            //                textureFilesPath = folderBrowser.SelectedPath;
            //            }
            //            else
            //            {
            //                Environment.Exit(-1);
            //            }
            //        }

            //}



            Externals.LoadVisualiser(m_objectsToDraw);



            Externals.SendNotification("TDSOK");
        }