private static void SetTextoMainframe(object sender) { MainFrameDriver mdriver = null; XMLScreenField XF = null; string Command = null; MainFrameDriverWindow MDW = null; bool IsFeildPassword = false; if (sender.GetType() == typeof(TextBox)) { TextBox TB = (TextBox)sender; XF = (XMLScreenField)TB.Tag; MDW = (MainFrameDriverWindow)Window.GetWindow(TB); if (MDW == null) { return; } mdriver = MDW.mDriver; Command = TB.Text; } else if (sender.GetType() == typeof(PasswordBox)) { IsFeildPassword = true; PasswordBox PWB = (PasswordBox)sender; XF = (XMLScreenField)PWB.Tag; MDW = (MainFrameDriverWindow)Window.GetWindow(PWB); mdriver = MDW.mDriver; Command = PWB.Password; } else { return; } if (XF == null || String.IsNullOrEmpty(Command) || mdriver == null) { } else { mdriver.SetTextAtPosition(Command, XF.Location.left, XF.Location.top, false); if (MDW.RecordBtn.IsChecked == true) { try { ActMainframeSetText AMFST = new ActMainframeSetText(); AMFST.LocateBy = eLocateBy.ByCaretPosition; AMFST.LocateValue = XF.Location.position.ToString(); AMFST.Value = Command; if (mdriver.mBusinessFlow == null) { return; } if (IsFeildPassword) { AMFST.Description = "Set Password "; } else { AMFST.Description = "Set Text: " + Command; } mdriver.mBusinessFlow.CurrentActivity.Acts.Add((Actions.Act)AMFST); } finally { } } } }
private static void ConfigureControl(Control c, XMLScreenField x, Canvas ConsoleCanvas, MainFrameDriverWindow MFDW) { c.Tag = x; SetControlLocation(c, MFDW); ConsoleCanvas.Children.Add(c); c.GotFocus += Control_GotFocus; c.MouseEnter += Control_GotFocus; }