private void Assembler_MainHome_Load(object sender, EventArgs e) { string broken_path = @"../../View/Pictures/broken.png"; string path = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory())) + @"\View\Pictures\Assembler\"; DirectoryInfo d = new DirectoryInfo(path); FileInfo[] Files = d.GetFiles("*.png"); //Getting Text files string message = ""; try { string pictureName = Files.First().Name; pictureBox1.Image = Image.FromFile(path + pictureName); message = "The program could not find pictures of : '" + pictureName + "' in the directory : " + path; } catch { pictureBox1.Image = Image.FromFile(broken_path); var result = MessageBox.Show(this.Owner, message + "\n \n\n Would you like to add pictures?", "No image found!", MessageBoxButtons.YesNo); switch (result) { case DialogResult.No: break; case DialogResult.Yes: Manager.AddNewFolder(path); System.Diagnostics.Process.Start(path); break; } } }
private void button1_Click(object sender, EventArgs e) { string wanted_path = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory())) + @"\View\Pictures"; string new_path = wanted_path + @"\" + textBox1.Text.ToString(); if (textBox1.Text.ToString() == string.Empty) { MessageBox.Show("Please insert a name first!"); } else { Manager.AddNewFolder(new_path); System.Diagnostics.Process.Start(new_path); } }
private void open_directory(string message, string new_path) { if (_currentUser.userType["Production Manager"] == true) { var result = MessageBox.Show(this.Owner, message + "\n \n\n Would you like to add pictures?", "No image found!", MessageBoxButtons.YesNo); switch (result) { case DialogResult.No: break; case DialogResult.Yes: Manager.AddNewFolder(new_path); System.Diagnostics.Process.Start(new_path); break; } } }