Injection() public static method

対象プロセスにRM.Friendly.WPFStandardControls.3.dllをインジェクションします。
public static Injection ( WindowsAppFriend app ) : void
app WindowsAppFriend アプリケーション操作クラス。
return void
コード例 #1
0
        /// <summary>
        /// Search by Type from DependencyObject collection.
        /// </summary>
        /// <param name="collection">DependencyObject collection.</param>
        /// <param name="typeFullName">Target type.</param>
        /// <returns>Hit elements.</returns>
#else
        /// <summary>
        /// タイプから要素を検索。
        /// </summary>
        /// <param name="collection">DependencyObjectのコレクション。</param>
        /// <param name="typeFullName">検索対象のタイプ。</param>
        /// <returns>ヒットした要素。</returns>
#endif
        public static IWPFDependencyObjectCollection <DependencyObject> ByType(IWPFDependencyObjectCollection <DependencyObject> collection, string typeFullName)
        {
            var app = (WindowsAppFriend)((IAppVarOwner)collection).AppVar.App;

            WPFStandardControls_3.Injection(app);
            return(new WPFDependencyObjectCollection <DependencyObject>(app[typeof(SearcherInTarget), "ByType"](collection, typeFullName)));
        }
コード例 #2
0
        /// <summary>
        /// Enumerate DependencyObject continuing to LogicalTree.
        /// </summary>
        /// <param name="start">Start DependencyObject.</param>
        /// <param name="direction">Run direction.</param>
        /// <returns>Enumerated DependencyObject.</returns>
#else
        /// <summary>
        /// LogicalTreeに連なるDependencyObjectを列挙。
        /// </summary>
        /// <param name="start">列挙を開始するDependencyObject。</param>
        /// <param name="direction">走査方向。</param>
        /// <returns>列挙されたDependencyObject。</returns>
#endif
        public static IWPFDependencyObjectCollection <DependencyObject> LogicalTree(AppVar start, TreeRunDirection direction = TreeRunDirection.Descendants)
        {
            var app = (WindowsAppFriend)start.App;

            WPFStandardControls_3.Injection(app);
            return(new WPFDependencyObjectCollection <DependencyObject>(app[typeof(TreeUtilityInTarget), "LogicalTree"](start, direction)));
        }
コード例 #3
0
        /// <summary>
        /// Search by binding from DependencyObject collection.
        /// </summary>
        /// <typeparam name="T">Type of collection.</typeparam>
        /// <param name="collection">DependencyObject collection.</param>
        /// <param name="path">Binding path.</param>
        /// <param name="dataItem">DataItem.</param>
        /// <returns>Hit elements.</returns>
#else
        /// <summary>
        /// Binding情報から要素を検索。
        /// </summary>
        /// <typeparam name="T">コレクションのタイプ。</typeparam>
        /// <param name="collection">DependencyObjectのコレクション。</param>
        /// <param name="path">バインディングパス。</param>
        /// <param name="dataItem">DataItem。</param>
        /// <returns>ヒットした要素。</returns>
#endif
        public static IWPFDependencyObjectCollection <T> ByBinding <T>(IWPFDependencyObjectCollection <T> collection, string path, ExplicitAppVar dataItem = null) where T : DependencyObject
        {
            var app = (WindowsAppFriend)((IAppVarOwner)collection).AppVar.App;

            WPFStandardControls_3.Injection(app);
            return(new WPFDependencyObjectCollection <T>(app[typeof(SearcherInTarget), "ByBinding"](collection, path, dataItem)));
        }
コード例 #4
0
        /// <summary>
        /// Search by CommandParameter from ButtonBase collection.
        /// </summary>
        /// <typeparam name="T">Type of collection.</typeparam>
        /// <param name="collection">ButtonBase collection.</param>
        /// <param name="commandParameter">Command parameter.</param>
        /// <returns>Hit elements.</returns>
#else
        /// <summary>
        /// コマンドパラメータから要素を検索。
        /// </summary>
        /// <typeparam name="T">コレクションのタイプ。</typeparam>
        /// <param name="collection">DependencyObjectのコレクション。</param>
        /// <param name="commandParameter">コマンドパラメータ。</param>
        /// <returns>ヒットした要素。</returns>
#endif
        public static IWPFDependencyObjectCollection <T> ByCommandParameter <T>(IWPFDependencyObjectCollection <T> collection, object commandParameter) where T : ButtonBase
        {
            var app = ((IAppVarOwner)collection).AppVar.App;

            WPFStandardControls_3.Injection((WindowsAppFriend)app);
            var ret = app[typeof(ButtonSearcherInTarget), "ByCommandParameterCore"](AdjustCollectionButtonBase(collection, app), commandParameter);

            return(new WPFDependencyObjectCollection <T>(ret));
        }
コード例 #5
0
        /// <summary>
        /// Search by flag of IsCancel.
        /// </summary>
        /// <typeparam name="T">Type of collection.</typeparam>
        /// <param name="collection">ButtonBase collection.</param>
        /// <returns>Hit elements.</returns>
#else
        /// <summary>
        /// IsCancelフラグが立っているボタンを検索。
        /// </summary>
        /// <typeparam name="T">コレクションのタイプ。</typeparam>
        /// <param name="collection">DependencyObjectのコレクション。</param>
        /// <returns>ヒットした要素。</returns>
#endif
        public static IWPFDependencyObjectCollection <T> ByIsCancel <T>(IWPFDependencyObjectCollection <T> collection) where T : Button
        {
            var app = ((IAppVarOwner)collection).AppVar.App;

            WPFStandardControls_3.Injection((WindowsAppFriend)app);
            var ret = app[typeof(ButtonSearcherInTarget), "ByIsCancelCore"](AdjustCollectionButton(collection, app));

            return(new WPFDependencyObjectCollection <T>(ret));
        }
コード例 #6
0
        /// <summary>
        /// Search by Text from TextBlock collection.
        /// </summary>
        /// <typeparam name="T">Type of collection.</typeparam>
        /// <param name="collection">TextBlock collection.</param>
        /// <param name="contentText">Content text.</param>
        /// <returns>Hit elements.</returns>
#else
        /// <summary>
        /// Textから要素を検索。
        /// </summary>
        /// <typeparam name="T">コレクションのタイプ。</typeparam>
        /// <param name="collection">DependencyObjectのコレクション。</param>
        /// <param name="contentText">文字列。</param>
        /// <returns>ヒットした要素。</returns>
#endif
        public static IWPFDependencyObjectCollection <T> ByText <T>(IWPFDependencyObjectCollection <T> collection, string contentText) where T : TextBlock
        {
            var app = ((IAppVarOwner)collection).AppVar.App;

            WPFStandardControls_3.Injection((WindowsAppFriend)app);
            var ret = app[typeof(TextBlockSearcherInTarget), "ByTextCore"](AdjustCollectionTextBlock(collection, app), contentText);

            return(new WPFDependencyObjectCollection <T>(ret));
        }
コード例 #7
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="appVar">Application variable object for the control.</param>
#else
        /// <summary>
        /// コンストラクタです。
        /// </summary>
        /// <param name="appVar">アプリケーション内変数。</param>
#endif
        public WPFUIElement(AppVar appVar)
        {
            if (appVar == null)
            {
                throw new ArgumentNullException("appVar");
            }
            AppVar = appVar;
            WPFStandardControls_3.Injection((WindowsAppFriend)AppVar.App);
        }
コード例 #8
0
        /// <summary>
        /// Search by Name from FrameworkElement collection.
        /// </summary>
        /// <typeparam name="T">Type of collection.</typeparam>
        /// <param name="collection">FrameworkElement collection.</param>
        /// <param name="name">Name.</param>
        /// <returns>Hit elements.</returns>
#else
        /// <summary>
        /// 名前から要素を検索。
        /// </summary>
        /// <typeparam name="T">コレクションのタイプ。</typeparam>
        /// <param name="collection">FrameworkElementのコレクション。</param>
        /// <param name="name">名前。</param>
        /// <returns>ヒットした要素。</returns>
#endif
        public static IWPFDependencyObjectCollection <T> ByName <T>(IWPFDependencyObjectCollection <T> collection, string name) where T : FrameworkElement
        {
            var app = ((IAppVarOwner)collection).AppVar.App;

            WPFStandardControls_3.Injection((WindowsAppFriend)app);
            var ret = app[typeof(FrameworkElementSearcherInTarget), "ByNameCore"](AdjustCollectionFrameworkElement(collection, app), name);

            return(new WPFDependencyObjectCollection <T>(ret));
        }
コード例 #9
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="appVar">Application variable object for the control.</param>
#else
        /// <summary>
        /// コンストラクタです。
        /// </summary>
        /// <param name="appVar">アプリケーション内変数。</param>
#endif
        protected AppVarWrapper(AppVar appVar)
        {
            if (appVar == null)
            {
                throw new ArgumentNullException("appVar");
            }
            _app    = (WindowsAppFriend)appVar.App;
            _appVar = appVar;
            WPFStandardControls_3.Injection(_app);
        }
コード例 #10
0
        /// <summary>
        /// Install RM.Friendly.WPFStandardControls.3.5.dll to target process.
        /// </summary>
        /// <param name="app">Application manipulation object.</param>
#else
        /// <summary>
        /// 対象プロセスにRM.Friendly.WPFStandardControls.3.5.dllをインジェクションします。
        /// </summary>
        /// <param name="app">アプリケーション操作クラス。</param>
#endif
        public static void Injection(WindowsAppFriend app)
        {
            WPFStandardControls_3.Injection(app);
            string key = typeof(WPFStandardControls_3_5).FullName;
            object isInit;

            if (!app.TryGetAppControlInfo(key, out isInit))
            {
                WindowsAppExpander.LoadAssembly(app, typeof(WPFStandardControls_3_5).Assembly);
                app.AddAppControlInfo(key, true);
            }
        }