/// <summary> /// マスターメンテナンス画面の呼び出しを行う /// </summary> /// <param name="mntwndTypes">マスター種別の一覧</param> public static void CallMasterMainte(Dictionary <string, List <Type> > mntwndTypes) { UcLabelTwinTextBox twintextbox = ViewBaseCommon.GetCurrentTwinText(); if (twintextbox == null) { return; } if (mntwndTypes == null) { return; } try { var wndtp = mntwndTypes.Where(x => x.Key == twintextbox.DataAccessName).FirstOrDefault(); if ((wndtp.Value is List <Type>) != true) { return; } Type tp = (wndtp.Value as List <Type>)[0]; if (tp == null) { return; } WindowMasterMainteBase mstmnt = Activator.CreateInstance(tp) as WindowMasterMainteBase; var wnd = Window.GetWindow(twintextbox); mstmnt.ShowDialog(wnd); } catch (Exception ex) { throw ex; } }
/// <summary> /// マスター検索画面の呼び出しを行う /// </summary> /// <param name="wnd">呼び出し元Window</param> /// <param name="srchwndTypeList">マスター種別の一覧</param> public static void CallMasterSearch(Window wnd, Dictionary <string, List <Type> > srchwndTypeList) { UcLabelTwinTextBox twintextbox = ViewBaseCommon.GetCurrentTwinText(); if (twintextbox == null) { return; } if (srchwndTypeList == null) { return; } try { var wndtp = srchwndTypeList.Where(x => x.Key == twintextbox.DataAccessName).FirstOrDefault(); if ((wndtp.Value is List <Type>) != true) { return; } Type tp = (wndtp.Value as List <Type>)[1]; if (tp == null) { return; } if (tp.BaseType != typeof(WindowMasterSearchBase)) { ViewBaseException ex = new ViewBaseException(string.Format("{0}がWindowMasterSearchBaseの派生クラスではないため処理できません。", tp)); throw ex; } twintextbox.BeforeCode = twintextbox.Text1; WindowMasterSearchBase mstsrch = Activator.CreateInstance(tp) as WindowMasterSearchBase; mstsrch.TwinTextBox = twintextbox; if (mstsrch.ShowDialog(wnd) == true) { twintextbox.AfterCode = twintextbox.Text1; // 検索結果を選択して閉じられた場合、該当するTwinTextboxにPreviewKeyDownイベントを送信する。 IInputElement element = Keyboard.FocusedElement; var s = PresentationSource.FromDependencyObject(element as DependencyObject); var eventArgs = new KeyEventArgs(Keyboard.PrimaryDevice, s, (int)System.DateTime.Now.Ticks, Key.Enter); eventArgs.RoutedEvent = Keyboard.PreviewKeyDownEvent; InputManager.Current.ProcessInput(eventArgs); eventArgs.RoutedEvent = Keyboard.PreviewKeyUpEvent; InputManager.Current.ProcessInput(eventArgs); } } catch (Exception ex) { throw ex; } }