Example #1
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)));
        }
Example #2
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)));
        }
        static AppVar AdjustCollectionButton <T>(IWPFDependencyObjectCollection <T> collection, AppFriend app) where T : Button
        {
            //.net3.0対応
            var adjustCollection = app.Dim(new NewInfo <List <Button> >());

            app[typeof(CastUtility), "CastList"](collection, adjustCollection);
            return(adjustCollection);
        }
        /// <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));
        }
        /// <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));
        }
        /// <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));
        }
Example #7
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));
        }
Example #8
0
        public MainWindowDriver(dynamic window)
        {
            //必要な要素はここで取得する。
            var w = new WindowControl(window);

            this.LogicalTree = w.LogicalTree();

            this.Lhs    = new WPFTextBox(this.LogicalTree.ByBinding("Lhs").Single());
            this.Rhs    = new WPFTextBox(this.LogicalTree.ByBinding("Rhs").Single());
            this.Answer = new WPFTextBlock(this.LogicalTree.ByBinding("Answer").Single());

            var btns = this.LogicalTree.ByType <Button>();

            this.Add = new WPFButtonBase(btns[0]);

            this.Buttons = Enumerable.Range(0, btns.Count).Select(i => new WPFButtonBase(btns[i])).ToArray();
        }
        /// <summary>
        /// Search by Command from ButtonBase collection.
        /// </summary>
        /// <typeparam name="T">Type of collection.</typeparam>
        /// <param name="collection">ButtonBase collection.</param>
        /// <param name="command">Command.</param>
        /// <returns>Hit elements.</returns>
#else
        /// <summary>
        /// コマンドから要素を検索。
        /// </summary>
        /// <typeparam name="T">コレクションのタイプ。</typeparam>
        /// <param name="collection">DependencyObjectのコレクション。</param>
        /// <param name="command">コマンド。</param>
        /// <returns>ヒットした要素。</returns>
#endif
        public static IWPFDependencyObjectCollection <T> ByCommand <T>(IWPFDependencyObjectCollection <T> collection, RoutedCommand command) where T : ButtonBase
        {
            return(ByCommand(collection, command.OwnerType.FullName, command.Name));
        }
        /// <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, ExplicitAppVar commandParameter) where T : ButtonBase
        {
            return(ByCommandParameter(collection, (object)commandParameter));
        }
Example #11
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(this IWPFDependencyObjectCollection <DependencyObject> collection, string typeFullName)
        {
            return(Searcher.ByType(collection, typeFullName));
        }
Example #12
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>(this IWPFDependencyObjectCollection <T> collection, string contentText) where T : TextBlock
        => TextBlockSearcher.ByText <T>(collection, contentText);
Example #13
0
        /// <summary>
        /// Search by Type from DependencyObject collection.
        /// </summary>
        /// <typeparam name="T">Target type.</typeparam>
        /// <param name="collection">DependencyObject collection.</param>
        /// <returns>Hit elements.</returns>
#else
        /// <summary>
        /// タイプから要素を検索。
        /// </summary>
        /// <typeparam name="T">検索対象のタイプ。</typeparam>
        /// <param name="collection">DependencyObjectのコレクション。</param>
        /// <returns>ヒットした要素。</returns>
#endif
        public static IWPFDependencyObjectCollection <T> ByType <T>(IWPFDependencyObjectCollection <DependencyObject> collection) where T : DependencyObject
        {
            return(new WPFDependencyObjectCollection <T>((IAppVarOwner)ByType(collection, typeof(T).FullName)));
        }
        /// <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>(this IWPFDependencyObjectCollection <T> collection, object commandParameter) where T : ButtonBase
        {
            return(ButtonSearcher.ByCommandParameter <T>(collection, commandParameter));
        }
        /// <summary>
        /// Search by Command from ButtonBase collection.
        /// </summary>
        /// <typeparam name="T">Type of collection.</typeparam>
        /// <param name="collection">ButtonBase collection.</param>
        /// <param name="command">Command.</param>
        /// <returns>Hit elements.</returns>
#else
        /// <summary>
        /// コマンドから要素を検索。
        /// </summary>
        /// <typeparam name="T">コレクションのタイプ。</typeparam>
        /// <param name="collection">DependencyObjectのコレクション。</param>
        /// <param name="command">コマンド。</param>
        /// <returns>ヒットした要素。</returns>
#endif
        public static IWPFDependencyObjectCollection <T> ByCommand <T>(this IWPFDependencyObjectCollection <T> collection, RoutedCommand command) where T : ButtonBase
        {
            return(ButtonSearcher.ByCommand <T>(collection, command));
        }
        /// <summary>
        /// Search by Command from ButtonBase collection.
        /// </summary>
        /// <typeparam name="T">Type of collection.</typeparam>
        /// <param name="collection">ButtonBase collection.</param>
        /// <param name="ownerType">Owner type.</param>
        /// <param name="name">Name.</param>
        /// <returns>Hit elements.</returns>
#else
        /// <summary>
        /// コマンドから要素を検索。
        /// </summary>
        /// <typeparam name="T">コレクションのタイプ。</typeparam>
        /// <param name="collection">DependencyObjectのコレクション。</param>
        /// <param name="ownerType">オーナータイプ。</param>
        /// <param name="name">コマンド名。</param>
        /// <returns>ヒットした要素。</returns>
#endif
        public static IWPFDependencyObjectCollection <T> ByCommand <T>(this IWPFDependencyObjectCollection <T> collection, string ownerType, string name) where T : ButtonBase
        {
            return(ButtonSearcher.ByCommand <T>(collection, ownerType, name));
        }
        /// <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>(this IWPFDependencyObjectCollection <T> collection) where T : Button
        {
            return(ButtonSearcher.ByIsCancel <T>(collection));
        }
Example #18
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>(this IWPFDependencyObjectCollection <T> collection, string path, ExplicitAppVar dataItem = null) where T : DependencyObject
        {
            return(Searcher.ByBinding <T>(collection, path, dataItem));
        }
Example #19
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>(this IWPFDependencyObjectCollection <T> collection, string name) where T : FrameworkElement
        {
            return(FrameworkElementSearcher.ByName <T>(collection, name));
        }
Example #20
0
        /// <summary>
        /// Search by Type from DependencyObject collection.
        /// </summary>
        /// <typeparam name="T">Target type.</typeparam>
        /// <param name="collection">DependencyObject collection.</param>
        /// <returns>Hit elements.</returns>
#else
        /// <summary>
        /// タイプから要素を検索。
        /// </summary>
        /// <typeparam name="T">検索対象のタイプ。</typeparam>
        /// <param name="collection">DependencyObjectのコレクション。</param>
        /// <returns>ヒットした要素。</returns>
#endif
        public static IWPFDependencyObjectCollection <T> ByType <T>(this  IWPFDependencyObjectCollection <DependencyObject> collection) where T : DependencyObject
        {
            return(Searcher.ByType <T>(collection));
        }
        /// <summary>
        /// Search by Content.ToString() from ContentControl collection.
        /// </summary>
        /// <typeparam name="T">Type of collection.</typeparam>
        /// <param name="collection">ContentControl collection.</param>
        /// <param name="contentText">Content text.</param>
        /// <returns>Hit elements.</returns>
#else
        /// <summary>
        /// ContentをToString()で文字列化した文字列から要素を検索。
        /// </summary>
        /// <typeparam name="T">コレクションのタイプ。</typeparam>
        /// <param name="collection">DependencyObjectのコレクション。</param>
        /// <param name="contentText">文字列。</param>
        /// <returns>ヒットした要素。</returns>
#endif
        public static IWPFDependencyObjectCollection <T> ByContentText <T>(this IWPFDependencyObjectCollection <T> collection, string contentText) where T : ContentControl
        => ContentControlSearcher.ByContentText <T>(collection, contentText);