private string getPhases(Makro ws) { string tmp = ""; int c = 0; foreach (Phase p in ws.Phasen) { if (!p.Enabled || p.Name == null) continue; if (c % 5 == 0) tmp += Environment.NewLine + @"restore phases"; tmp += " " + p.Name.ToString().ToLower(); c++; } if (c > 0) { return @"reject phases *" + Environment.NewLine + tmp; } else { return ""; } }
private string getElm(Makro ws) { string tmp = ""; int c = 0; foreach (Element elm in ws.Elemente) { if (elm.Disabled || elm.Name == null) continue; if (c % 5 == 0) tmp += Environment.NewLine + @"Define_Elements"; tmp += " " + elm.Name.Trim().ToLower(); c++; } return tmp; }
private string getCont(Makro ws) { string tmp = ""; foreach (Element elm in ws.Elemente) { if (elm.Disabled) continue; if (elm.Value != null && elm.Value != "" && elm.Name != null && elm.Name != "") { tmp += Environment.NewLine + "Set_Condition " + ConvUnit(elm.Kind, elm.Name, elm.Value); } } tmp += Environment.NewLine; foreach (Element elm in ws.Conditions) { if (elm.Disabled) continue; if (elm.Value != null && elm.Value != "" && elm.Name != null && elm.Name != "") { tmp += Environment.NewLine + "Set_Condition " + ConvUnit(elm.Kind, elm.Name, elm.Value); } } tmp = tmp.Replace(",", "."); return tmp; }
public string makeMacro(Makro ws) { string ret = String.Format(@"@@@ Macro generated with TCMM @@@ Material-Name: {2} @@@ Fetching Database goto_module Database_Retrieval switch {3} @@@ Elements {0} @@@ Phases {4} @@@ Custom Commands DB {5} get_data goto_module Poly_3 @@@ Conditions{1} @@@ Custom Commands Poly {6} @@@ post module post @@@ Custom Commands Post {7} Set_Interactive ", getElm(ws), getCont(ws), ws.Name, ws.DB, getPhases(ws), ws.DBText, ws.PolyText, ws.PostText); return ret; }
void Werkstoffe_AddingNew(object sender, AddingNewEventArgs e) { Makro newItem = new Makro(); string newName = "Neues Makro "; int n = 1; while (nameExists(newName + n.ToString())) { n++; } newItem.Name = newName + n.ToString(); e.NewObject = newItem; Makros.EndNew(Makros.Count - 1); }
private void comboBoxWS_SelectedIndexChanged(object sender, EventArgs e) { if (listBoxMakros.SelectedItem != null) { CurrentMakro = (Makro)listBoxMakros.SelectedItem; textBoxWsName.Text = CurrentMakro.Name; dataGridViewElm.DataSource = CurrentMakro.Elemente; dataGridViewCond.DataSource = CurrentMakro.Conditions; textBoxDB.DataBindings.Clear(); textBoxDB.DataBindings.Add(new Binding("Text", CurrentMakro, "DB", false, DataSourceUpdateMode.OnPropertyChanged)); textBoxFolder.DataBindings.Clear(); textBoxFolder.DataBindings.Add(new Binding("Text", CurrentMakro, "Folder", false, DataSourceUpdateMode.OnPropertyChanged)); textBoxFileName.DataBindings.Clear(); textBoxFileName.DataBindings.Add(new Binding("Text", CurrentMakro, "FileName", false, DataSourceUpdateMode.OnPropertyChanged)); textBoxDBText.DataBindings.Clear(); textBoxDBText.DataBindings.Add(new Binding("Text", CurrentMakro, "DBText", false, DataSourceUpdateMode.OnPropertyChanged)); textBoxPolyText.DataBindings.Clear(); textBoxPolyText.DataBindings.Add(new Binding("Text", CurrentMakro, "PolyText", false, DataSourceUpdateMode.OnPropertyChanged)); textBoxPostText.DataBindings.Clear(); textBoxPostText.DataBindings.Add(new Binding("Text", CurrentMakro, "PostText", false, DataSourceUpdateMode.OnPropertyChanged)); dataGridViewPhases.DataSource = CurrentMakro.Phasen; refreshEditor(); } else { dataGridViewElm.DataSource = null; textBoxWsName.Text = null; } }