private void Temp_MouseMove(object sender, MouseEventArgs e) { if (MovingLabel && movable) { Label_Extension label = (Label_Extension)sender; label.Left = e.X + label.Left - offsetX; label.Top = e.Y + label.Top - offsetY; foreach (Label olabel in label.childLabels) { olabel.Left = e.X + olabel.Left - offsetX; olabel.Top = e.Y + olabel.Top - offsetY; } } }
private void GetInformation(object sender, EventArgs e) { Label_Extension label = (Label_Extension)sender; debugger.AppendText("\r\n\r\n"); debugger.AppendText($"Parameter Inputs: {string.Join(',', label.inputs)}"); if (label.outputs.Count > 0) { debugger.AppendText($"\r\nOutput Type: {label.outputs[0]}"); } List <Label> allocated = label.current_mappings.Keys.ToList <Label>(); List <string> temp = allocated.Select(lab => lab.Name).ToList(); debugger.AppendText($"\r\nCurrently mapped inputs and outputs: {string.Join(',', temp)}"); string toMap = string.Join(',', label.childLabels.Where(lab => !(label.current_mappings.ContainsKey(lab) || label.value_mappings.ContainsKey(lab))).Select(lab => lab.Text.ToString()).ToList()); debugger.AppendText($"\r\nPLEASE MAP THESE VALUES BY CLICKING ON THEIR PARAMETER AND AN ASSOCIATION OF THEIR TYPE {toMap}"); }
public bool ValidateStartToEnd() { Label first_to_execute = ThreadInMapping; Label last_to_execute = ThreadOutMapping; if (first_to_execute == null || last_to_execute == null) { return(false); } Label cur_label = first_to_execute; while (cur_label != ThreadOut) { Label_Extension parent = Selection_Parents[cur_label]; int mapped_inputs = 0; for (int i = 1; i < parent.inputs.Count + 1; i++) { if (parent.current_mappings.ContainsKey(parent.childLabels[i])) { mapped_inputs++; } else if (parent.value_mappings.ContainsKey(parent.childLabels[i])) { mapped_inputs++; } } if (parent.methodInfo.GetParameters().Length != mapped_inputs) { debugger.AppendText("\r\n MISMATCH OF ALLOCATED PARAMETERS. PLEASE CHECK ALL PARAMETERS ARE NOT THEIR ORIGINAL COLOR FOR INVOKED METHODS"); debugger.AppendText($"\r\n ERROR ON CLASS {parent.Name}, METHOD {cur_label.Text.ToString()}"); return(false); } if (!parent.current_mappings.ContainsKey(cur_label)) { return(false); } cur_label = parent.current_mappings[cur_label]; } return(true); }
public void ExecuteThread(object sender, EventArgs e) { if (!ValidateStartToEnd()) { debugger.AppendText("\r\n\r\nCurrently Missing Paths Or Parameters!"); } else { debugger.AppendText("\r\nAll Paths and Parameters Setup Correctly!"); Dictionary <Label, ArrayList> completed_results = new Dictionary <Label, ArrayList>(); Label cur_label = ThreadOutMapping; while (cur_label != ThreadOut) { Label_Extension parent = Selection_Parents[cur_label]; MethodInfo info = parent.methodInfo; Type type = info.DeclaringType; var temp = Activator.CreateInstance(type); object[] args = new object[parent.methodInfo.GetParameters().Length]; for (int i = 1; i < args.Length + 1; i++) { Label label = parent.childLabels[i]; if (parent.current_mappings.ContainsKey(label)) { args[i - 1] = completed_results[label]; } else { args[i - 1] = parent.value_mappings[label]; } } type.InvokeMember(parent.Text.ToString(), BindingFlags.InvokeMethod, null, temp, args); debugger.AppendText($"\r\nSuccess on execution of {parent.Text.ToString()}"); cur_label = parent.current_mappings.Values.ToList().FirstOrDefault(label => label.Text.ToString() == "Input Thread"); } } }
private void Temp_MouseDoubleClick(object sender, MouseEventArgs e) { if (canAdd) { ArrayList curType = AvailableMethods[current_assembly][class_drop.SelectedItem.ToString()]; MethodInfo info = null; List <string> ins = new List <string>(); List <string> outs = new List <string>(); foreach (MethodInfo inf in curType) { if (inf.Name == ((Label)sender).Text.ToString()) { info = inf; } } foreach (ParameterInfo inf in info.GetParameters()) { ins.Add(inf.ParameterType.ToString()); } if (info.ReturnType.ToString() != "System.Void") { outs.Add(info.ReturnType.ToString()); } int num_inputs = info.GetParameters().Length; Label_Extension temp = new Label_Extension(((Label)sender).Text.ToString(), ins, outs, 300, 30 * num_inputs + 30, label_width + 150, 10, Color.White, Color.Black, info); this.Controls.Add(temp); temp.Click += GetInformation; foreach (Label child in temp.childLabels) { Selection_Parents.Add(child, temp); child.MouseClick += Child_MouseClick; Controls.Add(child); } } }