2using System.Collections.Generic;
3using System.ComponentModel;
8using System.Threading.Tasks;
9using System.Windows.Forms;
13 public partial class BioConsole : Form
17 InitializeComponent();
19 public static bool onTab =
false;
27 private void runBut_Click(
object sender, EventArgs e)
30 consoleBox.Text += textBox.Text + Environment.NewLine + o.ToString() + Environment.NewLine;
40 private void imagejBut_Click(
object sender, EventArgs e)
44 ImageJ.
RunOnImage(textBox.Text, headlessBox.Checked, tabRadioBut.Checked, biofBox.Checked, newTabBox.Checked);
45 consoleBox.Text += textBox.Text + Environment.NewLine;
52 filename = filename.Remove(filename.Length - 4, 4);
55 filename = System.IO.Path.GetFileNameWithoutExtension(ImageView.SelectedImage.ID);
56 string file = System.IO.Path.GetDirectoryName(ImageView.SelectedImage.ID) +
"/" + filename +
".ome.tif";
57 if (ImageView.SelectedImage.ID.EndsWith(
".ome.tif"))
58 ImageView.SelectedImage.Update();
60 App.tabsView.AddTab(
BioImage.OpenOME(file,
false));
67 private void topMostBox_CheckedChanged(
object sender, EventArgs e)
69 this.TopMost = topMostBox.Checked;
76 private void BioConsole_FormClosing(
object sender, FormClosingEventArgs e)
91 private void BioConsole_KeyDown(
object sender, KeyEventArgs e)
93 if (e.KeyCode ==
Keys.Up)
96 textBox.Text = consoleBox.Lines[consoleBox.Lines.Length - 1 - line];
98 if (e.KeyCode ==
Keys.Down)
101 textBox.Text = consoleBox.Lines[consoleBox.Lines.Length - 1 - line];
109 private void tabRadioBut_CheckedChanged(
object sender, EventArgs e)
111 onTab = tabRadioBut.Checked;
118 private void biofBox_CheckedChanged(
object sender, EventArgs e)
123 private void headlessBox_CheckedChanged(
object sender, EventArgs e)
128 string chs =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
129 private string pred =
"";
130 private List<string> preds =
new List<string>();
131 private void textBox_TextChanged(
object sender, EventArgs e)
133 if (textBox.Text.Length == 0)
140 pred = pred.Replace(
"\t",
"").Replace(
"\r",
"").Replace(
"\n",
"");
141 if (pred.Contains(
' '))
142 pred = textBox.Text.Remove(0, textBox.Text.LastIndexOf(
' '));
144 pred = textBox.Text.Replace(
"\t",
"").Replace(
"\r",
"").Replace(
"\n",
"");
149 foreach (Char cs
in pred)
152 foreach (Char c
in chs)
165 pred = pred.Remove(0, ind + 1);
170 foreach (var cs
in ImageJ.Macro.Commands)
172 if (cs.Value.Name.StartsWith(pred))
173 preds.Add(cs.Value.Name);
175 foreach (var cs
in ImageJ.Macro.Functions)
177 if (cs.Value[0].Name.StartsWith(pred))
178 preds.Add(cs.Value[0].Name);
181 foreach (var item
in preds)
183 if (this.Width > TextRenderer.MeasureText(predLabel.Text,
this.Font).Width)
185 predLabel.Text += item +
", ";
189 if (textBox.Text.EndsWith(
'\t'))
191 string s = textBox.Text.TrimEnd(
'\t');
193 textBox.Text = s.Remove(s.Length - pred.Length, pred.Length) + preds[0];
195 textBox.SelectionStart = textBox.Text.Length;
198 private void newTabBox_CheckedChanged(
object sender, EventArgs e)
200 newTab = newTabBox.Checked;
System.Windows.Forms.Keys Keys
static bool useBioformats
static async void RunOnImage(string con, bool headless, bool onTab, bool bioformats, bool newTab)
ImageView control for image stacks, pyramidal and whole-slide-images.
static BioImage SelectedImage
static object RunString(string st)