private void buttonChooseStack_Click(object sender, EventArgs e) { if (Filenames.Count > 0) { Filenames.Clear(); } openFileDialogStack.Filter = _dialogFilterStack; openFileDialogStack.InitialDirectory = _initDir; openFileDialogStack.FileName = ""; DialogResult result = openFileDialogStack.ShowDialog(); if (result == DialogResult.OK) { Stackname = openFileDialogStack.FileName; if (Stackname != null) { textBox1.Text = Stackname; WSIExtraction.Stack stack = ReadWriteUtils.DeserializeObjectFromJSON <WSIExtraction.Stack>(Stackname); foreach (WSIExtraction.Slice slice in stack.Section) { Filenames.Add(Path.Combine(Path.GetDirectoryName(Stackname), slice.Path)); } } textBox1.Text = Stackname; EnableButtons(); } }