public MainWindow() { InitializeComponent(); WindowState = FormWindowState.Maximized; //generate default data for selected sprite so it won't get all //borked when there are no sprite sheets to load / missing m_selectedFrame.largeImage = defaultImage(); m_selectedFrame.smallImage = defaultImage(); m_textureDirectory = RegKey.read("texture_directory"); if (m_textureDirectory == null || !Directory.Exists(m_textureDirectory)) { if (MessageBox.Show("No valid texture path found. Click OK to browse\n or Cancel to continue (textures will be unavailable)", "Warning", MessageBoxButtons.OKCancel) == DialogResult.OK) { OptionsWindow ow = new OptionsWindow(this); ow.ShowDialog(); } } else { m_atlasTextureDirectory = m_textureDirectory + "\\atlases"; loadTextures(); } m_mapTextureDirectory = m_textureDirectory + "\\map"; InitPreview(); }
private void buttonOk_Click(object sender, EventArgs e) { if (textBoxTexturePath.Text != null && textBoxTexturePath.Text != string.Empty) { m_mainWindow.TextureDirectory = textBoxTexturePath.Text; m_mainWindow.MapTextureDirectory = textBoxTexturePath.Text + "\\map"; m_mainWindow.AtlasTextureDirectory = textBoxTexturePath.Text + "\\atlases"; RegKey.write("texture_directory", textBoxTexturePath.Text); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("Path to texture directory is missing"); } }