/// <summary> /// Run "Generate" action for the selected graph. Shows window containen all the possible generators. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonGenerate_Click(object sender, RoutedEventArgs e) { try { GraphViewModel gvm = (GraphViewModel)treeView1.SelectedItem; if (gvm == null) { return; } Settings s = Settings.GetSettings(); if (s.Version.IsEqualOrGreaterThan("5.0")) { string[] _generators = Launcher.Port.generatorNames(gvm.getGraph().GetMEType()).Split(new Char[] { '\r' }); List <string> generatorList = new List <string>(); foreach (string _generator in _generators) { if (!_generator.StartsWith("_") && !_generator.StartsWith("!")) { generatorList.Add(_generator); } } SelectionWindow sw = new SelectionWindow(generatorList, "Select the generator to run", false, false); sw.Height = 300; sw.WindowStartupLocation = WindowStartupLocation.CenterScreen; sw.ShowDialog(); string generator = ""; if (sw.SelectedItems.Count > 0) { generator = sw.SelectedItems[0]; if (generator.Length > 0) { gvm.getGraph().ExecuteGenerator(generator); } } } else { gvm.getGraph().ExecuteGenerator("Autobuild"); } } catch (Exception err) { DialogProvider.ShowMessageDialog("API error: " + err.Message, "API error"); this.correctErrorSituation(); } }
/// <summary> /// Action for the "Run Autobuild" button. Runs Autobuild for the selected graph. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonRunAutobuild_Click(object sender, RoutedEventArgs e) { try { GraphViewModel gvm = (GraphViewModel)treeView1.SelectedItem; if (gvm == null) { return; } gvm.getGraph().ExecuteGenerator("Autobuild"); } catch (Exception err) { DialogProvider.ShowMessageDialog("API error: " + err.Message, "API error"); this.correctErrorSituation(); } }
/// <summary> /// Open MetaEdit dialog in new thread /// </summary> /// <param name="DialogType"></param> private void StartMEDialog(int DialogType) { GraphViewModel gvm = null; MEDialog dialog = null; if (treeView1.SelectedItem != null) { gvm = (GraphViewModel)treeView1.SelectedItem; dialog = new MEDialog(DialogType, gvm.getGraph()); } else { dialog = new MEDialog(DialogType, null); } Thread _thread = new Thread(new ThreadStart(dialog.Run)); _thread.Start(); }
private void ButtonOpen_Click(object sender, RoutedEventArgs e) { try { if (treeView1.SelectedItem == null) { return; } GraphViewModel gvm = (GraphViewModel)treeView1.SelectedItem; MetaEditAPI.MetaEditAPI port = Launcher.Port; MEAPI.AllowSetForegroundWindow(); port.open(gvm.getGraph().ToMEOop()); } catch (Exception err) { DialogProvider.ShowMessageDialog("API error: " + err.Message, "API error"); this.correctErrorSituation(); } }