diff --git a/Borepin/Borepin.Android/Borepin.Android.csproj b/Borepin/Borepin.Android/Borepin.Android.csproj index afcad44..915748d 100644 --- a/Borepin/Borepin.Android/Borepin.Android.csproj +++ b/Borepin/Borepin.Android/Borepin.Android.csproj @@ -53,7 +53,10 @@ - + + 8.0.0.1909 + + @@ -94,4 +97,9 @@ + + + + + \ No newline at end of file diff --git a/Borepin/Borepin.Android/Resources/Resource.designer.cs b/Borepin/Borepin.Android/Resources/Resource.designer.cs index 1bc81a8..9ef43e5 100644 --- a/Borepin/Borepin.Android/Resources/Resource.designer.cs +++ b/Borepin/Borepin.Android/Resources/Resource.designer.cs @@ -575,6 +575,7 @@ namespace Borepin.Droid global::Xamarin.Forms.Platform.Android.Resource.Attribute.scrimAnimationDuration = global::Borepin.Droid.Resource.Attribute.scrimAnimationDuration; global::Xamarin.Forms.Platform.Android.Resource.Attribute.scrimBackground = global::Borepin.Droid.Resource.Attribute.scrimBackground; global::Xamarin.Forms.Platform.Android.Resource.Attribute.scrimVisibleHeightTrigger = global::Borepin.Droid.Resource.Attribute.scrimVisibleHeightTrigger; + global::Xamarin.Forms.Platform.Android.Resource.Attribute.scrollViewStyle = global::Borepin.Droid.Resource.Attribute.scrollViewStyle; global::Xamarin.Forms.Platform.Android.Resource.Attribute.searchHintIcon = global::Borepin.Droid.Resource.Attribute.searchHintIcon; global::Xamarin.Forms.Platform.Android.Resource.Attribute.searchIcon = global::Borepin.Droid.Resource.Attribute.searchIcon; global::Xamarin.Forms.Platform.Android.Resource.Attribute.searchViewStyle = global::Borepin.Droid.Resource.Attribute.searchViewStyle; @@ -1717,7 +1718,6 @@ namespace Borepin.Droid global::Xamarin.Forms.Platform.Android.Resource.Style.CardView = global::Borepin.Droid.Resource.Style.CardView; global::Xamarin.Forms.Platform.Android.Resource.Style.CardView_Dark = global::Borepin.Droid.Resource.Style.CardView_Dark; global::Xamarin.Forms.Platform.Android.Resource.Style.CardView_Light = global::Borepin.Droid.Resource.Style.CardView_Light; - global::Xamarin.Forms.Platform.Android.Resource.Style.collectionViewScrollBars = global::Borepin.Droid.Resource.Style.collectionViewScrollBars; global::Xamarin.Forms.Platform.Android.Resource.Style.collectionViewTheme = global::Borepin.Droid.Resource.Style.collectionViewTheme; global::Xamarin.Forms.Platform.Android.Resource.Style.MainTheme = global::Borepin.Droid.Resource.Style.MainTheme; global::Xamarin.Forms.Platform.Android.Resource.Style.MainTheme_Base = global::Borepin.Droid.Resource.Style.MainTheme_Base; @@ -1752,6 +1752,8 @@ namespace Borepin.Droid global::Xamarin.Forms.Platform.Android.Resource.Style.RtlOverlay_Widget_AppCompat_Search_DropDown_Text = global::Borepin.Droid.Resource.Style.RtlOverlay_Widget_AppCompat_Search_DropDown_Text; global::Xamarin.Forms.Platform.Android.Resource.Style.RtlUnderlay_Widget_AppCompat_ActionButton = global::Borepin.Droid.Resource.Style.RtlUnderlay_Widget_AppCompat_ActionButton; global::Xamarin.Forms.Platform.Android.Resource.Style.RtlUnderlay_Widget_AppCompat_ActionButton_Overflow = global::Borepin.Droid.Resource.Style.RtlUnderlay_Widget_AppCompat_ActionButton_Overflow; + global::Xamarin.Forms.Platform.Android.Resource.Style.scrollViewScrollBars = global::Borepin.Droid.Resource.Style.scrollViewScrollBars; + global::Xamarin.Forms.Platform.Android.Resource.Style.scrollViewTheme = global::Borepin.Droid.Resource.Style.scrollViewTheme; global::Xamarin.Forms.Platform.Android.Resource.Style.TextAppearance_AppCompat = global::Borepin.Droid.Resource.Style.TextAppearance_AppCompat; global::Xamarin.Forms.Platform.Android.Resource.Style.TextAppearance_AppCompat_Body1 = global::Borepin.Droid.Resource.Style.TextAppearance_AppCompat_Body1; global::Xamarin.Forms.Platform.Android.Resource.Style.TextAppearance_AppCompat_Body2 = global::Borepin.Droid.Resource.Style.TextAppearance_AppCompat_Body2; @@ -2601,6 +2603,8 @@ namespace Borepin.Droid global::Xamarin.Forms.Platform.Android.Resource.Styleable.ScrimInsetsFrameLayout_insetForeground = global::Borepin.Droid.Resource.Styleable.ScrimInsetsFrameLayout_insetForeground; global::Xamarin.Forms.Platform.Android.Resource.Styleable.ScrollingViewBehavior_Layout = global::Borepin.Droid.Resource.Styleable.ScrollingViewBehavior_Layout; global::Xamarin.Forms.Platform.Android.Resource.Styleable.ScrollingViewBehavior_Layout_behavior_overlapTop = global::Borepin.Droid.Resource.Styleable.ScrollingViewBehavior_Layout_behavior_overlapTop; + global::Xamarin.Forms.Platform.Android.Resource.Styleable.ScrollViewRendererTheme = global::Borepin.Droid.Resource.Styleable.ScrollViewRendererTheme; + global::Xamarin.Forms.Platform.Android.Resource.Styleable.ScrollViewRendererTheme_scrollViewStyle = global::Borepin.Droid.Resource.Styleable.ScrollViewRendererTheme_scrollViewStyle; global::Xamarin.Forms.Platform.Android.Resource.Styleable.SearchView = global::Borepin.Droid.Resource.Styleable.SearchView; global::Xamarin.Forms.Platform.Android.Resource.Styleable.SearchView_android_focusable = global::Borepin.Droid.Resource.Styleable.SearchView_android_focusable; global::Xamarin.Forms.Platform.Android.Resource.Styleable.SearchView_android_imeOptions = global::Borepin.Droid.Resource.Styleable.SearchView_android_imeOptions; @@ -3145,6 +3149,7 @@ namespace Borepin.Droid global::Xamarin.Forms.Platform.Resource.Attribute.scrimAnimationDuration = global::Borepin.Droid.Resource.Attribute.scrimAnimationDuration; global::Xamarin.Forms.Platform.Resource.Attribute.scrimBackground = global::Borepin.Droid.Resource.Attribute.scrimBackground; global::Xamarin.Forms.Platform.Resource.Attribute.scrimVisibleHeightTrigger = global::Borepin.Droid.Resource.Attribute.scrimVisibleHeightTrigger; + global::Xamarin.Forms.Platform.Resource.Attribute.scrollViewStyle = global::Borepin.Droid.Resource.Attribute.scrollViewStyle; global::Xamarin.Forms.Platform.Resource.Attribute.searchHintIcon = global::Borepin.Droid.Resource.Attribute.searchHintIcon; global::Xamarin.Forms.Platform.Resource.Attribute.searchIcon = global::Borepin.Droid.Resource.Attribute.searchIcon; global::Xamarin.Forms.Platform.Resource.Attribute.searchViewStyle = global::Borepin.Droid.Resource.Attribute.searchViewStyle; @@ -4287,7 +4292,6 @@ namespace Borepin.Droid global::Xamarin.Forms.Platform.Resource.Style.CardView = global::Borepin.Droid.Resource.Style.CardView; global::Xamarin.Forms.Platform.Resource.Style.CardView_Dark = global::Borepin.Droid.Resource.Style.CardView_Dark; global::Xamarin.Forms.Platform.Resource.Style.CardView_Light = global::Borepin.Droid.Resource.Style.CardView_Light; - global::Xamarin.Forms.Platform.Resource.Style.collectionViewScrollBars = global::Borepin.Droid.Resource.Style.collectionViewScrollBars; global::Xamarin.Forms.Platform.Resource.Style.collectionViewTheme = global::Borepin.Droid.Resource.Style.collectionViewTheme; global::Xamarin.Forms.Platform.Resource.Style.MainTheme = global::Borepin.Droid.Resource.Style.MainTheme; global::Xamarin.Forms.Platform.Resource.Style.MainTheme_Base = global::Borepin.Droid.Resource.Style.MainTheme_Base; @@ -4322,6 +4326,8 @@ namespace Borepin.Droid global::Xamarin.Forms.Platform.Resource.Style.RtlOverlay_Widget_AppCompat_Search_DropDown_Text = global::Borepin.Droid.Resource.Style.RtlOverlay_Widget_AppCompat_Search_DropDown_Text; global::Xamarin.Forms.Platform.Resource.Style.RtlUnderlay_Widget_AppCompat_ActionButton = global::Borepin.Droid.Resource.Style.RtlUnderlay_Widget_AppCompat_ActionButton; global::Xamarin.Forms.Platform.Resource.Style.RtlUnderlay_Widget_AppCompat_ActionButton_Overflow = global::Borepin.Droid.Resource.Style.RtlUnderlay_Widget_AppCompat_ActionButton_Overflow; + global::Xamarin.Forms.Platform.Resource.Style.scrollViewScrollBars = global::Borepin.Droid.Resource.Style.scrollViewScrollBars; + global::Xamarin.Forms.Platform.Resource.Style.scrollViewTheme = global::Borepin.Droid.Resource.Style.scrollViewTheme; global::Xamarin.Forms.Platform.Resource.Style.TextAppearance_AppCompat = global::Borepin.Droid.Resource.Style.TextAppearance_AppCompat; global::Xamarin.Forms.Platform.Resource.Style.TextAppearance_AppCompat_Body1 = global::Borepin.Droid.Resource.Style.TextAppearance_AppCompat_Body1; global::Xamarin.Forms.Platform.Resource.Style.TextAppearance_AppCompat_Body2 = global::Borepin.Droid.Resource.Style.TextAppearance_AppCompat_Body2; @@ -5171,6 +5177,8 @@ namespace Borepin.Droid global::Xamarin.Forms.Platform.Resource.Styleable.ScrimInsetsFrameLayout_insetForeground = global::Borepin.Droid.Resource.Styleable.ScrimInsetsFrameLayout_insetForeground; global::Xamarin.Forms.Platform.Resource.Styleable.ScrollingViewBehavior_Layout = global::Borepin.Droid.Resource.Styleable.ScrollingViewBehavior_Layout; global::Xamarin.Forms.Platform.Resource.Styleable.ScrollingViewBehavior_Layout_behavior_overlapTop = global::Borepin.Droid.Resource.Styleable.ScrollingViewBehavior_Layout_behavior_overlapTop; + global::Xamarin.Forms.Platform.Resource.Styleable.ScrollViewRendererTheme = global::Borepin.Droid.Resource.Styleable.ScrollViewRendererTheme; + global::Xamarin.Forms.Platform.Resource.Styleable.ScrollViewRendererTheme_scrollViewStyle = global::Borepin.Droid.Resource.Styleable.ScrollViewRendererTheme_scrollViewStyle; global::Xamarin.Forms.Platform.Resource.Styleable.SearchView = global::Borepin.Droid.Resource.Styleable.SearchView; global::Xamarin.Forms.Platform.Resource.Styleable.SearchView_android_focusable = global::Borepin.Droid.Resource.Styleable.SearchView_android_focusable; global::Xamarin.Forms.Platform.Resource.Styleable.SearchView_android_imeOptions = global::Borepin.Droid.Resource.Styleable.SearchView_android_imeOptions; @@ -6483,424 +6491,427 @@ namespace Borepin.Droid public const int scrimVisibleHeightTrigger = 2130903377; // aapt resource value: 0x7F030152 - public const int searchHintIcon = 2130903378; + public const int scrollViewStyle = 2130903378; // aapt resource value: 0x7F030153 - public const int searchIcon = 2130903379; + public const int searchHintIcon = 2130903379; // aapt resource value: 0x7F030154 - public const int searchViewStyle = 2130903380; + public const int searchIcon = 2130903380; // aapt resource value: 0x7F030155 - public const int seekBarStyle = 2130903381; + public const int searchViewStyle = 2130903381; // aapt resource value: 0x7F030156 - public const int selectableItemBackground = 2130903382; + public const int seekBarStyle = 2130903382; // aapt resource value: 0x7F030157 - public const int selectableItemBackgroundBorderless = 2130903383; + public const int selectableItemBackground = 2130903383; // aapt resource value: 0x7F030158 - public const int showAsAction = 2130903384; + public const int selectableItemBackgroundBorderless = 2130903384; // aapt resource value: 0x7F030159 - public const int showDividers = 2130903385; + public const int showAsAction = 2130903385; // aapt resource value: 0x7F03015A - public const int showMotionSpec = 2130903386; + public const int showDividers = 2130903386; // aapt resource value: 0x7F03015B - public const int showText = 2130903387; + public const int showMotionSpec = 2130903387; // aapt resource value: 0x7F03015C - public const int showTitle = 2130903388; + public const int showText = 2130903388; // aapt resource value: 0x7F03015D - public const int singleChoiceItemLayout = 2130903389; + public const int showTitle = 2130903389; // aapt resource value: 0x7F03015E - public const int singleLine = 2130903390; + public const int singleChoiceItemLayout = 2130903390; // aapt resource value: 0x7F03015F - public const int singleSelection = 2130903391; + public const int singleLine = 2130903391; // aapt resource value: 0x7F030160 - public const int snackbarButtonStyle = 2130903392; + public const int singleSelection = 2130903392; // aapt resource value: 0x7F030161 - public const int snackbarStyle = 2130903393; + public const int snackbarButtonStyle = 2130903393; // aapt resource value: 0x7F030162 - public const int spanCount = 2130903394; + public const int snackbarStyle = 2130903394; // aapt resource value: 0x7F030163 - public const int spinBars = 2130903395; + public const int spanCount = 2130903395; // aapt resource value: 0x7F030164 - public const int spinnerDropDownItemStyle = 2130903396; + public const int spinBars = 2130903396; // aapt resource value: 0x7F030165 - public const int spinnerStyle = 2130903397; + public const int spinnerDropDownItemStyle = 2130903397; // aapt resource value: 0x7F030166 - public const int splitTrack = 2130903398; + public const int spinnerStyle = 2130903398; // aapt resource value: 0x7F030167 - public const int srcCompat = 2130903399; + public const int splitTrack = 2130903399; // aapt resource value: 0x7F030168 - public const int stackFromEnd = 2130903400; + public const int srcCompat = 2130903400; // aapt resource value: 0x7F030169 - public const int state_above_anchor = 2130903401; + public const int stackFromEnd = 2130903401; // aapt resource value: 0x7F03016A - public const int state_collapsed = 2130903402; + public const int state_above_anchor = 2130903402; // aapt resource value: 0x7F03016B - public const int state_collapsible = 2130903403; + public const int state_collapsed = 2130903403; // aapt resource value: 0x7F03016C - public const int state_liftable = 2130903404; + public const int state_collapsible = 2130903404; // aapt resource value: 0x7F03016D - public const int state_lifted = 2130903405; + public const int state_liftable = 2130903405; // aapt resource value: 0x7F03016E - public const int statusBarBackground = 2130903406; + public const int state_lifted = 2130903406; // aapt resource value: 0x7F03016F - public const int statusBarScrim = 2130903407; + public const int statusBarBackground = 2130903407; // aapt resource value: 0x7F030170 - public const int strokeColor = 2130903408; + public const int statusBarScrim = 2130903408; // aapt resource value: 0x7F030171 - public const int strokeWidth = 2130903409; + public const int strokeColor = 2130903409; // aapt resource value: 0x7F030172 - public const int subMenuArrow = 2130903410; + public const int strokeWidth = 2130903410; // aapt resource value: 0x7F030173 - public const int submitBackground = 2130903411; + public const int subMenuArrow = 2130903411; // aapt resource value: 0x7F030174 - public const int subtitle = 2130903412; + public const int submitBackground = 2130903412; // aapt resource value: 0x7F030175 - public const int subtitleTextAppearance = 2130903413; + public const int subtitle = 2130903413; // aapt resource value: 0x7F030176 - public const int subtitleTextColor = 2130903414; + public const int subtitleTextAppearance = 2130903414; // aapt resource value: 0x7F030177 - public const int subtitleTextStyle = 2130903415; + public const int subtitleTextColor = 2130903415; // aapt resource value: 0x7F030178 - public const int suggestionRowLayout = 2130903416; + public const int subtitleTextStyle = 2130903416; // aapt resource value: 0x7F030179 - public const int switchMinWidth = 2130903417; + public const int suggestionRowLayout = 2130903417; // aapt resource value: 0x7F03017A - public const int switchPadding = 2130903418; + public const int switchMinWidth = 2130903418; // aapt resource value: 0x7F03017B - public const int switchStyle = 2130903419; + public const int switchPadding = 2130903419; // aapt resource value: 0x7F03017C - public const int switchTextAppearance = 2130903420; + public const int switchStyle = 2130903420; // aapt resource value: 0x7F03017D - public const int tabBackground = 2130903421; + public const int switchTextAppearance = 2130903421; // aapt resource value: 0x7F03017E - public const int tabContentStart = 2130903422; + public const int tabBackground = 2130903422; // aapt resource value: 0x7F03017F - public const int tabGravity = 2130903423; + public const int tabContentStart = 2130903423; // aapt resource value: 0x7F030180 - public const int tabIconTint = 2130903424; + public const int tabGravity = 2130903424; // aapt resource value: 0x7F030181 - public const int tabIconTintMode = 2130903425; + public const int tabIconTint = 2130903425; // aapt resource value: 0x7F030182 - public const int tabIndicator = 2130903426; + public const int tabIconTintMode = 2130903426; // aapt resource value: 0x7F030183 - public const int tabIndicatorAnimationDuration = 2130903427; + public const int tabIndicator = 2130903427; // aapt resource value: 0x7F030184 - public const int tabIndicatorColor = 2130903428; + public const int tabIndicatorAnimationDuration = 2130903428; // aapt resource value: 0x7F030185 - public const int tabIndicatorFullWidth = 2130903429; + public const int tabIndicatorColor = 2130903429; // aapt resource value: 0x7F030186 - public const int tabIndicatorGravity = 2130903430; + public const int tabIndicatorFullWidth = 2130903430; // aapt resource value: 0x7F030187 - public const int tabIndicatorHeight = 2130903431; + public const int tabIndicatorGravity = 2130903431; // aapt resource value: 0x7F030188 - public const int tabInlineLabel = 2130903432; + public const int tabIndicatorHeight = 2130903432; // aapt resource value: 0x7F030189 - public const int tabMaxWidth = 2130903433; + public const int tabInlineLabel = 2130903433; // aapt resource value: 0x7F03018A - public const int tabMinWidth = 2130903434; + public const int tabMaxWidth = 2130903434; // aapt resource value: 0x7F03018B - public const int tabMode = 2130903435; + public const int tabMinWidth = 2130903435; // aapt resource value: 0x7F03018C - public const int tabPadding = 2130903436; + public const int tabMode = 2130903436; // aapt resource value: 0x7F03018D - public const int tabPaddingBottom = 2130903437; + public const int tabPadding = 2130903437; // aapt resource value: 0x7F03018E - public const int tabPaddingEnd = 2130903438; + public const int tabPaddingBottom = 2130903438; // aapt resource value: 0x7F03018F - public const int tabPaddingStart = 2130903439; + public const int tabPaddingEnd = 2130903439; // aapt resource value: 0x7F030190 - public const int tabPaddingTop = 2130903440; + public const int tabPaddingStart = 2130903440; // aapt resource value: 0x7F030191 - public const int tabRippleColor = 2130903441; + public const int tabPaddingTop = 2130903441; // aapt resource value: 0x7F030192 - public const int tabSelectedTextColor = 2130903442; + public const int tabRippleColor = 2130903442; // aapt resource value: 0x7F030193 - public const int tabStyle = 2130903443; + public const int tabSelectedTextColor = 2130903443; // aapt resource value: 0x7F030194 - public const int tabTextAppearance = 2130903444; + public const int tabStyle = 2130903444; // aapt resource value: 0x7F030195 - public const int tabTextColor = 2130903445; + public const int tabTextAppearance = 2130903445; // aapt resource value: 0x7F030196 - public const int tabUnboundedRipple = 2130903446; + public const int tabTextColor = 2130903446; // aapt resource value: 0x7F030197 - public const int textAllCaps = 2130903447; + public const int tabUnboundedRipple = 2130903447; // aapt resource value: 0x7F030198 - public const int textAppearanceBody1 = 2130903448; + public const int textAllCaps = 2130903448; // aapt resource value: 0x7F030199 - public const int textAppearanceBody2 = 2130903449; + public const int textAppearanceBody1 = 2130903449; // aapt resource value: 0x7F03019A - public const int textAppearanceButton = 2130903450; + public const int textAppearanceBody2 = 2130903450; // aapt resource value: 0x7F03019B - public const int textAppearanceCaption = 2130903451; + public const int textAppearanceButton = 2130903451; // aapt resource value: 0x7F03019C - public const int textAppearanceHeadline1 = 2130903452; + public const int textAppearanceCaption = 2130903452; // aapt resource value: 0x7F03019D - public const int textAppearanceHeadline2 = 2130903453; + public const int textAppearanceHeadline1 = 2130903453; // aapt resource value: 0x7F03019E - public const int textAppearanceHeadline3 = 2130903454; + public const int textAppearanceHeadline2 = 2130903454; // aapt resource value: 0x7F03019F - public const int textAppearanceHeadline4 = 2130903455; + public const int textAppearanceHeadline3 = 2130903455; // aapt resource value: 0x7F0301A0 - public const int textAppearanceHeadline5 = 2130903456; + public const int textAppearanceHeadline4 = 2130903456; // aapt resource value: 0x7F0301A1 - public const int textAppearanceHeadline6 = 2130903457; + public const int textAppearanceHeadline5 = 2130903457; // aapt resource value: 0x7F0301A2 - public const int textAppearanceLargePopupMenu = 2130903458; + public const int textAppearanceHeadline6 = 2130903458; // aapt resource value: 0x7F0301A3 - public const int textAppearanceListItem = 2130903459; + public const int textAppearanceLargePopupMenu = 2130903459; // aapt resource value: 0x7F0301A4 - public const int textAppearanceListItemSecondary = 2130903460; + public const int textAppearanceListItem = 2130903460; // aapt resource value: 0x7F0301A5 - public const int textAppearanceListItemSmall = 2130903461; + public const int textAppearanceListItemSecondary = 2130903461; // aapt resource value: 0x7F0301A6 - public const int textAppearanceOverline = 2130903462; + public const int textAppearanceListItemSmall = 2130903462; // aapt resource value: 0x7F0301A7 - public const int textAppearancePopupMenuHeader = 2130903463; + public const int textAppearanceOverline = 2130903463; // aapt resource value: 0x7F0301A8 - public const int textAppearanceSearchResultSubtitle = 2130903464; + public const int textAppearancePopupMenuHeader = 2130903464; // aapt resource value: 0x7F0301A9 - public const int textAppearanceSearchResultTitle = 2130903465; + public const int textAppearanceSearchResultSubtitle = 2130903465; // aapt resource value: 0x7F0301AA - public const int textAppearanceSmallPopupMenu = 2130903466; + public const int textAppearanceSearchResultTitle = 2130903466; // aapt resource value: 0x7F0301AB - public const int textAppearanceSubtitle1 = 2130903467; + public const int textAppearanceSmallPopupMenu = 2130903467; // aapt resource value: 0x7F0301AC - public const int textAppearanceSubtitle2 = 2130903468; + public const int textAppearanceSubtitle1 = 2130903468; // aapt resource value: 0x7F0301AD - public const int textColorAlertDialogListItem = 2130903469; + public const int textAppearanceSubtitle2 = 2130903469; // aapt resource value: 0x7F0301AE - public const int textColorSearchUrl = 2130903470; + public const int textColorAlertDialogListItem = 2130903470; // aapt resource value: 0x7F0301AF - public const int textEndPadding = 2130903471; + public const int textColorSearchUrl = 2130903471; // aapt resource value: 0x7F0301B0 - public const int textInputStyle = 2130903472; + public const int textEndPadding = 2130903472; // aapt resource value: 0x7F0301B1 - public const int textStartPadding = 2130903473; + public const int textInputStyle = 2130903473; // aapt resource value: 0x7F0301B2 - public const int theme = 2130903474; + public const int textStartPadding = 2130903474; // aapt resource value: 0x7F0301B3 - public const int thickness = 2130903475; + public const int theme = 2130903475; // aapt resource value: 0x7F0301B4 - public const int thumbTextPadding = 2130903476; + public const int thickness = 2130903476; // aapt resource value: 0x7F0301B5 - public const int thumbTint = 2130903477; + public const int thumbTextPadding = 2130903477; // aapt resource value: 0x7F0301B6 - public const int thumbTintMode = 2130903478; + public const int thumbTint = 2130903478; // aapt resource value: 0x7F0301B7 - public const int tickMark = 2130903479; + public const int thumbTintMode = 2130903479; // aapt resource value: 0x7F0301B8 - public const int tickMarkTint = 2130903480; + public const int tickMark = 2130903480; // aapt resource value: 0x7F0301B9 - public const int tickMarkTintMode = 2130903481; + public const int tickMarkTint = 2130903481; // aapt resource value: 0x7F0301BA - public const int tint = 2130903482; + public const int tickMarkTintMode = 2130903482; // aapt resource value: 0x7F0301BB - public const int tintMode = 2130903483; + public const int tint = 2130903483; // aapt resource value: 0x7F0301BC - public const int title = 2130903484; + public const int tintMode = 2130903484; // aapt resource value: 0x7F0301BD - public const int titleEnabled = 2130903485; + public const int title = 2130903485; // aapt resource value: 0x7F0301BE - public const int titleMargin = 2130903486; + public const int titleEnabled = 2130903486; // aapt resource value: 0x7F0301BF - public const int titleMarginBottom = 2130903487; + public const int titleMargin = 2130903487; // aapt resource value: 0x7F0301C0 - public const int titleMarginEnd = 2130903488; - - // aapt resource value: 0x7F0301C3 - public const int titleMargins = 2130903491; + public const int titleMarginBottom = 2130903488; // aapt resource value: 0x7F0301C1 - public const int titleMarginStart = 2130903489; - - // aapt resource value: 0x7F0301C2 - public const int titleMarginTop = 2130903490; + public const int titleMarginEnd = 2130903489; // aapt resource value: 0x7F0301C4 - public const int titleTextAppearance = 2130903492; + public const int titleMargins = 2130903492; + + // aapt resource value: 0x7F0301C2 + public const int titleMarginStart = 2130903490; + + // aapt resource value: 0x7F0301C3 + public const int titleMarginTop = 2130903491; // aapt resource value: 0x7F0301C5 - public const int titleTextColor = 2130903493; + public const int titleTextAppearance = 2130903493; // aapt resource value: 0x7F0301C6 - public const int titleTextStyle = 2130903494; + public const int titleTextColor = 2130903494; // aapt resource value: 0x7F0301C7 - public const int toolbarId = 2130903495; + public const int titleTextStyle = 2130903495; // aapt resource value: 0x7F0301C8 - public const int toolbarNavigationButtonStyle = 2130903496; + public const int toolbarId = 2130903496; // aapt resource value: 0x7F0301C9 - public const int toolbarStyle = 2130903497; + public const int toolbarNavigationButtonStyle = 2130903497; // aapt resource value: 0x7F0301CA - public const int tooltipForegroundColor = 2130903498; + public const int toolbarStyle = 2130903498; // aapt resource value: 0x7F0301CB - public const int tooltipFrameBackground = 2130903499; + public const int tooltipForegroundColor = 2130903499; // aapt resource value: 0x7F0301CC - public const int tooltipText = 2130903500; + public const int tooltipFrameBackground = 2130903500; // aapt resource value: 0x7F0301CD - public const int track = 2130903501; + public const int tooltipText = 2130903501; // aapt resource value: 0x7F0301CE - public const int trackTint = 2130903502; + public const int track = 2130903502; // aapt resource value: 0x7F0301CF - public const int trackTintMode = 2130903503; + public const int trackTint = 2130903503; // aapt resource value: 0x7F0301D0 - public const int ttcIndex = 2130903504; + public const int trackTintMode = 2130903504; // aapt resource value: 0x7F0301D1 - public const int useCompatPadding = 2130903505; + public const int ttcIndex = 2130903505; // aapt resource value: 0x7F0301D2 - public const int viewInflaterClass = 2130903506; + public const int useCompatPadding = 2130903506; // aapt resource value: 0x7F0301D3 - public const int voiceIcon = 2130903507; + public const int viewInflaterClass = 2130903507; // aapt resource value: 0x7F0301D4 - public const int windowActionBar = 2130903508; + public const int voiceIcon = 2130903508; // aapt resource value: 0x7F0301D5 - public const int windowActionBarOverlay = 2130903509; + public const int windowActionBar = 2130903509; // aapt resource value: 0x7F0301D6 - public const int windowActionModeOverlay = 2130903510; + public const int windowActionBarOverlay = 2130903510; // aapt resource value: 0x7F0301D7 - public const int windowFixedHeightMajor = 2130903511; + public const int windowActionModeOverlay = 2130903511; // aapt resource value: 0x7F0301D8 - public const int windowFixedHeightMinor = 2130903512; + public const int windowFixedHeightMajor = 2130903512; // aapt resource value: 0x7F0301D9 - public const int windowFixedWidthMajor = 2130903513; + public const int windowFixedHeightMinor = 2130903513; // aapt resource value: 0x7F0301DA - public const int windowFixedWidthMinor = 2130903514; + public const int windowFixedWidthMajor = 2130903514; // aapt resource value: 0x7F0301DB - public const int windowMinWidthMajor = 2130903515; + public const int windowFixedWidthMinor = 2130903515; // aapt resource value: 0x7F0301DC - public const int windowMinWidthMinor = 2130903516; + public const int windowMinWidthMajor = 2130903516; // aapt resource value: 0x7F0301DD - public const int windowNoTitle = 2130903517; + public const int windowMinWidthMinor = 2130903517; + + // aapt resource value: 0x7F0301DE + public const int windowNoTitle = 2130903518; static Attribute() { @@ -10124,10 +10135,7 @@ namespace Borepin.Droid public const int CardView_Light = 2131624133; // aapt resource value: 0x7F0E01F7 - public const int collectionViewScrollBars = 2131624439; - - // aapt resource value: 0x7F0E01F8 - public const int collectionViewTheme = 2131624440; + public const int collectionViewTheme = 2131624439; // aapt resource value: 0x7F0E00C6 public const int MainTheme = 2131624134; @@ -10228,6 +10236,12 @@ namespace Borepin.Droid // aapt resource value: 0x7F0E00E6 public const int RtlUnderlay_Widget_AppCompat_ActionButton_Overflow = 2131624166; + // aapt resource value: 0x7F0E01F8 + public const int scrollViewScrollBars = 2131624440; + + // aapt resource value: 0x7F0E01F9 + public const int scrollViewTheme = 2131624441; + // aapt resource value: 0x7F0E00E7 public const int TextAppearance_AppCompat = 2131624167; @@ -11057,7 +11071,7 @@ namespace Borepin.Droid public partial class Styleable { - // aapt resource value: { 0x7F030031,0x7F030032,0x7F030033,0x7F030092,0x7F030093,0x7F030094,0x7F030095,0x7F030096,0x7F030097,0x7F0300A5,0x7F0300AA,0x7F0300AB,0x7F0300B6,0x7F0300E0,0x7F0300E5,0x7F0300EA,0x7F0300EB,0x7F0300ED,0x7F0300F7,0x7F030101,0x7F030124,0x7F030130,0x7F030141,0x7F030145,0x7F030146,0x7F030174,0x7F030177,0x7F0301BC,0x7F0301C6 } + // aapt resource value: { 0x7F030031,0x7F030032,0x7F030033,0x7F030092,0x7F030093,0x7F030094,0x7F030095,0x7F030096,0x7F030097,0x7F0300A5,0x7F0300AA,0x7F0300AB,0x7F0300B6,0x7F0300E0,0x7F0300E5,0x7F0300EA,0x7F0300EB,0x7F0300ED,0x7F0300F7,0x7F030101,0x7F030124,0x7F030130,0x7F030141,0x7F030145,0x7F030146,0x7F030175,0x7F030178,0x7F0301BD,0x7F0301C7 } public static int[] ActionBar = new int[] { 2130903089, 2130903090, @@ -11084,10 +11098,10 @@ namespace Borepin.Droid 2130903361, 2130903365, 2130903366, - 2130903412, - 2130903415, - 2130903484, - 2130903494}; + 2130903413, + 2130903416, + 2130903485, + 2130903495}; // aapt resource value: { 0x10100B3 } public static int[] ActionBarLayout = new int[] { @@ -11194,14 +11208,14 @@ namespace Borepin.Droid public static int[] ActionMenuView = new int[] { -1}; - // aapt resource value: { 0x7F030031,0x7F030032,0x7F03007E,0x7F0300E0,0x7F030177,0x7F0301C6 } + // aapt resource value: { 0x7F030031,0x7F030032,0x7F03007E,0x7F0300E0,0x7F030178,0x7F0301C7 } public static int[] ActionMode = new int[] { 2130903089, 2130903090, 2130903166, 2130903264, - 2130903415, - 2130903494}; + 2130903416, + 2130903495}; // aapt resource value: 0 public const int ActionMode_background = 0; @@ -11232,7 +11246,7 @@ namespace Borepin.Droid // aapt resource value: 1 public const int ActivityChooserView_initialActivityCount = 1; - // aapt resource value: { 0x10100F2,0x7F030052,0x7F030053,0x7F03011B,0x7F03011C,0x7F03012D,0x7F03015C,0x7F03015D } + // aapt resource value: { 0x10100F2,0x7F030052,0x7F030053,0x7F03011B,0x7F03011C,0x7F03012D,0x7F03015D,0x7F03015E } public static int[] AlertDialog = new int[] { 16842994, 2130903122, @@ -11240,8 +11254,8 @@ namespace Borepin.Droid 2130903323, 2130903324, 2130903341, - 2130903388, - 2130903389}; + 2130903389, + 2130903390}; // aapt resource value: 0 public const int AlertDialog_android_layout = 0; @@ -11333,12 +11347,12 @@ namespace Borepin.Droid 2130903228, 2130903318}; - // aapt resource value: { 0x7F03016A,0x7F03016B,0x7F03016C,0x7F03016D } + // aapt resource value: { 0x7F03016B,0x7F03016C,0x7F03016D,0x7F03016E } public static int[] AppBarLayoutStates = new int[] { - 2130903402, 2130903403, 2130903404, - 2130903405}; + 2130903405, + 2130903406}; // aapt resource value: 0 public const int AppBarLayoutStates_state_collapsed = 0; @@ -11381,12 +11395,12 @@ namespace Borepin.Droid // aapt resource value: 5 public const int AppBarLayout_liftOnScroll = 5; - // aapt resource value: { 0x1010119,0x7F030167,0x7F0301BA,0x7F0301BB } + // aapt resource value: { 0x1010119,0x7F030168,0x7F0301BB,0x7F0301BC } public static int[] AppCompatImageView = new int[] { 16843033, - 2130903399, - 2130903482, - 2130903483}; + 2130903400, + 2130903483, + 2130903484}; // aapt resource value: 0 public const int AppCompatImageView_android_src = 0; @@ -11400,12 +11414,12 @@ namespace Borepin.Droid // aapt resource value: 3 public const int AppCompatImageView_tintMode = 3; - // aapt resource value: { 0x1010142,0x7F0301B7,0x7F0301B8,0x7F0301B9 } + // aapt resource value: { 0x1010142,0x7F0301B8,0x7F0301B9,0x7F0301BA } public static int[] AppCompatSeekBar = new int[] { 16843074, - 2130903479, 2130903480, - 2130903481}; + 2130903481, + 2130903482}; // aapt resource value: 0 public const int AppCompatSeekBar_android_thumb = 0; @@ -11450,7 +11464,7 @@ namespace Borepin.Droid // aapt resource value: 0 public const int AppCompatTextHelper_android_textAppearance = 0; - // aapt resource value: { 0x1010034,0x7F03002C,0x7F03002D,0x7F03002E,0x7F03002F,0x7F030030,0x7F0300CF,0x7F0300D2,0x7F030109,0x7F030117,0x7F030197 } + // aapt resource value: { 0x1010034,0x7F03002C,0x7F03002D,0x7F03002E,0x7F03002F,0x7F030030,0x7F0300CF,0x7F0300D2,0x7F030109,0x7F030117,0x7F030198 } public static int[] AppCompatTextView = new int[] { 16842804, 2130903084, @@ -11462,7 +11476,7 @@ namespace Borepin.Droid 2130903250, 2130903305, 2130903319, - 2130903447}; + 2130903448}; // aapt resource value: 0 public const int AppCompatTextView_android_textAppearance = 0; @@ -11497,7 +11511,7 @@ namespace Borepin.Droid // aapt resource value: 10 public const int AppCompatTextView_textAllCaps = 10; - // aapt resource value: { 0x1010057,0x10100AE,0x7F030000,0x7F030001,0x7F030002,0x7F030003,0x7F030004,0x7F030005,0x7F030006,0x7F030007,0x7F030008,0x7F030009,0x7F03000A,0x7F03000B,0x7F03000C,0x7F03000E,0x7F03000F,0x7F030010,0x7F030011,0x7F030012,0x7F030013,0x7F030014,0x7F030015,0x7F030016,0x7F030017,0x7F030018,0x7F030019,0x7F03001A,0x7F03001B,0x7F03001C,0x7F03001D,0x7F03001E,0x7F030021,0x7F030022,0x7F030023,0x7F030024,0x7F030025,0x7F03002B,0x7F03003E,0x7F03004C,0x7F03004D,0x7F03004E,0x7F03004F,0x7F030050,0x7F030054,0x7F030055,0x7F03005F,0x7F030064,0x7F030085,0x7F030086,0x7F030087,0x7F030088,0x7F030089,0x7F03008A,0x7F03008B,0x7F03008C,0x7F03008D,0x7F03008F,0x7F03009E,0x7F0300A7,0x7F0300A8,0x7F0300A9,0x7F0300AC,0x7F0300AE,0x7F0300B1,0x7F0300B2,0x7F0300B3,0x7F0300B4,0x7F0300B5,0x7F0300EA,0x7F0300F6,0x7F030119,0x7F03011A,0x7F03011D,0x7F03011E,0x7F03011F,0x7F030120,0x7F030121,0x7F030122,0x7F030123,0x7F030138,0x7F030139,0x7F03013A,0x7F030140,0x7F030142,0x7F030149,0x7F03014A,0x7F03014B,0x7F03014C,0x7F030154,0x7F030155,0x7F030156,0x7F030157,0x7F030164,0x7F030165,0x7F03017B,0x7F0301A2,0x7F0301A3,0x7F0301A4,0x7F0301A5,0x7F0301A7,0x7F0301A8,0x7F0301A9,0x7F0301AA,0x7F0301AD,0x7F0301AE,0x7F0301C8,0x7F0301C9,0x7F0301CA,0x7F0301CB,0x7F0301D2,0x7F0301D4,0x7F0301D5,0x7F0301D6,0x7F0301D7,0x7F0301D8,0x7F0301D9,0x7F0301DA,0x7F0301DB,0x7F0301DC,0x7F0301DD } + // aapt resource value: { 0x1010057,0x10100AE,0x7F030000,0x7F030001,0x7F030002,0x7F030003,0x7F030004,0x7F030005,0x7F030006,0x7F030007,0x7F030008,0x7F030009,0x7F03000A,0x7F03000B,0x7F03000C,0x7F03000E,0x7F03000F,0x7F030010,0x7F030011,0x7F030012,0x7F030013,0x7F030014,0x7F030015,0x7F030016,0x7F030017,0x7F030018,0x7F030019,0x7F03001A,0x7F03001B,0x7F03001C,0x7F03001D,0x7F03001E,0x7F030021,0x7F030022,0x7F030023,0x7F030024,0x7F030025,0x7F03002B,0x7F03003E,0x7F03004C,0x7F03004D,0x7F03004E,0x7F03004F,0x7F030050,0x7F030054,0x7F030055,0x7F03005F,0x7F030064,0x7F030085,0x7F030086,0x7F030087,0x7F030088,0x7F030089,0x7F03008A,0x7F03008B,0x7F03008C,0x7F03008D,0x7F03008F,0x7F03009E,0x7F0300A7,0x7F0300A8,0x7F0300A9,0x7F0300AC,0x7F0300AE,0x7F0300B1,0x7F0300B2,0x7F0300B3,0x7F0300B4,0x7F0300B5,0x7F0300EA,0x7F0300F6,0x7F030119,0x7F03011A,0x7F03011D,0x7F03011E,0x7F03011F,0x7F030120,0x7F030121,0x7F030122,0x7F030123,0x7F030138,0x7F030139,0x7F03013A,0x7F030140,0x7F030142,0x7F030149,0x7F03014A,0x7F03014B,0x7F03014C,0x7F030155,0x7F030156,0x7F030157,0x7F030158,0x7F030165,0x7F030166,0x7F03017C,0x7F0301A3,0x7F0301A4,0x7F0301A5,0x7F0301A6,0x7F0301A8,0x7F0301A9,0x7F0301AA,0x7F0301AB,0x7F0301AE,0x7F0301AF,0x7F0301C9,0x7F0301CA,0x7F0301CB,0x7F0301CC,0x7F0301D3,0x7F0301D5,0x7F0301D6,0x7F0301D7,0x7F0301D8,0x7F0301D9,0x7F0301DA,0x7F0301DB,0x7F0301DC,0x7F0301DD,0x7F0301DE } public static int[] AppCompatTheme = new int[] { 16842839, 16842926, @@ -11588,29 +11602,28 @@ namespace Borepin.Droid 2130903370, 2130903371, 2130903372, - 2130903380, 2130903381, 2130903382, 2130903383, - 2130903396, + 2130903384, 2130903397, - 2130903419, - 2130903458, + 2130903398, + 2130903420, 2130903459, 2130903460, 2130903461, - 2130903463, + 2130903462, 2130903464, 2130903465, 2130903466, - 2130903469, + 2130903467, 2130903470, - 2130903496, + 2130903471, 2130903497, 2130903498, 2130903499, - 2130903506, - 2130903508, + 2130903500, + 2130903507, 2130903509, 2130903510, 2130903511, @@ -11619,7 +11632,8 @@ namespace Borepin.Droid 2130903514, 2130903515, 2130903516, - 2130903517}; + 2130903517, + 2130903518}; // aapt resource value: 2 public const int AppCompatTheme_actionBarDivider = 2; @@ -12135,7 +12149,7 @@ namespace Borepin.Droid // aapt resource value: 12 public const int CardView_contentPaddingTop = 12; - // aapt resource value: { 0x1010034,0x10100AB,0x101011F,0x101014F,0x10101E5,0x7F030061,0x7F030062,0x7F030063,0x7F030065,0x7F030066,0x7F030067,0x7F030069,0x7F03006A,0x7F03006B,0x7F03006C,0x7F03006D,0x7F03006E,0x7F030073,0x7F030074,0x7F030075,0x7F030077,0x7F030078,0x7F030079,0x7F03007A,0x7F03007B,0x7F03007C,0x7F03007D,0x7F0300E4,0x7F0300EE,0x7F0300F2,0x7F03014E,0x7F03015A,0x7F0301AF,0x7F0301B1 } + // aapt resource value: { 0x1010034,0x10100AB,0x101011F,0x101014F,0x10101E5,0x7F030061,0x7F030062,0x7F030063,0x7F030065,0x7F030066,0x7F030067,0x7F030069,0x7F03006A,0x7F03006B,0x7F03006C,0x7F03006D,0x7F03006E,0x7F030073,0x7F030074,0x7F030075,0x7F030077,0x7F030078,0x7F030079,0x7F03007A,0x7F03007B,0x7F03007C,0x7F03007D,0x7F0300E4,0x7F0300EE,0x7F0300F2,0x7F03014E,0x7F03015B,0x7F0301B0,0x7F0301B2 } public static int[] Chip = new int[] { 16842804, 16842923, @@ -12168,18 +12182,18 @@ namespace Borepin.Droid 2130903278, 2130903282, 2130903374, - 2130903386, - 2130903471, - 2130903473}; + 2130903387, + 2130903472, + 2130903474}; - // aapt resource value: { 0x7F030060,0x7F03006F,0x7F030070,0x7F030071,0x7F03015E,0x7F03015F } + // aapt resource value: { 0x7F030060,0x7F03006F,0x7F030070,0x7F030071,0x7F03015F,0x7F030160 } public static int[] ChipGroup = new int[] { 2130903136, 2130903151, 2130903152, 2130903153, - 2130903390, - 2130903391}; + 2130903391, + 2130903392}; // aapt resource value: 0 public const int ChipGroup_checkedChip = 0; @@ -12301,7 +12315,7 @@ namespace Borepin.Droid // aapt resource value: 33 public const int Chip_textStartPadding = 33; - // aapt resource value: { 0x7F030081,0x7F030082,0x7F03009D,0x7F0300BD,0x7F0300BE,0x7F0300BF,0x7F0300C0,0x7F0300C1,0x7F0300C2,0x7F0300C3,0x7F03014F,0x7F030151,0x7F03016F,0x7F0301BC,0x7F0301BD,0x7F0301C7 } + // aapt resource value: { 0x7F030081,0x7F030082,0x7F03009D,0x7F0300BD,0x7F0300BE,0x7F0300BF,0x7F0300C0,0x7F0300C1,0x7F0300C2,0x7F0300C3,0x7F03014F,0x7F030151,0x7F030170,0x7F0301BD,0x7F0301BE,0x7F0301C8 } public static int[] CollapsingToolbarLayout = new int[] { 2130903169, 2130903170, @@ -12315,10 +12329,10 @@ namespace Borepin.Droid 2130903235, 2130903375, 2130903377, - 2130903407, - 2130903484, + 2130903408, 2130903485, - 2130903495}; + 2130903486, + 2130903496}; // aapt resource value: 0 public const int CollapsingToolbarLayout_collapsedTitleGravity = 0; @@ -12409,10 +12423,10 @@ namespace Borepin.Droid // aapt resource value: 2 public const int CompoundButton_buttonTintMode = 2; - // aapt resource value: { 0x7F030107,0x7F03016E } + // aapt resource value: { 0x7F030107,0x7F03016F } public static int[] CoordinatorLayout = new int[] { 2130903303, - 2130903406}; + 2130903407}; // aapt resource value: 0 public const int CoordinatorLayout_keylines = 0; @@ -12462,7 +12476,7 @@ namespace Borepin.Droid // aapt resource value: 1 public const int DesignTheme_bottomSheetStyle = 1; - // aapt resource value: { 0x7F030029,0x7F03002A,0x7F030036,0x7F030084,0x7F0300AF,0x7F0300DD,0x7F030163,0x7F0301B3 } + // aapt resource value: { 0x7F030029,0x7F03002A,0x7F030036,0x7F030084,0x7F0300AF,0x7F0300DD,0x7F030164,0x7F0301B4 } public static int[] DrawerArrowToggle = new int[] { 2130903081, 2130903082, @@ -12470,8 +12484,8 @@ namespace Borepin.Droid 2130903172, 2130903215, 2130903261, - 2130903395, - 2130903475}; + 2130903396, + 2130903476}; // aapt resource value: 0 public const int DrawerArrowToggle_arrowHeadLength = 0; @@ -12497,7 +12511,7 @@ namespace Borepin.Droid // aapt resource value: 7 public const int DrawerArrowToggle_thickness = 7; - // aapt resource value: { 0x7F030034,0x7F030035,0x7F03003D,0x7F0300B6,0x7F0300C8,0x7F0300C9,0x7F0300E4,0x7F0300EC,0x7F03012A,0x7F030144,0x7F03014E,0x7F03015A,0x7F0301D1 } + // aapt resource value: { 0x7F030034,0x7F030035,0x7F03003D,0x7F0300B6,0x7F0300C8,0x7F0300C9,0x7F0300E4,0x7F0300EC,0x7F03012A,0x7F030144,0x7F03014E,0x7F03015B,0x7F0301D2 } public static int[] FloatingActionButton = new int[] { 2130903092, 2130903093, @@ -12510,8 +12524,8 @@ namespace Borepin.Droid 2130903338, 2130903364, 2130903374, - 2130903386, - 2130903505}; + 2130903387, + 2130903506}; // aapt resource value: 0 public const int FloatingActionButton_backgroundTint = 0; @@ -12579,7 +12593,7 @@ namespace Borepin.Droid 2130903255, 2130903256}; - // aapt resource value: { 0x1010532,0x1010533,0x101053F,0x101056F,0x1010570,0x7F0300D1,0x7F0300D9,0x7F0300DA,0x7F0300DB,0x7F0301D0 } + // aapt resource value: { 0x1010532,0x1010533,0x101053F,0x101056F,0x1010570,0x7F0300D1,0x7F0300D9,0x7F0300DA,0x7F0300DB,0x7F0301D1 } public static int[] FontFamilyFont = new int[] { 16844082, 16844083, @@ -12590,7 +12604,7 @@ namespace Borepin.Droid 2130903257, 2130903258, 2130903259, - 2130903504}; + 2130903505}; // aapt resource value: 0 public const int FontFamilyFont_android_font = 0; @@ -12724,7 +12738,7 @@ namespace Borepin.Droid // aapt resource value: 0 public const int ItemsViewRendererTheme_collectionViewStyle = 0; - // aapt resource value: { 0x10100AF,0x10100C4,0x1010126,0x1010127,0x1010128,0x7F0300AB,0x7F0300AD,0x7F03012B,0x7F030159 } + // aapt resource value: { 0x10100AF,0x10100C4,0x1010126,0x1010127,0x1010128,0x7F0300AB,0x7F0300AD,0x7F03012B,0x7F03015A } public static int[] LinearLayoutCompat = new int[] { 16842927, 16842948, @@ -12734,7 +12748,7 @@ namespace Borepin.Droid 2130903211, 2130903213, 2130903339, - 2130903385}; + 2130903386}; // aapt resource value: 2 public const int LinearLayoutCompat_android_baselineAligned = 2; @@ -12793,7 +12807,7 @@ namespace Borepin.Droid // aapt resource value: 1 public const int ListPopupWindow_android_dropDownVerticalOffset = 1; - // aapt resource value: { 0x10101B7,0x10101B8,0x10101B9,0x10101BA,0x7F030034,0x7F030035,0x7F0300A0,0x7F0300ED,0x7F0300EF,0x7F0300F0,0x7F0300F1,0x7F0300F3,0x7F0300F4,0x7F03014E,0x7F030170,0x7F030171 } + // aapt resource value: { 0x10101B7,0x10101B8,0x10101B9,0x10101BA,0x7F030034,0x7F030035,0x7F0300A0,0x7F0300ED,0x7F0300EF,0x7F0300F0,0x7F0300F1,0x7F0300F3,0x7F0300F4,0x7F03014E,0x7F030171,0x7F030172 } public static int[] MaterialButton = new int[] { 16843191, 16843192, @@ -12809,8 +12823,8 @@ namespace Borepin.Droid 2130903283, 2130903284, 2130903374, - 2130903408, - 2130903409}; + 2130903409, + 2130903410}; // aapt resource value: 3 public const int MaterialButton_android_insetBottom = 3; @@ -12860,10 +12874,10 @@ namespace Borepin.Droid // aapt resource value: 15 public const int MaterialButton_strokeWidth = 15; - // aapt resource value: { 0x7F030170,0x7F030171 } + // aapt resource value: { 0x7F030171,0x7F030172 } public static int[] MaterialCardView = new int[] { - 2130903408, - 2130903409}; + 2130903409, + 2130903410}; // aapt resource value: 0 public const int MaterialCardView_strokeColor = 0; @@ -12871,7 +12885,7 @@ namespace Borepin.Droid // aapt resource value: 1 public const int MaterialCardView_strokeWidth = 1; - // aapt resource value: { 0x7F030041,0x7F030042,0x7F030068,0x7F030072,0x7F030076,0x7F030085,0x7F030086,0x7F03008C,0x7F03008D,0x7F03008E,0x7F0300B5,0x7F0300D0,0x7F030126,0x7F030127,0x7F030131,0x7F030150,0x7F030160,0x7F030193,0x7F030198,0x7F030199,0x7F03019A,0x7F03019B,0x7F03019C,0x7F03019D,0x7F03019E,0x7F03019F,0x7F0301A0,0x7F0301A1,0x7F0301A6,0x7F0301AB,0x7F0301AC,0x7F0301B0 } + // aapt resource value: { 0x7F030041,0x7F030042,0x7F030068,0x7F030072,0x7F030076,0x7F030085,0x7F030086,0x7F03008C,0x7F03008D,0x7F03008E,0x7F0300B5,0x7F0300D0,0x7F030126,0x7F030127,0x7F030131,0x7F030150,0x7F030161,0x7F030194,0x7F030199,0x7F03019A,0x7F03019B,0x7F03019C,0x7F03019D,0x7F03019E,0x7F03019F,0x7F0301A0,0x7F0301A1,0x7F0301A2,0x7F0301A7,0x7F0301AC,0x7F0301AD,0x7F0301B1 } public static int[] MaterialComponentsTheme = new int[] { 2130903105, 2130903106, @@ -12889,9 +12903,8 @@ namespace Borepin.Droid 2130903335, 2130903345, 2130903376, - 2130903392, - 2130903443, - 2130903448, + 2130903393, + 2130903444, 2130903449, 2130903450, 2130903451, @@ -12901,10 +12914,11 @@ namespace Borepin.Droid 2130903455, 2130903456, 2130903457, - 2130903462, - 2130903467, + 2130903458, + 2130903463, 2130903468, - 2130903472}; + 2130903469, + 2130903473}; // aapt resource value: 0 public const int MaterialComponentsTheme_bottomSheetDialogTheme = 0; @@ -13029,7 +13043,7 @@ namespace Borepin.Droid // aapt resource value: 2 public const int MenuGroup_android_visible = 2; - // aapt resource value: { 0x1010002,0x101000E,0x10100D0,0x1010106,0x1010194,0x10101DE,0x10101DF,0x10101E1,0x10101E2,0x10101E3,0x10101E4,0x10101E5,0x101026F,0x7F03000D,0x7F03001F,0x7F030020,0x7F030028,0x7F030091,0x7F0300F3,0x7F0300F4,0x7F030132,0x7F030158,0x7F0301CC } + // aapt resource value: { 0x1010002,0x101000E,0x10100D0,0x1010106,0x1010194,0x10101DE,0x10101DF,0x10101E1,0x10101E2,0x10101E3,0x10101E4,0x10101E5,0x101026F,0x7F03000D,0x7F03001F,0x7F030020,0x7F030028,0x7F030091,0x7F0300F3,0x7F0300F4,0x7F030132,0x7F030159,0x7F0301CD } public static int[] MenuItem = new int[] { 16842754, 16842766, @@ -13052,8 +13066,8 @@ namespace Borepin.Droid 2130903283, 2130903284, 2130903346, - 2130903384, - 2130903500}; + 2130903385, + 2130903501}; // aapt resource value: 13 public const int MenuItem_actionLayout = 13; @@ -13124,7 +13138,7 @@ namespace Borepin.Droid // aapt resource value: 22 public const int MenuItem_tooltipText = 22; - // aapt resource value: { 0x10100AE,0x101012C,0x101012D,0x101012E,0x101012F,0x1010130,0x1010131,0x7F030143,0x7F030172 } + // aapt resource value: { 0x10100AE,0x101012C,0x101012D,0x101012E,0x101012F,0x1010130,0x1010131,0x7F030143,0x7F030173 } public static int[] MenuView = new int[] { 16842926, 16843052, @@ -13134,7 +13148,7 @@ namespace Borepin.Droid 16843056, 16843057, 2130903363, - 2130903410}; + 2130903411}; // aapt resource value: 4 public const int MenuView_android_headerBackground = 4; @@ -13220,9 +13234,9 @@ namespace Borepin.Droid 16843465, 2130903347}; - // aapt resource value: { 0x7F030169 } + // aapt resource value: { 0x7F03016A } public static int[] PopupWindowBackgroundState = new int[] { - 2130903401}; + 2130903402}; // aapt resource value: 0 public const int PopupWindowBackgroundState_state_above_anchor = 0; @@ -13247,7 +13261,7 @@ namespace Borepin.Droid // aapt resource value: 1 public const int RecycleListView_paddingTopNoTitle = 1; - // aapt resource value: { 0x10100C4,0x10100F1,0x7F0300CA,0x7F0300CB,0x7F0300CC,0x7F0300CD,0x7F0300CE,0x7F03010B,0x7F03014D,0x7F030162,0x7F030168 } + // aapt resource value: { 0x10100C4,0x10100F1,0x7F0300CA,0x7F0300CB,0x7F0300CC,0x7F0300CD,0x7F0300CE,0x7F03010B,0x7F03014D,0x7F030163,0x7F030169 } public static int[] RecyclerView = new int[] { 16842948, 16842993, @@ -13258,8 +13272,8 @@ namespace Borepin.Droid 2130903246, 2130903307, 2130903373, - 2130903394, - 2130903400}; + 2130903395, + 2130903401}; // aapt resource value: 1 public const int RecyclerView_android_descendantFocusability = 1; @@ -13308,7 +13322,14 @@ namespace Borepin.Droid // aapt resource value: 0 public const int ScrollingViewBehavior_Layout_behavior_overlapTop = 0; - // aapt resource value: { 0x10100DA,0x101011F,0x1010220,0x1010264,0x7F030077,0x7F030090,0x7F0300A6,0x7F0300DE,0x7F0300F5,0x7F03010A,0x7F030147,0x7F030148,0x7F030152,0x7F030153,0x7F030173,0x7F030178,0x7F0301D3 } + // aapt resource value: { 0x7F030152 } + public static int[] ScrollViewRendererTheme = new int[] { + 2130903378}; + + // aapt resource value: 0 + public const int ScrollViewRendererTheme_scrollViewStyle = 0; + + // aapt resource value: { 0x10100DA,0x101011F,0x1010220,0x1010264,0x7F030077,0x7F030090,0x7F0300A6,0x7F0300DE,0x7F0300F5,0x7F03010A,0x7F030147,0x7F030148,0x7F030153,0x7F030154,0x7F030174,0x7F030179,0x7F0301D4 } public static int[] SearchView = new int[] { 16842970, 16843039, @@ -13322,11 +13343,11 @@ namespace Borepin.Droid 2130903306, 2130903367, 2130903368, - 2130903378, 2130903379, - 2130903411, - 2130903416, - 2130903507}; + 2130903380, + 2130903412, + 2130903417, + 2130903508}; // aapt resource value: 0 public const int SearchView_android_focusable = 0; @@ -13379,10 +13400,10 @@ namespace Borepin.Droid // aapt resource value: 16 public const int SearchView_voiceIcon = 16; - // aapt resource value: { 0x7F030160,0x7F030161 } + // aapt resource value: { 0x7F030161,0x7F030162 } public static int[] Snackbar = new int[] { - 2130903392, - 2130903393}; + 2130903393, + 2130903394}; // aapt resource value: { 0x101011F,0x7F0300B6,0x7F030128 } public static int[] SnackbarLayout = new int[] { @@ -13462,22 +13483,22 @@ namespace Borepin.Droid // aapt resource value: 1 public const int StateListDrawable_android_visible = 1; - // aapt resource value: { 0x1010124,0x1010125,0x1010142,0x7F03015B,0x7F030166,0x7F030179,0x7F03017A,0x7F03017C,0x7F0301B4,0x7F0301B5,0x7F0301B6,0x7F0301CD,0x7F0301CE,0x7F0301CF } + // aapt resource value: { 0x1010124,0x1010125,0x1010142,0x7F03015C,0x7F030167,0x7F03017A,0x7F03017B,0x7F03017D,0x7F0301B5,0x7F0301B6,0x7F0301B7,0x7F0301CE,0x7F0301CF,0x7F0301D0 } public static int[] SwitchCompat = new int[] { 16843044, 16843045, 16843074, - 2130903387, - 2130903398, - 2130903417, + 2130903388, + 2130903399, 2130903418, - 2130903420, - 2130903476, + 2130903419, + 2130903421, 2130903477, 2130903478, - 2130903501, + 2130903479, 2130903502, - 2130903503}; + 2130903503, + 2130903504}; // aapt resource value: 1 public const int SwitchCompat_android_textOff = 1; @@ -13536,9 +13557,8 @@ namespace Borepin.Droid // aapt resource value: 2 public const int TabItem_android_text = 2; - // aapt resource value: { 0x7F03017D,0x7F03017E,0x7F03017F,0x7F030180,0x7F030181,0x7F030182,0x7F030183,0x7F030184,0x7F030185,0x7F030186,0x7F030187,0x7F030188,0x7F030189,0x7F03018A,0x7F03018B,0x7F03018C,0x7F03018D,0x7F03018E,0x7F03018F,0x7F030190,0x7F030191,0x7F030192,0x7F030194,0x7F030195,0x7F030196 } + // aapt resource value: { 0x7F03017E,0x7F03017F,0x7F030180,0x7F030181,0x7F030182,0x7F030183,0x7F030184,0x7F030185,0x7F030186,0x7F030187,0x7F030188,0x7F030189,0x7F03018A,0x7F03018B,0x7F03018C,0x7F03018D,0x7F03018E,0x7F03018F,0x7F030190,0x7F030191,0x7F030192,0x7F030193,0x7F030195,0x7F030196,0x7F030197 } public static int[] TabLayout = new int[] { - 2130903421, 2130903422, 2130903423, 2130903424, @@ -13560,9 +13580,10 @@ namespace Borepin.Droid 2130903440, 2130903441, 2130903442, - 2130903444, + 2130903443, 2130903445, - 2130903446}; + 2130903446, + 2130903447}; // aapt resource value: 0 public const int TabLayout_tabBackground = 0; @@ -13639,7 +13660,7 @@ namespace Borepin.Droid // aapt resource value: 24 public const int TabLayout_tabUnboundedRipple = 24; - // aapt resource value: { 0x1010095,0x1010096,0x1010097,0x1010098,0x101009A,0x101009B,0x1010161,0x1010162,0x1010163,0x1010164,0x10103AC,0x7F0300D2,0x7F030197 } + // aapt resource value: { 0x1010095,0x1010096,0x1010097,0x1010098,0x101009A,0x101009B,0x1010161,0x1010162,0x1010163,0x1010164,0x10103AC,0x7F0300D2,0x7F030198 } public static int[] TextAppearance = new int[] { 16842901, 16842902, @@ -13653,7 +13674,7 @@ namespace Borepin.Droid 16843108, 16843692, 2130903250, - 2130903447}; + 2130903448}; // aapt resource value: 10 public const int TextAppearance_android_fontFamily = 10; @@ -13824,7 +13845,7 @@ namespace Borepin.Droid // aapt resource value: 2 public const int ThemeEnforcement_enforceTextAppearance = 2; - // aapt resource value: { 0x10100AF,0x1010140,0x7F030051,0x7F03007F,0x7F030080,0x7F030092,0x7F030093,0x7F030094,0x7F030095,0x7F030096,0x7F030097,0x7F030124,0x7F030125,0x7F030129,0x7F03012E,0x7F03012F,0x7F030141,0x7F030174,0x7F030175,0x7F030176,0x7F0301BC,0x7F0301BE,0x7F0301BF,0x7F0301C0,0x7F0301C1,0x7F0301C2,0x7F0301C3,0x7F0301C4,0x7F0301C5 } + // aapt resource value: { 0x10100AF,0x1010140,0x7F030051,0x7F03007F,0x7F030080,0x7F030092,0x7F030093,0x7F030094,0x7F030095,0x7F030096,0x7F030097,0x7F030124,0x7F030125,0x7F030129,0x7F03012E,0x7F03012F,0x7F030141,0x7F030175,0x7F030176,0x7F030177,0x7F0301BD,0x7F0301BF,0x7F0301C0,0x7F0301C1,0x7F0301C2,0x7F0301C3,0x7F0301C4,0x7F0301C5,0x7F0301C6 } public static int[] Toolbar = new int[] { 16842927, 16843072, @@ -13843,18 +13864,18 @@ namespace Borepin.Droid 2130903342, 2130903343, 2130903361, - 2130903412, 2130903413, 2130903414, - 2130903484, - 2130903486, + 2130903415, + 2130903485, 2130903487, 2130903488, 2130903489, 2130903490, 2130903491, 2130903492, - 2130903493}; + 2130903493, + 2130903494}; // aapt resource value: 0 public const int Toolbar_android_gravity = 0; @@ -13943,13 +13964,13 @@ namespace Borepin.Droid // aapt resource value: 28 public const int Toolbar_titleTextColor = 28; - // aapt resource value: { 0x1010000,0x10100DA,0x7F030135,0x7F030136,0x7F0301B2 } + // aapt resource value: { 0x1010000,0x10100DA,0x7F030135,0x7F030136,0x7F0301B3 } public static int[] View = new int[] { 16842752, 16842970, 2130903349, 2130903350, - 2130903474}; + 2130903475}; // aapt resource value: { 0x10100D4,0x7F030034,0x7F030035 } public static int[] ViewBackgroundHelper = new int[] { diff --git a/Borepin/Borepin.GTK/Borepin.GTK.csproj b/Borepin/Borepin.GTK/Borepin.GTK.csproj index c2e3526..89bea14 100644 --- a/Borepin/Borepin.GTK/Borepin.GTK.csproj +++ b/Borepin/Borepin.GTK/Borepin.GTK.csproj @@ -1,6 +1,6 @@  - + Debug @@ -10,7 +10,7 @@ Properties Borepin.GTK Borepin.GTK - v4.7.2 + v4.8 512 true @@ -42,6 +42,9 @@ False ..\..\..\..\..\..\..\Program Files (x86)\GtkSharp\2.12\lib\gtk-sharp-2.0\atk-sharp.dll + + ..\..\packages\DryIoc.dll.4.5.1\lib\net45\DryIoc.dll + False ..\..\..\..\..\..\..\Program Files (x86)\GtkSharp\2.12\lib\gtk-sharp-2.0\gdk-sharp.dll @@ -69,6 +72,15 @@ False ..\..\..\..\..\..\..\Program Files (x86)\GtkSharp\2.12\lib\gtk-sharp-2.0\pango-sharp.dll + + ..\..\packages\Prism.Core.8.0.0.1909\lib\net47\Prism.dll + + + ..\..\packages\Prism.DryIoc.Forms.8.0.0.1909\lib\netstandard2.0\Prism.DryIoc.Forms.dll + + + ..\..\packages\Prism.Forms.8.0.0.1909\lib\netstandard2.0\Prism.Forms.dll + @@ -77,20 +89,20 @@ - - ..\..\packages\Xamarin.Forms.4.8.0.1364\lib\netstandard2.0\Xamarin.Forms.Core.dll + + ..\..\packages\Xamarin.Forms.Platform.GTK.4.8.0.1687\lib\net45\webkit-sharp.dll - - ..\..\packages\Xamarin.Forms.4.8.0.1364\lib\netstandard2.0\Xamarin.Forms.Platform.dll + + ..\..\packages\Xamarin.Forms.4.8.0.1687\lib\netstandard2.0\Xamarin.Forms.Core.dll - - ..\..\packages\Xamarin.Forms.4.8.0.1364\lib\netstandard2.0\Xamarin.Forms.Xaml.dll + + ..\..\packages\Xamarin.Forms.4.8.0.1687\lib\netstandard2.0\Xamarin.Forms.Platform.dll - - ..\..\packages\Xamarin.Forms.Platform.GTK.4.8.0.1364\lib\net45\webkit-sharp.dll + + ..\..\packages\Xamarin.Forms.Platform.GTK.4.8.0.1687\lib\net45\Xamarin.Forms.Platform.GTK.dll - - ..\..\packages\Xamarin.Forms.Platform.GTK.4.8.0.1364\lib\net45\Xamarin.Forms.Platform.GTK.dll + + ..\..\packages\Xamarin.Forms.4.8.0.1687\lib\netstandard2.0\Xamarin.Forms.Xaml.dll @@ -110,5 +122,12 @@ - + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/Borepin/Borepin.GTK/app.config b/Borepin/Borepin.GTK/app.config index 5c893eb..deb8b57 100644 --- a/Borepin/Borepin.GTK/app.config +++ b/Borepin/Borepin.GTK/app.config @@ -6,6 +6,14 @@ + + + + + + + + - + diff --git a/Borepin/Borepin.GTK/packages.config b/Borepin/Borepin.GTK/packages.config index 3ec538e..3f93ea5 100644 --- a/Borepin/Borepin.GTK/packages.config +++ b/Borepin/Borepin.GTK/packages.config @@ -1,6 +1,10 @@  - - - + + + + + + + \ No newline at end of file diff --git a/Borepin/Borepin.UWP/Borepin.UWP.csproj b/Borepin/Borepin.UWP/Borepin.UWP.csproj index d9a65ed..6f8167d 100644 --- a/Borepin/Borepin.UWP/Borepin.UWP.csproj +++ b/Borepin/Borepin.UWP/Borepin.UWP.csproj @@ -143,7 +143,10 @@ - + + 8.0.0.1909 + + diff --git a/Borepin/Borepin.iOS/Borepin.iOS.csproj b/Borepin/Borepin.iOS/Borepin.iOS.csproj index 65a106b..86c6aa3 100644 --- a/Borepin/Borepin.iOS/Borepin.iOS.csproj +++ b/Borepin/Borepin.iOS/Borepin.iOS.csproj @@ -164,7 +164,10 @@ - + + 8.0.0.1909 + + diff --git a/Borepin/Borepin.macOS/Borepin.macOS.csproj b/Borepin/Borepin.macOS/Borepin.macOS.csproj index 144ef00..68b988e 100644 --- a/Borepin/Borepin.macOS/Borepin.macOS.csproj +++ b/Borepin/Borepin.macOS/Borepin.macOS.csproj @@ -1,6 +1,6 @@  - + Debug AnyCPU @@ -59,18 +59,30 @@ + + ..\..\packages\DryIoc.dll.4.5.1\lib\netstandard2.0\DryIoc.dll + + + ..\..\packages\Prism.Core.8.0.0.1909\lib\netstandard2.0\Prism.dll + + + ..\..\packages\Prism.DryIoc.Forms.8.0.0.1909\lib\netstandard2.0\Prism.DryIoc.Forms.dll + + + ..\..\packages\Prism.Forms.8.0.0.1909\lib\netstandard2.0\Prism.Forms.dll + + + ..\..\packages\Xamarin.Forms.4.8.0.1687\lib\Xamarin.Mac\Xamarin.Forms.Core.dll + + + ..\..\packages\Xamarin.Forms.4.8.0.1687\lib\Xamarin.Mac\Xamarin.Forms.Platform.dll + + + ..\..\packages\Xamarin.Forms.4.8.0.1687\lib\Xamarin.Mac\Xamarin.Forms.Xaml.dll + - - ..\..\packages\Xamarin.Forms.4.8.0.1364\lib\Xamarin.Mac\Xamarin.Forms.Core.dll - - - ..\..\packages\Xamarin.Forms.4.8.0.1364\lib\Xamarin.Mac\Xamarin.Forms.Platform.dll - - - ..\..\packages\Xamarin.Forms.4.8.0.1364\lib\Xamarin.Mac\Xamarin.Forms.Xaml.dll - @@ -90,6 +102,7 @@ + @@ -112,5 +125,12 @@ - + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/Borepin/Borepin.macOS/app.config b/Borepin/Borepin.macOS/app.config new file mode 100644 index 0000000..5bd48b0 --- /dev/null +++ b/Borepin/Borepin.macOS/app.config @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Borepin/Borepin.macOS/packages.config b/Borepin/Borepin.macOS/packages.config index f09afaf..929cbb6 100644 --- a/Borepin/Borepin.macOS/packages.config +++ b/Borepin/Borepin.macOS/packages.config @@ -1,4 +1,9 @@  - + + + + + + \ No newline at end of file diff --git a/Borepin/Borepin/App.xaml b/Borepin/Borepin/App.xaml index d083652..f003ea0 100644 --- a/Borepin/Borepin/App.xaml +++ b/Borepin/Borepin/App.xaml @@ -1,8 +1,38 @@  - - + #7E7D81 + #00A5F2 + White + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Borepin/Borepin/App.xaml.cs b/Borepin/Borepin/App.xaml.cs index 8c84b7d..820e72f 100644 --- a/Borepin/Borepin/App.xaml.cs +++ b/Borepin/Borepin/App.xaml.cs @@ -1,37 +1,37 @@ -using Borepin.Base; +using System; +using Prism.Ioc; using Borepin.PageModel; -using Borepin.Service.Navigation; -using System; -using System.Threading.Tasks; +using Borepin.Page; using Xamarin.Forms; -using Xamarin.Forms.Xaml; namespace Borepin { - public partial class App : Application + public partial class App { public App() + { + + } + + protected override async void OnInitialized() { InitializeComponent(); + + var result = await NavigationService.NavigateAsync("MainPage/NavigationPage/ViewA"); + + if (!result.Success) + { + System.Diagnostics.Debugger.Break(); + } } - Task InitNavigation() - { - var navService = PageModelLocator.Resolve(); - return navService.NaviagteToAsync(null, true); - } - - protected override async void OnStart() - { - await InitNavigation(); - } - - protected override void OnSleep() - { - } - - protected override void OnResume() + protected override void RegisterTypes(IContainerRegistry containerRegistry) { + containerRegistry.RegisterForNavigation(); + containerRegistry.RegisterForNavigation(nameof(TabbedPage)); + containerRegistry.RegisterForNavigation(); + containerRegistry.RegisterForNavigation(); + containerRegistry.RegisterForNavigation(); } } } diff --git a/Borepin/Borepin/Base/PageModelBase.cs b/Borepin/Borepin/Base/PageModelBase.cs deleted file mode 100644 index e8c160e..0000000 --- a/Borepin/Borepin/Base/PageModelBase.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; -using Xamarin.Forms; - -namespace Borepin.Base -{ - public class PageModelBase : BindableObject - { - public virtual Task InitializeAsync(object naviagitionData = null) - { - return Task.CompletedTask; - } - - protected bool SetProperty(ref T storage, T value, [CallerMemberName]string propertyName = null) - { - if(EqualityComparer.Default.Equals(storage, value)) - { - return false; - } - - storage = value; - OnPropertyChanged(propertyName); - return true; - } - } -} diff --git a/Borepin/Borepin/Base/PageModelLocator.cs b/Borepin/Borepin/Base/PageModelLocator.cs deleted file mode 100644 index 9a1f5dc..0000000 --- a/Borepin/Borepin/Base/PageModelLocator.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Borepin.Page; -using Borepin.PageModel; -using Borepin.Service.Navigation; -using System; -using System.Collections.Generic; -using TinyIoC; - -namespace Borepin.Base -{ - public class PageModelLocator - { - private static TinyIoCContainer _Container; - private static Dictionary _ViewLookUp; - - static PageModelLocator() - { - _Container = new TinyIoCContainer(); - _ViewLookUp = new Dictionary(); - - // Register Pages and PageModels - Register(); - Register(); - - Register(); - Register(); - - Register(); - Register(); - - // Register Services (Services are registered by Singeltons default) - _Container.Register(); - } - - public static T Resolve() where T : class - { - return _Container.Resolve(); - } - - public static Xamarin.Forms.Page CreatePage(Type pageModelType) - { - Type pageType = _ViewLookUp[pageModelType]; - Xamarin.Forms.Page page = (Xamarin.Forms.Page)Activator.CreateInstance(pageType); - object pageModel = _Container.Resolve(pageModelType); - - page.BindingContext = pageModel; - return page; - } - - static void Register() where TPageModel : PageModelBase where TPage : Xamarin.Forms.Page - { - _ViewLookUp.Add(typeof(TPageModel), typeof(TPage)); - _Container.Register(); - } - } -} diff --git a/Borepin/Borepin/Base/TinyIoC.cs b/Borepin/Borepin/Base/TinyIoC.cs deleted file mode 100644 index 6ccb030..0000000 --- a/Borepin/Borepin/Base/TinyIoC.cs +++ /dev/null @@ -1,4341 +0,0 @@ -//=============================================================================== -// TinyIoC -// -// An easy to use, hassle free, Inversion of Control Container for small projects -// and beginners alike. -// -// https://github.com/grumpydev/TinyIoC -//=============================================================================== -// Copyright © Steven Robbins. All rights reserved. -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT -// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -// FITNESS FOR A PARTICULAR PURPOSE. -//=============================================================================== - -#region Preprocessor Directives -// Uncomment this line if you want the container to automatically -// register the TinyMessenger messenger/event aggregator -//#define TINYMESSENGER - -// Uncomment this line if you want to internalize this library -//#define TINYIOC_INTERNAL - -// Uncomment this line if you want to target PCL. -//#define PORTABLE - -// Preprocessor directives for enabling/disabling functionality -// depending on platform features. If the platform has an appropriate -// #DEFINE then these should be set automatically below. -#define EXPRESSIONS - -// Platform supports System.Linq.Expressions -#define COMPILED_EXPRESSIONS // Platform supports compiling expressions -#define APPDOMAIN_GETASSEMBLIES // Platform supports getting all assemblies from the AppDomain object -#define UNBOUND_GENERICS_GETCONSTRUCTORS // Platform supports GetConstructors on unbound generic types -#define GETPARAMETERS_OPEN_GENERICS // Platform supports GetParameters on open generics -#define RESOLVE_OPEN_GENERICS // Platform supports resolving open generics -#define READER_WRITER_LOCK_SLIM // Platform supports ReaderWriterLockSlim -#define SERIALIZABLE // Platform supports SerializableAttribute/SerializationInfo/StreamingContext - -#if PORTABLE -#undef APPDOMAIN_GETASSEMBLIES -#undef COMPILED_EXPRESSIONS -#undef READER_WRITER_LOCK_SLIM -#undef SERIALIZABLE -#endif - -#if NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 -#undef COMPILED_EXPRESSIONS -#undef READER_WRITER_LOCK_SLIM -#endif - -#if NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 -#undef APPDOMAIN_GETASSEMBLIES -#endif - -#if NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 || NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 || NETSTANDARD1_6 -#undef SERIALIZABLE -#endif - -// CompactFramework / Windows Phone 7 -// By default does not support System.Linq.Expressions. -// AppDomain object does not support enumerating all assemblies in the app domain. -#if PocketPC || WINDOWS_PHONE -#undef EXPRESSIONS -#undef COMPILED_EXPRESSIONS -#undef APPDOMAIN_GETASSEMBLIES -#undef UNBOUND_GENERICS_GETCONSTRUCTORS -#endif - -// PocketPC has a bizarre limitation on enumerating parameters on unbound generic methods. -// We need to use a slower workaround in that case. -#if PocketPC -#undef GETPARAMETERS_OPEN_GENERICS -#undef RESOLVE_OPEN_GENERICS -#undef READER_WRITER_LOCK_SLIM -#endif - -#if SILVERLIGHT -#undef APPDOMAIN_GETASSEMBLIES -#endif - -#if NETFX_CORE -#undef APPDOMAIN_GETASSEMBLIES -#undef RESOLVE_OPEN_GENERICS -#endif - -#if COMPILED_EXPRESSIONS -#define USE_OBJECT_CONSTRUCTOR -#endif - -#endregion -#if SERIALIZABLE -using System.Runtime.Serialization; -#endif - -namespace TinyIoC -{ - using System; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.Linq; - using System.Reflection; - -#if EXPRESSIONS - using System.Linq.Expressions; - using System.Threading; - -#endif - -#if NETFX_CORE - using System.Threading.Tasks; - using Windows.Storage.Search; - using Windows.Storage; - using Windows.UI.Xaml.Shapes; -#endif - - #region SafeDictionary -#if READER_WRITER_LOCK_SLIM -#if TINYIOC_INTERNAL - internal -#else - public -#endif - class SafeDictionary : IDisposable - { - private readonly ReaderWriterLockSlim _padlock = new ReaderWriterLockSlim(); - private readonly Dictionary _Dictionary = new Dictionary(); - - public TValue this[TKey key] - { - set - { - _padlock.EnterWriteLock(); - - try - { - TValue current; - if (_Dictionary.TryGetValue(key, out current)) - { - var disposable = current as IDisposable; - - if (disposable != null) - disposable.Dispose(); - } - - _Dictionary[key] = value; - } - finally - { - _padlock.ExitWriteLock(); - } - } - } - - public bool TryGetValue(TKey key, out TValue value) - { - _padlock.EnterReadLock(); - try - { - return _Dictionary.TryGetValue(key, out value); - } - finally - { - _padlock.ExitReadLock(); - } - } - - public bool Remove(TKey key) - { - _padlock.EnterWriteLock(); - try - { - return _Dictionary.Remove(key); - } - finally - { - _padlock.ExitWriteLock(); - } - } - - public void Clear() - { - _padlock.EnterWriteLock(); - try - { - _Dictionary.Clear(); - } - finally - { - _padlock.ExitWriteLock(); - } - } - - public IEnumerable Keys - { - get - { - _padlock.EnterReadLock(); - try - { - return new List(_Dictionary.Keys); - } - finally - { - _padlock.ExitReadLock(); - } - } - } - - #region IDisposable Members - - public void Dispose() - { - _padlock.EnterWriteLock(); - - try - { - var disposableItems = from item in _Dictionary.Values - where item is IDisposable - select item as IDisposable; - - foreach (var item in disposableItems) - { - item.Dispose(); - } - } - finally - { - _padlock.ExitWriteLock(); - } - - GC.SuppressFinalize(this); - } - - #endregion - } -#else -#if TINYIOC_INTERNAL - internal -#else - public -#endif - class SafeDictionary : IDisposable - { - private readonly object _Padlock = new object(); - private readonly Dictionary _Dictionary = new Dictionary(); - - public TValue this[TKey key] - { - set - { - lock (_Padlock) - { - TValue current; - if (_Dictionary.TryGetValue(key, out current)) - { - var disposable = current as IDisposable; - - if (disposable != null) - disposable.Dispose(); - } - - _Dictionary[key] = value; - } - } - } - - public bool TryGetValue(TKey key, out TValue value) - { - lock (_Padlock) - { - return _Dictionary.TryGetValue(key, out value); - } - } - - public bool Remove(TKey key) - { - lock (_Padlock) - { - return _Dictionary.Remove(key); - } - } - - public void Clear() - { - lock (_Padlock) - { - _Dictionary.Clear(); - } - } - - public IEnumerable Keys - { - get - { - return _Dictionary.Keys; - } - } - #region IDisposable Members - - public void Dispose() - { - lock (_Padlock) - { - var disposableItems = from item in _Dictionary.Values - where item is IDisposable - select item as IDisposable; - - foreach (var item in disposableItems) - { - item.Dispose(); - } - } - - GC.SuppressFinalize(this); - } - - #endregion - } -#endif - #endregion - - #region Extensions -#if TINYIOC_INTERNAL - internal -#else - public -#endif - static class AssemblyExtensions - { - public static Type[] SafeGetTypes(this Assembly assembly) - { - Type[] assemblies; - - try - { -#if PORTABLE || NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 - assemblies = assembly.ExportedTypes.ToArray(); -#else - assemblies = assembly.GetTypes(); -#endif - } - catch (System.IO.FileNotFoundException) - { - assemblies = new Type[] { }; - } - catch (NotSupportedException) - { - assemblies = new Type[] { }; - } -#if !NETFX_CORE - catch (ReflectionTypeLoadException e) - { - assemblies = e.Types.Where(t => t != null).ToArray(); - } -#endif - return assemblies; - } - } - -#if PORTABLE || NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 - [Flags] - public enum BindingFlags { - Default = 0, - IgnoreCase = 1, - DeclaredOnly = 2, - Instance = 4, - Static = 8, - Public = 16, - NonPublic = 32, - FlattenHierarchy = 64, - InvokeMethod = 256, - CreateInstance = 512, - GetField = 1024, - SetField = 2048, - GetProperty = 4096, - SetProperty = 8192, - PutDispProperty = 16384, - ExactBinding = 65536, - PutRefDispProperty = 32768, - SuppressChangeType = 131072, - OptionalParamBinding = 262144, - IgnoreReturn = 16777216 - } -#endif - -#if TINYIOC_INTERNAL - internal -#else - public -#endif - static class TypeExtensions - { - private static SafeDictionary _genericMethodCache; - - static TypeExtensions() - { - _genericMethodCache = new SafeDictionary(); - } - -#if PORTABLE || NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 - private static BindingFlags DefaultFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance; - - public static ConstructorInfo[] GetConstructors(this Type type) - { - return type.GetConstructors(DefaultFlags); - } - - public static ConstructorInfo[] GetConstructors(this Type type, BindingFlags bindingFlags) - { - return type.GetConstructors(bindingFlags, null); - } - - private static ConstructorInfo[] GetConstructors(this Type type, BindingFlags bindingFlags, IList parameterTypes) - { - return type.GetTypeInfo().DeclaredConstructors.Where( - c => - { - if (!TestAccessibility(c, bindingFlags)) - { - return false; - } - - if (parameterTypes != null && !c.GetParameters().Select(p => p.ParameterType).SequenceEqual(parameterTypes)) - { - return false; - } - - return true; - }).ToArray(); - } - - public static MethodInfo GetGetMethod(this PropertyInfo propertyInfo) { - return propertyInfo.GetGetMethod(false); - } - - public static MethodInfo GetGetMethod(this PropertyInfo propertyInfo, bool nonPublic) { - MethodInfo getMethod = propertyInfo.GetMethod; - if (getMethod != null && (getMethod.IsPublic || nonPublic)) { - return getMethod; - } - - return null; - } - - public static MethodInfo GetSetMethod(this PropertyInfo propertyInfo) { - return propertyInfo.GetSetMethod(false); - } - - public static MethodInfo GetSetMethod(this PropertyInfo propertyInfo, bool nonPublic) { - MethodInfo setMethod = propertyInfo.SetMethod; - if (setMethod != null && (setMethod.IsPublic || nonPublic)) { - return setMethod; - } - - return null; - } - - public static Type[] GetGenericArguments(this Type type) - { - return type.GetTypeInfo().GenericTypeArguments; - } - - public static IEnumerable GetProperties(this Type type) - { - TypeInfo t = type.GetTypeInfo(); - IList properties = new List(); - while (t != null) - { - foreach (PropertyInfo member in t.DeclaredProperties) - { - if (!properties.Any(p => p.Name == member.Name)) - { - properties.Add(member); - } - } - t = (t.BaseType != null) ? t.BaseType.GetTypeInfo() : null; - } - - return properties; - } - - public static IEnumerable GetInterfaces(this Type type) - { - return type.GetTypeInfo().ImplementedInterfaces; - } - - public static MethodInfo GetMethod(this Type type, string name, IList parameterTypes) - { - return type.GetMethod(name, DefaultFlags, null, parameterTypes, null); - } - - public static MethodInfo GetMethod(this Type type, string name, BindingFlags bindingFlags, object placeHolder1, IList parameterTypes, object placeHolder2) - { - return type.GetTypeInfo().DeclaredMethods.Where( - m => - { - if (name != null && m.Name != name) - { - return false; - } - - if (!TestAccessibility(m, bindingFlags)) - { - return false; - } - - return m.GetParameters().Select(p => p.ParameterType).SequenceEqual(parameterTypes); - }).SingleOrDefault(); - } - - public static IEnumerable GetMethods(this Type type, BindingFlags bindingFlags) - { - return type.GetTypeInfo().DeclaredMethods; - } - - public static bool IsAssignableFrom(this Type type, Type c) - { - return type.GetTypeInfo().IsAssignableFrom(c.GetTypeInfo()); - } - - private static bool TestAccessibility(MethodBase member, BindingFlags bindingFlags) - { - bool visibility = (member.IsPublic && bindingFlags.HasFlag(BindingFlags.Public)) || - (!member.IsPublic && bindingFlags.HasFlag(BindingFlags.NonPublic)); - - bool instance = (member.IsStatic && bindingFlags.HasFlag(BindingFlags.Static)) || - (!member.IsStatic && bindingFlags.HasFlag(BindingFlags.Instance)); - - return visibility && instance; - } -#endif - - /// - /// Gets a generic method from a type given the method name, binding flags, generic types and parameter types - /// - /// Source type - /// Binding flags - /// Name of the method - /// Generic types to use to make the method generic - /// Method parameters - /// MethodInfo or null if no matches found - /// - /// - public static MethodInfo GetGenericMethod(this Type sourceType, BindingFlags bindingFlags, string methodName, Type[] genericTypes, Type[] parameterTypes) - { - MethodInfo method; - var cacheKey = new GenericMethodCacheKey(sourceType, methodName, genericTypes, parameterTypes); - - // Shouldn't need any additional locking - // we don't care if we do the method info generation - // more than once before it gets cached. - if (!_genericMethodCache.TryGetValue(cacheKey, out method)) - { - method = GetMethod(sourceType, bindingFlags, methodName, genericTypes, parameterTypes); - _genericMethodCache[cacheKey] = method; - } - - return method; - } - //#endif - -#if NETFX_CORE - private static MethodInfo GetMethod(Type sourceType, BindingFlags flags, string methodName, Type[] genericTypes, Type[] parameterTypes) - { - var methods = - sourceType.GetMethods(flags).Where( - mi => string.Equals(methodName, mi.Name, StringComparison.Ordinal)).Where( - mi => mi.ContainsGenericParameters).Where(mi => mi.GetGenericArguments().Length == genericTypes.Length). - Where(mi => mi.GetParameters().Length == parameterTypes.Length).Select( - mi => mi.MakeGenericMethod(genericTypes)).Where( - mi => mi.GetParameters().Select(pi => pi.ParameterType).SequenceEqual(parameterTypes)).ToList(); - - if (methods.Count > 1) - { - throw new AmbiguousMatchException(); - } - - return methods.FirstOrDefault(); - } -#else - private static MethodInfo GetMethod(Type sourceType, BindingFlags bindingFlags, string methodName, Type[] genericTypes, Type[] parameterTypes) - { -#if GETPARAMETERS_OPEN_GENERICS - var methods = - sourceType.GetMethods(bindingFlags).Where( - mi => string.Equals(methodName, mi.Name, StringComparison.Ordinal)).Where( - mi => mi.ContainsGenericParameters).Where(mi => mi.GetGenericArguments().Length == genericTypes.Length). - Where(mi => mi.GetParameters().Length == parameterTypes.Length).Select( - mi => mi.MakeGenericMethod(genericTypes)).Where( - mi => mi.GetParameters().Select(pi => pi.ParameterType).SequenceEqual(parameterTypes)).ToList(); -#else - var validMethods = from method in sourceType.GetMethods(bindingFlags) - where method.Name == methodName - where method.IsGenericMethod - where method.GetGenericArguments().Length == genericTypes.Length - let genericMethod = method.MakeGenericMethod(genericTypes) - where genericMethod.GetParameters().Count() == parameterTypes.Length - where genericMethod.GetParameters().Select(pi => pi.ParameterType).SequenceEqual(parameterTypes) - select genericMethod; - - var methods = validMethods.ToList(); -#endif - if (methods.Count > 1) - { - throw new AmbiguousMatchException(); - } - - return methods.FirstOrDefault(); - } -#endif - - private sealed class GenericMethodCacheKey - { - private readonly Type _sourceType; - - private readonly string _methodName; - - private readonly Type[] _genericTypes; - - private readonly Type[] _parameterTypes; - - private readonly int _hashCode; - - public GenericMethodCacheKey(Type sourceType, string methodName, Type[] genericTypes, Type[] parameterTypes) - { - _sourceType = sourceType; - _methodName = methodName; - _genericTypes = genericTypes; - _parameterTypes = parameterTypes; - _hashCode = GenerateHashCode(); - } - - public override bool Equals(object obj) - { - var cacheKey = obj as GenericMethodCacheKey; - if (cacheKey == null) - return false; - - if (_sourceType != cacheKey._sourceType) - return false; - - if (!String.Equals(_methodName, cacheKey._methodName, StringComparison.Ordinal)) - return false; - - if (_genericTypes.Length != cacheKey._genericTypes.Length) - return false; - - if (_parameterTypes.Length != cacheKey._parameterTypes.Length) - return false; - - for (int i = 0; i < _genericTypes.Length; ++i) - { - if (_genericTypes[i] != cacheKey._genericTypes[i]) - return false; - } - - for (int i = 0; i < _parameterTypes.Length; ++i) - { - if (_parameterTypes[i] != cacheKey._parameterTypes[i]) - return false; - } - - return true; - } - - public override int GetHashCode() - { - return _hashCode; - } - - private int GenerateHashCode() - { - unchecked - { - var result = _sourceType.GetHashCode(); - - result = (result * 397) ^ _methodName.GetHashCode(); - - for (int i = 0; i < _genericTypes.Length; ++i) - { - result = (result * 397) ^ _genericTypes[i].GetHashCode(); - } - - for (int i = 0; i < _parameterTypes.Length; ++i) - { - result = (result * 397) ^ _parameterTypes[i].GetHashCode(); - } - - return result; - } - } - } - - } - - // @mbrit - 2012-05-22 - shim for ForEach call on List... -#if NETFX_CORE - internal static class ListExtender - { - internal static void ForEach(this List list, Action callback) - { - foreach (T obj in list) - callback(obj); - } - } -#endif - - #endregion - - #region TinyIoC Exception Types -#if SERIALIZABLE - [Serializable] -#endif -#if TINYIOC_INTERNAL - internal -#else - public -#endif - class TinyIoCResolutionException : Exception - { - private const string ERROR_TEXT = "Unable to resolve type: {0}"; - - public TinyIoCResolutionException(Type type) - : base(String.Format(ERROR_TEXT, type.FullName)) - { - } - - public TinyIoCResolutionException(Type type, Exception innerException) - : base(String.Format(ERROR_TEXT, type.FullName), innerException) - { - } -#if SERIALIZABLE - protected TinyIoCResolutionException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } -#endif - } -#if SERIALIZABLE - [Serializable] -#endif -#if TINYIOC_INTERNAL - internal -#else - public -#endif - class TinyIoCRegistrationTypeException : Exception - { - private const string REGISTER_ERROR_TEXT = "Cannot register type {0} - abstract classes or interfaces are not valid implementation types for {1}."; - - public TinyIoCRegistrationTypeException(Type type, string factory) - : base(String.Format(REGISTER_ERROR_TEXT, type.FullName, factory)) - { - } - - public TinyIoCRegistrationTypeException(Type type, string factory, Exception innerException) - : base(String.Format(REGISTER_ERROR_TEXT, type.FullName, factory), innerException) - { - } -#if SERIALIZABLE - protected TinyIoCRegistrationTypeException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } -#endif - } -#if SERIALIZABLE - [Serializable] -#endif -#if TINYIOC_INTERNAL - internal -#else - public -#endif - class TinyIoCRegistrationException : Exception - { - private const string CONVERT_ERROR_TEXT = "Cannot convert current registration of {0} to {1}"; - private const string GENERIC_CONSTRAINT_ERROR_TEXT = "Type {1} is not valid for a registration of type {0}"; - - public TinyIoCRegistrationException(Type type, string method) - : base(String.Format(CONVERT_ERROR_TEXT, type.FullName, method)) - { - } - - public TinyIoCRegistrationException(Type type, string method, Exception innerException) - : base(String.Format(CONVERT_ERROR_TEXT, type.FullName, method), innerException) - { - } - - public TinyIoCRegistrationException(Type registerType, Type implementationType) - : base(String.Format(GENERIC_CONSTRAINT_ERROR_TEXT, registerType.FullName, implementationType.FullName)) - { - } - - public TinyIoCRegistrationException(Type registerType, Type implementationType, Exception innerException) - : base(String.Format(GENERIC_CONSTRAINT_ERROR_TEXT, registerType.FullName, implementationType.FullName), innerException) - { - } -#if SERIALIZABLE - protected TinyIoCRegistrationException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } -#endif - } -#if SERIALIZABLE - [Serializable] -#endif -#if TINYIOC_INTERNAL - internal -#else - public -#endif - class TinyIoCWeakReferenceException : Exception - { - private const string ERROR_TEXT = "Unable to instantiate {0} - referenced object has been reclaimed"; - - public TinyIoCWeakReferenceException(Type type) - : base(String.Format(ERROR_TEXT, type.FullName)) - { - } - - public TinyIoCWeakReferenceException(Type type, Exception innerException) - : base(String.Format(ERROR_TEXT, type.FullName), innerException) - { - } -#if SERIALIZABLE - protected TinyIoCWeakReferenceException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } -#endif - } -#if SERIALIZABLE - [Serializable] -#endif -#if TINYIOC_INTERNAL - internal -#else - public -#endif - class TinyIoCConstructorResolutionException : Exception - { - private const string ERROR_TEXT = "Unable to resolve constructor for {0} using provided Expression."; - - public TinyIoCConstructorResolutionException(Type type) - : base(String.Format(ERROR_TEXT, type.FullName)) - { - } - - public TinyIoCConstructorResolutionException(Type type, Exception innerException) - : base(String.Format(ERROR_TEXT, type.FullName), innerException) - { - } - - public TinyIoCConstructorResolutionException(string message, Exception innerException) - : base(message, innerException) - { - } - - public TinyIoCConstructorResolutionException(string message) - : base(message) - { - } -#if SERIALIZABLE - protected TinyIoCConstructorResolutionException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } -#endif - } -#if SERIALIZABLE - [Serializable] -#endif -#if TINYIOC_INTERNAL - internal -#else - public -#endif - class TinyIoCAutoRegistrationException : Exception - { - private const string ERROR_TEXT = "Duplicate implementation of type {0} found ({1})."; - - public TinyIoCAutoRegistrationException(Type registerType, IEnumerable types) - : base(String.Format(ERROR_TEXT, registerType, GetTypesString(types))) - { - } - - public TinyIoCAutoRegistrationException(Type registerType, IEnumerable types, Exception innerException) - : base(String.Format(ERROR_TEXT, registerType, GetTypesString(types)), innerException) - { - } -#if SERIALIZABLE - protected TinyIoCAutoRegistrationException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } -#endif - - private static string GetTypesString(IEnumerable types) - { - var typeNames = from type in types - select type.FullName; - - return string.Join(",", typeNames.ToArray()); - } - } - #endregion - - #region Public Setup / Settings Classes - /// - /// Name/Value pairs for specifying "user" parameters when resolving - /// -#if TINYIOC_INTERNAL - internal -#else - public -#endif - sealed class NamedParameterOverloads : Dictionary - { - public static NamedParameterOverloads FromIDictionary(IDictionary data) - { - return data as NamedParameterOverloads ?? new NamedParameterOverloads(data); - } - - public NamedParameterOverloads() - { - } - - public NamedParameterOverloads(IDictionary data) - : base(data) - { - } - - private static readonly NamedParameterOverloads _Default = new NamedParameterOverloads(); - - public static NamedParameterOverloads Default - { - get - { - return _Default; - } - } - } - -#if TINYIOC_INTERNAL - internal -#else - public -#endif - enum UnregisteredResolutionActions - { - /// - /// Attempt to resolve type, even if the type isn't registered. - /// - /// Registered types/options will always take precedence. - /// - AttemptResolve, - - /// - /// Fail resolution if type not explicitly registered - /// - Fail, - - /// - /// Attempt to resolve unregistered type if requested type is generic - /// and no registration exists for the specific generic parameters used. - /// - /// Registered types/options will always take precedence. - /// - GenericsOnly - } - -#if TINYIOC_INTERNAL - internal -#else - public -#endif - enum NamedResolutionFailureActions - { - AttemptUnnamedResolution, - Fail - } - -#if TINYIOC_INTERNAL - internal -#else - public -#endif - enum DuplicateImplementationActions - { - RegisterSingle, - RegisterMultiple, - Fail - } - - /// - /// Resolution settings - /// -#if TINYIOC_INTERNAL - internal -#else - public -#endif - sealed class ResolveOptions - { - private static readonly ResolveOptions _Default = new ResolveOptions(); - private static readonly ResolveOptions _FailUnregisteredAndNameNotFound = new ResolveOptions() { NamedResolutionFailureAction = NamedResolutionFailureActions.Fail, UnregisteredResolutionAction = UnregisteredResolutionActions.Fail }; - private static readonly ResolveOptions _FailUnregisteredOnly = new ResolveOptions() { NamedResolutionFailureAction = NamedResolutionFailureActions.AttemptUnnamedResolution, UnregisteredResolutionAction = UnregisteredResolutionActions.Fail }; - private static readonly ResolveOptions _FailNameNotFoundOnly = new ResolveOptions() { NamedResolutionFailureAction = NamedResolutionFailureActions.Fail, UnregisteredResolutionAction = UnregisteredResolutionActions.AttemptResolve }; - - private UnregisteredResolutionActions _UnregisteredResolutionAction = UnregisteredResolutionActions.AttemptResolve; - public UnregisteredResolutionActions UnregisteredResolutionAction - { - get { return _UnregisteredResolutionAction; } - set { _UnregisteredResolutionAction = value; } - } - - private NamedResolutionFailureActions _NamedResolutionFailureAction = NamedResolutionFailureActions.Fail; - public NamedResolutionFailureActions NamedResolutionFailureAction - { - get { return _NamedResolutionFailureAction; } - set { _NamedResolutionFailureAction = value; } - } - - /// - /// Gets the default options (attempt resolution of unregistered types, fail on named resolution if name not found) - /// - public static ResolveOptions Default - { - get - { - return _Default; - } - } - - /// - /// Preconfigured option for attempting resolution of unregistered types and failing on named resolution if name not found - /// - public static ResolveOptions FailNameNotFoundOnly - { - get - { - return _FailNameNotFoundOnly; - } - } - - /// - /// Preconfigured option for failing on resolving unregistered types and on named resolution if name not found - /// - public static ResolveOptions FailUnregisteredAndNameNotFound - { - get - { - return _FailUnregisteredAndNameNotFound; - } - } - - /// - /// Preconfigured option for failing on resolving unregistered types, but attempting unnamed resolution if name not found - /// - public static ResolveOptions FailUnregisteredOnly - { - get - { - return _FailUnregisteredOnly; - } - } - } - #endregion - -#if TINYIOC_INTERNAL - internal -#else - public -#endif - sealed partial class TinyIoCContainer : IDisposable - { - #region Fake NETFX_CORE Classes -#if NETFX_CORE - private sealed class MethodAccessException : Exception - { - } - - private sealed class AppDomain - { - public static AppDomain CurrentDomain { get; private set; } - - static AppDomain() - { - CurrentDomain = new AppDomain(); - } - - // @mbrit - 2012-05-30 - in WinRT, this should be done async... - public async Task> GetAssembliesAsync() - { - var folder = Windows.ApplicationModel.Package.Current.InstalledLocation; - - List assemblies = new List(); - - var files = await folder.GetFilesAsync(); - - foreach (StorageFile file in files) - { - if (file.FileType == ".dll" || file.FileType == ".exe") - { - AssemblyName name = new AssemblyName() { Name = System.IO.Path.GetFileNameWithoutExtension(file.Name) }; - try - { - var asm = Assembly.Load(name); - assemblies.Add(asm); - } - catch - { - // ignore exceptions here... - } - } - } - - return assemblies; - } - } -#endif - #endregion - - #region "Fluent" API - /// - /// Registration options for "fluent" API - /// - public sealed class RegisterOptions - { - private TinyIoCContainer _Container; - private TypeRegistration _Registration; - - public RegisterOptions(TinyIoCContainer container, TypeRegistration registration) - { - _Container = container; - _Registration = registration; - } - - /// - /// Make registration a singleton (single instance) if possible - /// - /// RegisterOptions - /// - public RegisterOptions AsSingleton() - { - var currentFactory = _Container.GetCurrentFactory(_Registration); - - if (currentFactory == null) - throw new TinyIoCRegistrationException(_Registration.Type, "singleton"); - - return _Container.AddUpdateRegistration(_Registration, currentFactory.SingletonVariant); - } - - /// - /// Make registration multi-instance if possible - /// - /// RegisterOptions - /// - public RegisterOptions AsMultiInstance() - { - var currentFactory = _Container.GetCurrentFactory(_Registration); - - if (currentFactory == null) - throw new TinyIoCRegistrationException(_Registration.Type, "multi-instance"); - - return _Container.AddUpdateRegistration(_Registration, currentFactory.MultiInstanceVariant); - } - - /// - /// Make registration hold a weak reference if possible - /// - /// RegisterOptions - /// - public RegisterOptions WithWeakReference() - { - var currentFactory = _Container.GetCurrentFactory(_Registration); - - if (currentFactory == null) - throw new TinyIoCRegistrationException(_Registration.Type, "weak reference"); - - return _Container.AddUpdateRegistration(_Registration, currentFactory.WeakReferenceVariant); - } - - /// - /// Make registration hold a strong reference if possible - /// - /// RegisterOptions - /// - public RegisterOptions WithStrongReference() - { - var currentFactory = _Container.GetCurrentFactory(_Registration); - - if (currentFactory == null) - throw new TinyIoCRegistrationException(_Registration.Type, "strong reference"); - - return _Container.AddUpdateRegistration(_Registration, currentFactory.StrongReferenceVariant); - } - -#if EXPRESSIONS - public RegisterOptions UsingConstructor(Expression> constructor) - { - if (!IsValidAssignment(_Registration.Type, typeof(RegisterType))) - throw new TinyIoCConstructorResolutionException(typeof(RegisterType)); - - var lambda = constructor as LambdaExpression; - if (lambda == null) - throw new TinyIoCConstructorResolutionException(typeof(RegisterType)); - - var newExpression = lambda.Body as NewExpression; - if (newExpression == null) - throw new TinyIoCConstructorResolutionException(typeof(RegisterType)); - - var constructorInfo = newExpression.Constructor; - if (constructorInfo == null) - throw new TinyIoCConstructorResolutionException(typeof(RegisterType)); - - var currentFactory = _Container.GetCurrentFactory(_Registration); - if (currentFactory == null) - throw new TinyIoCConstructorResolutionException(typeof(RegisterType)); - - currentFactory.SetConstructor(constructorInfo); - - return this; - } -#endif - /// - /// Switches to a custom lifetime manager factory if possible. - /// - /// Usually used for RegisterOptions "To*" extension methods such as the ASP.Net per-request one. - /// - /// RegisterOptions instance - /// Custom lifetime manager - /// Error string to display if switch fails - /// RegisterOptions - public static RegisterOptions ToCustomLifetimeManager(RegisterOptions instance, ITinyIoCObjectLifetimeProvider lifetimeProvider, string errorString) - { - if (instance == null) - throw new ArgumentNullException("instance", "instance is null."); - - if (lifetimeProvider == null) - throw new ArgumentNullException("lifetimeProvider", "lifetimeProvider is null."); - - if (string.IsNullOrEmpty(errorString)) - throw new ArgumentException("errorString is null or empty.", "errorString"); - - var currentFactory = instance._Container.GetCurrentFactory(instance._Registration); - - if (currentFactory == null) - throw new TinyIoCRegistrationException(instance._Registration.Type, errorString); - - return instance._Container.AddUpdateRegistration(instance._Registration, currentFactory.GetCustomObjectLifetimeVariant(lifetimeProvider, errorString)); - } - } - - /// - /// Registration options for "fluent" API when registering multiple implementations - /// - public sealed class MultiRegisterOptions - { - private IEnumerable _RegisterOptions; - - /// - /// Initializes a new instance of the MultiRegisterOptions class. - /// - /// Registration options - public MultiRegisterOptions(IEnumerable registerOptions) - { - _RegisterOptions = registerOptions; - } - - /// - /// Make registration a singleton (single instance) if possible - /// - /// RegisterOptions - /// - public MultiRegisterOptions AsSingleton() - { - _RegisterOptions = ExecuteOnAllRegisterOptions(ro => ro.AsSingleton()); - return this; - } - - /// - /// Make registration multi-instance if possible - /// - /// MultiRegisterOptions - /// - public MultiRegisterOptions AsMultiInstance() - { - _RegisterOptions = ExecuteOnAllRegisterOptions(ro => ro.AsMultiInstance()); - return this; - } - - /// - /// Switches to a custom lifetime manager factory if possible. - /// - /// Usually used for RegisterOptions "To*" extension methods such as the ASP.Net per-request one. - /// - /// MultiRegisterOptions instance - /// Custom lifetime manager - /// Error string to display if switch fails - /// MultiRegisterOptions - public static MultiRegisterOptions ToCustomLifetimeManager( - MultiRegisterOptions instance, - ITinyIoCObjectLifetimeProvider lifetimeProvider, - string errorString) - { - if (instance == null) - throw new ArgumentNullException("instance", "instance is null."); - - if (lifetimeProvider == null) - throw new ArgumentNullException("lifetimeProvider", "lifetimeProvider is null."); - - if (string.IsNullOrEmpty(errorString)) - throw new ArgumentException("errorString is null or empty.", "errorString"); - - instance._RegisterOptions = instance.ExecuteOnAllRegisterOptions(ro => RegisterOptions.ToCustomLifetimeManager(ro, lifetimeProvider, errorString)); - - return instance; - } - - private IEnumerable ExecuteOnAllRegisterOptions(Func action) - { - var newRegisterOptions = new List(); - - foreach (var registerOption in _RegisterOptions) - { - newRegisterOptions.Add(action(registerOption)); - } - - return newRegisterOptions; - } - } - #endregion - - #region Public API - #region Child Containers - public TinyIoCContainer GetChildContainer() - { - return new TinyIoCContainer(this); - } - #endregion - - #region Registration - /// - /// Attempt to automatically register all non-generic classes and interfaces in the current app domain. - /// - /// If more than one class implements an interface then only one implementation will be registered - /// although no error will be thrown. - /// - public void AutoRegister() - { -#if APPDOMAIN_GETASSEMBLIES - AutoRegisterInternal(AppDomain.CurrentDomain.GetAssemblies().Where(a => !IsIgnoredAssembly(a)), DuplicateImplementationActions.RegisterSingle, null); -#else - AutoRegisterInternal(new Assembly[] { this.GetType().Assembly() }, DuplicateImplementationActions.RegisterSingle, null); -#endif - } - - /// - /// Attempt to automatically register all non-generic classes and interfaces in the current app domain. - /// Types will only be registered if they pass the supplied registration predicate. - /// - /// If more than one class implements an interface then only one implementation will be registered - /// although no error will be thrown. - /// - /// Predicate to determine if a particular type should be registered - public void AutoRegister(Func registrationPredicate) - { -#if APPDOMAIN_GETASSEMBLIES - AutoRegisterInternal(AppDomain.CurrentDomain.GetAssemblies().Where(a => !IsIgnoredAssembly(a)), DuplicateImplementationActions.RegisterSingle, registrationPredicate); -#else - AutoRegisterInternal(new Assembly[] { this.GetType().Assembly() }, DuplicateImplementationActions.RegisterSingle, registrationPredicate); -#endif - } - - /// - /// Attempt to automatically register all non-generic classes and interfaces in the current app domain. - /// - /// What action to take when encountering duplicate implementations of an interface/base class. - /// - public void AutoRegister(DuplicateImplementationActions duplicateAction) - { -#if APPDOMAIN_GETASSEMBLIES - AutoRegisterInternal(AppDomain.CurrentDomain.GetAssemblies().Where(a => !IsIgnoredAssembly(a)), duplicateAction, null); -#else - AutoRegisterInternal(new Assembly[] { this.GetType().Assembly() }, duplicateAction, null); -#endif - } - - /// - /// Attempt to automatically register all non-generic classes and interfaces in the current app domain. - /// Types will only be registered if they pass the supplied registration predicate. - /// - /// What action to take when encountering duplicate implementations of an interface/base class. - /// Predicate to determine if a particular type should be registered - /// - public void AutoRegister(DuplicateImplementationActions duplicateAction, Func registrationPredicate) - { -#if APPDOMAIN_GETASSEMBLIES - AutoRegisterInternal(AppDomain.CurrentDomain.GetAssemblies().Where(a => !IsIgnoredAssembly(a)), duplicateAction, registrationPredicate); -#else - AutoRegisterInternal(new Assembly[] { this.GetType().Assembly() }, duplicateAction, registrationPredicate); -#endif - } - - /// - /// Attempt to automatically register all non-generic classes and interfaces in the specified assemblies - /// - /// If more than one class implements an interface then only one implementation will be registered - /// although no error will be thrown. - /// - /// Assemblies to process - public void AutoRegister(IEnumerable assemblies) - { - AutoRegisterInternal(assemblies, DuplicateImplementationActions.RegisterSingle, null); - } - - /// - /// Attempt to automatically register all non-generic classes and interfaces in the specified assemblies - /// Types will only be registered if they pass the supplied registration predicate. - /// - /// If more than one class implements an interface then only one implementation will be registered - /// although no error will be thrown. - /// - /// Assemblies to process - /// Predicate to determine if a particular type should be registered - public void AutoRegister(IEnumerable assemblies, Func registrationPredicate) - { - AutoRegisterInternal(assemblies, DuplicateImplementationActions.RegisterSingle, registrationPredicate); - } - - /// - /// Attempt to automatically register all non-generic classes and interfaces in the specified assemblies - /// - /// Assemblies to process - /// What action to take when encountering duplicate implementations of an interface/base class. - /// - public void AutoRegister(IEnumerable assemblies, DuplicateImplementationActions duplicateAction) - { - AutoRegisterInternal(assemblies, duplicateAction, null); - } - - /// - /// Attempt to automatically register all non-generic classes and interfaces in the specified assemblies - /// Types will only be registered if they pass the supplied registration predicate. - /// - /// Assemblies to process - /// What action to take when encountering duplicate implementations of an interface/base class. - /// Predicate to determine if a particular type should be registered - /// - public void AutoRegister(IEnumerable assemblies, DuplicateImplementationActions duplicateAction, Func registrationPredicate) - { - AutoRegisterInternal(assemblies, duplicateAction, registrationPredicate); - } - - /// - /// Creates/replaces a container class registration with default options. - /// - /// Type to register - /// RegisterOptions for fluent API - public RegisterOptions Register(Type registerType) - { - return RegisterInternal(registerType, string.Empty, GetDefaultObjectFactory(registerType, registerType)); - } - - /// - /// Creates/replaces a named container class registration with default options. - /// - /// Type to register - /// Name of registration - /// RegisterOptions for fluent API - public RegisterOptions Register(Type registerType, string name) - { - return RegisterInternal(registerType, name, GetDefaultObjectFactory(registerType, registerType)); - - } - - /// - /// Creates/replaces a container class registration with a given implementation and default options. - /// - /// Type to register - /// Type to instantiate that implements RegisterType - /// RegisterOptions for fluent API - public RegisterOptions Register(Type registerType, Type registerImplementation) - { - return this.RegisterInternal(registerType, string.Empty, GetDefaultObjectFactory(registerType, registerImplementation)); - } - - /// - /// Creates/replaces a named container class registration with a given implementation and default options. - /// - /// Type to register - /// Type to instantiate that implements RegisterType - /// Name of registration - /// RegisterOptions for fluent API - public RegisterOptions Register(Type registerType, Type registerImplementation, string name) - { - return this.RegisterInternal(registerType, name, GetDefaultObjectFactory(registerType, registerImplementation)); - } - - /// - /// Creates/replaces a container class registration with a specific, strong referenced, instance. - /// - /// Type to register - /// Instance of RegisterType to register - /// RegisterOptions for fluent API - public RegisterOptions Register(Type registerType, object instance) - { - return RegisterInternal(registerType, string.Empty, new InstanceFactory(registerType, registerType, instance)); - } - - /// - /// Creates/replaces a named container class registration with a specific, strong referenced, instance. - /// - /// Type to register - /// Instance of RegisterType to register - /// Name of registration - /// RegisterOptions for fluent API - public RegisterOptions Register(Type registerType, object instance, string name) - { - return RegisterInternal(registerType, name, new InstanceFactory(registerType, registerType, instance)); - } - - /// - /// Creates/replaces a container class registration with a specific, strong referenced, instance. - /// - /// Type to register - /// Type of instance to register that implements RegisterType - /// Instance of RegisterImplementation to register - /// RegisterOptions for fluent API - public RegisterOptions Register(Type registerType, Type registerImplementation, object instance) - { - return RegisterInternal(registerType, string.Empty, new InstanceFactory(registerType, registerImplementation, instance)); - } - - /// - /// Creates/replaces a named container class registration with a specific, strong referenced, instance. - /// - /// Type to register - /// Type of instance to register that implements RegisterType - /// Instance of RegisterImplementation to register - /// Name of registration - /// RegisterOptions for fluent API - public RegisterOptions Register(Type registerType, Type registerImplementation, object instance, string name) - { - return RegisterInternal(registerType, name, new InstanceFactory(registerType, registerImplementation, instance)); - } - - /// - /// Creates/replaces a container class registration with a user specified factory - /// - /// Type to register - /// Factory/lambda that returns an instance of RegisterType - /// RegisterOptions for fluent API - public RegisterOptions Register(Type registerType, Func factory) - { - return RegisterInternal(registerType, string.Empty, new DelegateFactory(registerType, factory)); - } - - /// - /// Creates/replaces a container class registration with a user specified factory - /// - /// Type to register - /// Factory/lambda that returns an instance of RegisterType - /// Name of registration - /// RegisterOptions for fluent API - public RegisterOptions Register(Type registerType, Func factory, string name) - { - return RegisterInternal(registerType, name, new DelegateFactory(registerType, factory)); - } - - /// - /// Creates/replaces a container class registration with default options. - /// - /// Type to register - /// RegisterOptions for fluent API - public RegisterOptions Register() - where RegisterType : class - { - return this.Register(typeof(RegisterType)); - } - - /// - /// Creates/replaces a named container class registration with default options. - /// - /// Type to register - /// Name of registration - /// RegisterOptions for fluent API - public RegisterOptions Register(string name) - where RegisterType : class - { - return this.Register(typeof(RegisterType), name); - } - - /// - /// Creates/replaces a container class registration with a given implementation and default options. - /// - /// Type to register - /// Type to instantiate that implements RegisterType - /// RegisterOptions for fluent API - public RegisterOptions Register() - where RegisterType : class - where RegisterImplementation : class, RegisterType - { - return this.Register(typeof(RegisterType), typeof(RegisterImplementation)); - } - - /// - /// Creates/replaces a named container class registration with a given implementation and default options. - /// - /// Type to register - /// Type to instantiate that implements RegisterType - /// Name of registration - /// RegisterOptions for fluent API - public RegisterOptions Register(string name) - where RegisterType : class - where RegisterImplementation : class, RegisterType - { - return this.Register(typeof(RegisterType), typeof(RegisterImplementation), name); - } - - /// - /// Creates/replaces a container class registration with a specific, strong referenced, instance. - /// - /// Type to register - /// Instance of RegisterType to register - /// RegisterOptions for fluent API - public RegisterOptions Register(RegisterType instance) - where RegisterType : class - { - return this.Register(typeof(RegisterType), instance); - } - - /// - /// Creates/replaces a named container class registration with a specific, strong referenced, instance. - /// - /// Type to register - /// Instance of RegisterType to register - /// Name of registration - /// RegisterOptions for fluent API - public RegisterOptions Register(RegisterType instance, string name) - where RegisterType : class - { - return this.Register(typeof(RegisterType), instance, name); - } - - /// - /// Creates/replaces a container class registration with a specific, strong referenced, instance. - /// - /// Type to register - /// Type of instance to register that implements RegisterType - /// Instance of RegisterImplementation to register - /// RegisterOptions for fluent API - public RegisterOptions Register(RegisterImplementation instance) - where RegisterType : class - where RegisterImplementation : class, RegisterType - { - return this.Register(typeof(RegisterType), typeof(RegisterImplementation), instance); - } - - /// - /// Creates/replaces a named container class registration with a specific, strong referenced, instance. - /// - /// Type to register - /// Type of instance to register that implements RegisterType - /// Instance of RegisterImplementation to register - /// Name of registration - /// RegisterOptions for fluent API - public RegisterOptions Register(RegisterImplementation instance, string name) - where RegisterType : class - where RegisterImplementation : class, RegisterType - { - return this.Register(typeof(RegisterType), typeof(RegisterImplementation), instance, name); - } - - /// - /// Creates/replaces a container class registration with a user specified factory - /// - /// Type to register - /// Factory/lambda that returns an instance of RegisterType - /// RegisterOptions for fluent API - public RegisterOptions Register(Func factory) - where RegisterType : class - { - if (factory == null) - { - throw new ArgumentNullException("factory"); - } - - return this.Register(typeof(RegisterType), (c, o) => factory(c, o)); - } - - /// - /// Creates/replaces a named container class registration with a user specified factory - /// - /// Type to register - /// Factory/lambda that returns an instance of RegisterType - /// Name of registration - /// RegisterOptions for fluent API - public RegisterOptions Register(Func factory, string name) - where RegisterType : class - { - if (factory == null) - { - throw new ArgumentNullException("factory"); - } - - return this.Register(typeof(RegisterType), (c, o) => factory(c, o), name); - } - - /// - /// Register multiple implementations of a type. - /// - /// Internally this registers each implementation using the full name of the class as its registration name. - /// - /// Type that each implementation implements - /// Types that implement RegisterType - /// MultiRegisterOptions for the fluent API - public MultiRegisterOptions RegisterMultiple(IEnumerable implementationTypes) - { - return RegisterMultiple(typeof(RegisterType), implementationTypes); - } - - /// - /// Register multiple implementations of a type. - /// - /// Internally this registers each implementation using the full name of the class as its registration name. - /// - /// Type that each implementation implements - /// Types that implement RegisterType - /// MultiRegisterOptions for the fluent API - public MultiRegisterOptions RegisterMultiple(Type registrationType, IEnumerable implementationTypes) - { - if (implementationTypes == null) - throw new ArgumentNullException("types", "types is null."); - - foreach (var type in implementationTypes) - //#if NETFX_CORE - // if (!registrationType.GetTypeInfo().IsAssignableFrom(type.GetTypeInfo())) - //#else - if (!registrationType.IsAssignableFrom(type)) - //#endif - throw new ArgumentException(String.Format("types: The type {0} is not assignable from {1}", registrationType.FullName, type.FullName)); - - if (implementationTypes.Count() != implementationTypes.Distinct().Count()) - { - var queryForDuplicatedTypes = from i in implementationTypes - group i by i - into j - where j.Count() > 1 - select j.Key.FullName; - - var fullNamesOfDuplicatedTypes = string.Join(",\n", queryForDuplicatedTypes.ToArray()); - var multipleRegMessage = string.Format("types: The same implementation type cannot be specified multiple times for {0}\n\n{1}", registrationType.FullName, fullNamesOfDuplicatedTypes); - throw new ArgumentException(multipleRegMessage); - } - - var registerOptions = new List(); - - foreach (var type in implementationTypes) - { - registerOptions.Add(Register(registrationType, type, type.FullName)); - } - - return new MultiRegisterOptions(registerOptions); - } - #endregion - - #region Unregistration - - /// - /// Remove a container class registration. - /// - /// Type to unregister - /// true if the registration is successfully found and removed; otherwise, false. - public bool Unregister() - { - return Unregister(typeof(RegisterType), string.Empty); - } - - /// - /// Remove a named container class registration. - /// - /// Type to unregister - /// Name of registration - /// true if the registration is successfully found and removed; otherwise, false. - public bool Unregister(string name) - { - return Unregister(typeof(RegisterType), name); - } - - /// - /// Remove a container class registration. - /// - /// Type to unregister - /// true if the registration is successfully found and removed; otherwise, false. - public bool Unregister(Type registerType) - { - return Unregister(registerType, string.Empty); - } - - /// - /// Remove a named container class registration. - /// - /// Type to unregister - /// Name of registration - /// true if the registration is successfully found and removed; otherwise, false. - public bool Unregister(Type registerType, string name) - { - var typeRegistration = new TypeRegistration(registerType, name); - - return RemoveRegistration(typeRegistration); - } - - #endregion - - #region Resolution - /// - /// Attempts to resolve a type using default options. - /// - /// Type to resolve - /// Instance of type - /// Unable to resolve the type. - public object Resolve(Type resolveType) - { - return ResolveInternal(new TypeRegistration(resolveType), NamedParameterOverloads.Default, ResolveOptions.Default); - } - - /// - /// Attempts to resolve a type using specified options. - /// - /// Type to resolve - /// Resolution options - /// Instance of type - /// Unable to resolve the type. - public object Resolve(Type resolveType, ResolveOptions options) - { - return ResolveInternal(new TypeRegistration(resolveType), NamedParameterOverloads.Default, options); - } - - /// - /// Attempts to resolve a type using default options and the supplied name. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Type to resolve - /// Name of registration - /// Instance of type - /// Unable to resolve the type. - public object Resolve(Type resolveType, string name) - { - return ResolveInternal(new TypeRegistration(resolveType, name), NamedParameterOverloads.Default, ResolveOptions.Default); - } - - /// - /// Attempts to resolve a type using supplied options and name. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Type to resolve - /// Name of registration - /// Resolution options - /// Instance of type - /// Unable to resolve the type. - public object Resolve(Type resolveType, string name, ResolveOptions options) - { - return ResolveInternal(new TypeRegistration(resolveType, name), NamedParameterOverloads.Default, options); - } - - /// - /// Attempts to resolve a type using default options and the supplied constructor parameters. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Type to resolve - /// User specified constructor parameters - /// Instance of type - /// Unable to resolve the type. - public object Resolve(Type resolveType, NamedParameterOverloads parameters) - { - return ResolveInternal(new TypeRegistration(resolveType), parameters, ResolveOptions.Default); - } - - /// - /// Attempts to resolve a type using specified options and the supplied constructor parameters. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Type to resolve - /// User specified constructor parameters - /// Resolution options - /// Instance of type - /// Unable to resolve the type. - public object Resolve(Type resolveType, NamedParameterOverloads parameters, ResolveOptions options) - { - return ResolveInternal(new TypeRegistration(resolveType), parameters, options); - } - - /// - /// Attempts to resolve a type using default options and the supplied constructor parameters and name. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Type to resolve - /// User specified constructor parameters - /// Name of registration - /// Instance of type - /// Unable to resolve the type. - public object Resolve(Type resolveType, string name, NamedParameterOverloads parameters) - { - return ResolveInternal(new TypeRegistration(resolveType, name), parameters, ResolveOptions.Default); - } - - /// - /// Attempts to resolve a named type using specified options and the supplied constructor parameters. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Type to resolve - /// Name of registration - /// User specified constructor parameters - /// Resolution options - /// Instance of type - /// Unable to resolve the type. - public object Resolve(Type resolveType, string name, NamedParameterOverloads parameters, ResolveOptions options) - { - return ResolveInternal(new TypeRegistration(resolveType, name), parameters, options); - } - - /// - /// Attempts to resolve a type using default options. - /// - /// Type to resolve - /// Instance of type - /// Unable to resolve the type. - public ResolveType Resolve() - where ResolveType : class - { - return (ResolveType)Resolve(typeof(ResolveType)); - } - - /// - /// Attempts to resolve a type using specified options. - /// - /// Type to resolve - /// Resolution options - /// Instance of type - /// Unable to resolve the type. - public ResolveType Resolve(ResolveOptions options) - where ResolveType : class - { - return (ResolveType)Resolve(typeof(ResolveType), options); - } - - /// - /// Attempts to resolve a type using default options and the supplied name. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Type to resolve - /// Name of registration - /// Instance of type - /// Unable to resolve the type. - public ResolveType Resolve(string name) - where ResolveType : class - { - return (ResolveType)Resolve(typeof(ResolveType), name); - } - - /// - /// Attempts to resolve a type using supplied options and name. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Type to resolve - /// Name of registration - /// Resolution options - /// Instance of type - /// Unable to resolve the type. - public ResolveType Resolve(string name, ResolveOptions options) - where ResolveType : class - { - return (ResolveType)Resolve(typeof(ResolveType), name, options); - } - - /// - /// Attempts to resolve a type using default options and the supplied constructor parameters. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Type to resolve - /// User specified constructor parameters - /// Instance of type - /// Unable to resolve the type. - public ResolveType Resolve(NamedParameterOverloads parameters) - where ResolveType : class - { - return (ResolveType)Resolve(typeof(ResolveType), parameters); - } - - /// - /// Attempts to resolve a type using specified options and the supplied constructor parameters. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Type to resolve - /// User specified constructor parameters - /// Resolution options - /// Instance of type - /// Unable to resolve the type. - public ResolveType Resolve(NamedParameterOverloads parameters, ResolveOptions options) - where ResolveType : class - { - return (ResolveType)Resolve(typeof(ResolveType), parameters, options); - } - - /// - /// Attempts to resolve a type using default options and the supplied constructor parameters and name. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Type to resolve - /// User specified constructor parameters - /// Name of registration - /// Instance of type - /// Unable to resolve the type. - public ResolveType Resolve(string name, NamedParameterOverloads parameters) - where ResolveType : class - { - return (ResolveType)Resolve(typeof(ResolveType), name, parameters); - } - - /// - /// Attempts to resolve a named type using specified options and the supplied constructor parameters. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Type to resolve - /// Name of registration - /// User specified constructor parameters - /// Resolution options - /// Instance of type - /// Unable to resolve the type. - public ResolveType Resolve(string name, NamedParameterOverloads parameters, ResolveOptions options) - where ResolveType : class - { - return (ResolveType)Resolve(typeof(ResolveType), name, parameters, options); - } - - /// - /// Attempts to predict whether a given type can be resolved with default options. - /// - /// Note: Resolution may still fail if user defined factory registrations fail to construct objects when called. - /// - /// Type to resolve - /// Bool indicating whether the type can be resolved - public bool CanResolve(Type resolveType) - { - return CanResolveInternal(new TypeRegistration(resolveType), NamedParameterOverloads.Default, ResolveOptions.Default); - } - - /// - /// Attempts to predict whether a given named type can be resolved with default options. - /// - /// Note: Resolution may still fail if user defined factory registrations fail to construct objects when called. - /// - /// Type to resolve - /// Name of registration - /// Bool indicating whether the type can be resolved - private bool CanResolve(Type resolveType, string name) - { - return CanResolveInternal(new TypeRegistration(resolveType, name), NamedParameterOverloads.Default, ResolveOptions.Default); - } - - /// - /// Attempts to predict whether a given type can be resolved with the specified options. - /// - /// Note: Resolution may still fail if user defined factory registrations fail to construct objects when called. - /// - /// Type to resolve - /// Resolution options - /// Bool indicating whether the type can be resolved - public bool CanResolve(Type resolveType, ResolveOptions options) - { - return CanResolveInternal(new TypeRegistration(resolveType), NamedParameterOverloads.Default, options); - } - - /// - /// Attempts to predict whether a given named type can be resolved with the specified options. - /// - /// Note: Resolution may still fail if user defined factory registrations fail to construct objects when called. - /// - /// Type to resolve - /// Name of registration - /// Resolution options - /// Bool indicating whether the type can be resolved - public bool CanResolve(Type resolveType, string name, ResolveOptions options) - { - return CanResolveInternal(new TypeRegistration(resolveType, name), NamedParameterOverloads.Default, options); - } - - /// - /// Attempts to predict whether a given type can be resolved with the supplied constructor parameters and default options. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Note: Resolution may still fail if user defined factory registrations fail to construct objects when called. - /// - /// Type to resolve - /// User supplied named parameter overloads - /// Bool indicating whether the type can be resolved - public bool CanResolve(Type resolveType, NamedParameterOverloads parameters) - { - return CanResolveInternal(new TypeRegistration(resolveType), parameters, ResolveOptions.Default); - } - - /// - /// Attempts to predict whether a given named type can be resolved with the supplied constructor parameters and default options. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Note: Resolution may still fail if user defined factory registrations fail to construct objects when called. - /// - /// Type to resolve - /// Name of registration - /// User supplied named parameter overloads - /// Bool indicating whether the type can be resolved - public bool CanResolve(Type resolveType, string name, NamedParameterOverloads parameters) - { - return CanResolveInternal(new TypeRegistration(resolveType, name), parameters, ResolveOptions.Default); - } - - /// - /// Attempts to predict whether a given type can be resolved with the supplied constructor parameters options. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Note: Resolution may still fail if user defined factory registrations fail to construct objects when called. - /// - /// Type to resolve - /// User supplied named parameter overloads - /// Resolution options - /// Bool indicating whether the type can be resolved - public bool CanResolve(Type resolveType, NamedParameterOverloads parameters, ResolveOptions options) - { - return CanResolveInternal(new TypeRegistration(resolveType), parameters, options); - } - - /// - /// Attempts to predict whether a given named type can be resolved with the supplied constructor parameters options. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Note: Resolution may still fail if user defined factory registrations fail to construct objects when called. - /// - /// Type to resolve - /// Name of registration - /// User supplied named parameter overloads - /// Resolution options - /// Bool indicating whether the type can be resolved - public bool CanResolve(Type resolveType, string name, NamedParameterOverloads parameters, ResolveOptions options) - { - return CanResolveInternal(new TypeRegistration(resolveType, name), parameters, options); - } - - /// - /// Attempts to predict whether a given type can be resolved with default options. - /// - /// Note: Resolution may still fail if user defined factory registrations fail to construct objects when called. - /// - /// Type to resolve - /// Bool indicating whether the type can be resolved - public bool CanResolve() - where ResolveType : class - { - return CanResolve(typeof(ResolveType)); - } - - /// - /// Attempts to predict whether a given named type can be resolved with default options. - /// - /// Note: Resolution may still fail if user defined factory registrations fail to construct objects when called. - /// - /// Type to resolve - /// Bool indicating whether the type can be resolved - public bool CanResolve(string name) - where ResolveType : class - { - return CanResolve(typeof(ResolveType), name); - } - - /// - /// Attempts to predict whether a given type can be resolved with the specified options. - /// - /// Note: Resolution may still fail if user defined factory registrations fail to construct objects when called. - /// - /// Type to resolve - /// Resolution options - /// Bool indicating whether the type can be resolved - public bool CanResolve(ResolveOptions options) - where ResolveType : class - { - return CanResolve(typeof(ResolveType), options); - } - - /// - /// Attempts to predict whether a given named type can be resolved with the specified options. - /// - /// Note: Resolution may still fail if user defined factory registrations fail to construct objects when called. - /// - /// Type to resolve - /// Name of registration - /// Resolution options - /// Bool indicating whether the type can be resolved - public bool CanResolve(string name, ResolveOptions options) - where ResolveType : class - { - return CanResolve(typeof(ResolveType), name, options); - } - - /// - /// Attempts to predict whether a given type can be resolved with the supplied constructor parameters and default options. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Note: Resolution may still fail if user defined factory registrations fail to construct objects when called. - /// - /// Type to resolve - /// User supplied named parameter overloads - /// Bool indicating whether the type can be resolved - public bool CanResolve(NamedParameterOverloads parameters) - where ResolveType : class - { - return CanResolve(typeof(ResolveType), parameters); - } - - /// - /// Attempts to predict whether a given named type can be resolved with the supplied constructor parameters and default options. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Note: Resolution may still fail if user defined factory registrations fail to construct objects when called. - /// - /// Type to resolve - /// Name of registration - /// User supplied named parameter overloads - /// Bool indicating whether the type can be resolved - public bool CanResolve(string name, NamedParameterOverloads parameters) - where ResolveType : class - { - return CanResolve(typeof(ResolveType), name, parameters); - } - - /// - /// Attempts to predict whether a given type can be resolved with the supplied constructor parameters options. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Note: Resolution may still fail if user defined factory registrations fail to construct objects when called. - /// - /// Type to resolve - /// User supplied named parameter overloads - /// Resolution options - /// Bool indicating whether the type can be resolved - public bool CanResolve(NamedParameterOverloads parameters, ResolveOptions options) - where ResolveType : class - { - return CanResolve(typeof(ResolveType), parameters, options); - } - - /// - /// Attempts to predict whether a given named type can be resolved with the supplied constructor parameters options. - /// - /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). - /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. - /// - /// Note: Resolution may still fail if user defined factory registrations fail to construct objects when called. - /// - /// Type to resolve - /// Name of registration - /// User supplied named parameter overloads - /// Resolution options - /// Bool indicating whether the type can be resolved - public bool CanResolve(string name, NamedParameterOverloads parameters, ResolveOptions options) - where ResolveType : class - { - return CanResolve(typeof(ResolveType), name, parameters, options); - } - - /// - /// Attempts to resolve a type using the default options - /// - /// Type to resolve - /// Resolved type or default if resolve fails - /// True if resolved successfully, false otherwise - public bool TryResolve(Type resolveType, out object resolvedType) - { - try - { - resolvedType = Resolve(resolveType); - return true; - } - catch (TinyIoCResolutionException) - { - resolvedType = null; - return false; - } - } - - /// - /// Attempts to resolve a type using the given options - /// - /// Type to resolve - /// Resolution options - /// Resolved type or default if resolve fails - /// True if resolved successfully, false otherwise - public bool TryResolve(Type resolveType, ResolveOptions options, out object resolvedType) - { - try - { - resolvedType = Resolve(resolveType, options); - return true; - } - catch (TinyIoCResolutionException) - { - resolvedType = null; - return false; - } - } - - /// - /// Attempts to resolve a type using the default options and given name - /// - /// Type to resolve - /// Name of registration - /// Resolved type or default if resolve fails - /// True if resolved successfully, false otherwise - public bool TryResolve(Type resolveType, string name, out object resolvedType) - { - try - { - resolvedType = Resolve(resolveType, name); - return true; - } - catch (TinyIoCResolutionException) - { - resolvedType = null; - return false; - } - } - - /// - /// Attempts to resolve a type using the given options and name - /// - /// Type to resolve - /// Name of registration - /// Resolution options - /// Resolved type or default if resolve fails - /// True if resolved successfully, false otherwise - public bool TryResolve(Type resolveType, string name, ResolveOptions options, out object resolvedType) - { - try - { - resolvedType = Resolve(resolveType, name, options); - return true; - } - catch (TinyIoCResolutionException) - { - resolvedType = null; - return false; - } - } - - /// - /// Attempts to resolve a type using the default options and supplied constructor parameters - /// - /// Type to resolve - /// User specified constructor parameters - /// Resolved type or default if resolve fails - /// True if resolved successfully, false otherwise - public bool TryResolve(Type resolveType, NamedParameterOverloads parameters, out object resolvedType) - { - try - { - resolvedType = Resolve(resolveType, parameters); - return true; - } - catch (TinyIoCResolutionException) - { - resolvedType = null; - return false; - } - } - - /// - /// Attempts to resolve a type using the default options and supplied name and constructor parameters - /// - /// Type to resolve - /// Name of registration - /// User specified constructor parameters - /// Resolved type or default if resolve fails - /// True if resolved successfully, false otherwise - public bool TryResolve(Type resolveType, string name, NamedParameterOverloads parameters, out object resolvedType) - { - try - { - resolvedType = Resolve(resolveType, name, parameters); - return true; - } - catch (TinyIoCResolutionException) - { - resolvedType = null; - return false; - } - } - - /// - /// Attempts to resolve a type using the supplied options and constructor parameters - /// - /// Type to resolve - /// User specified constructor parameters - /// Resolution options - /// Resolved type or default if resolve fails - /// True if resolved successfully, false otherwise - public bool TryResolve(Type resolveType, NamedParameterOverloads parameters, ResolveOptions options, out object resolvedType) - { - try - { - resolvedType = Resolve(resolveType, parameters, options); - return true; - } - catch (TinyIoCResolutionException) - { - resolvedType = null; - return false; - } - } - - /// - /// Attempts to resolve a type using the supplied name, options and constructor parameters - /// - /// Type to resolve - /// Name of registration - /// User specified constructor parameters - /// Resolution options - /// Resolved type or default if resolve fails - /// True if resolved successfully, false otherwise - public bool TryResolve(Type resolveType, string name, NamedParameterOverloads parameters, ResolveOptions options, out object resolvedType) - { - try - { - resolvedType = Resolve(resolveType, name, parameters, options); - return true; - } - catch (TinyIoCResolutionException) - { - resolvedType = null; - return false; - } - } - - /// - /// Attempts to resolve a type using the default options - /// - /// Type to resolve - /// Resolved type or default if resolve fails - /// True if resolved successfully, false otherwise - public bool TryResolve(out ResolveType resolvedType) - where ResolveType : class - { - try - { - resolvedType = Resolve(); - return true; - } - catch (TinyIoCResolutionException) - { - resolvedType = default(ResolveType); - return false; - } - } - - /// - /// Attempts to resolve a type using the given options - /// - /// Type to resolve - /// Resolution options - /// Resolved type or default if resolve fails - /// True if resolved successfully, false otherwise - public bool TryResolve(ResolveOptions options, out ResolveType resolvedType) - where ResolveType : class - { - try - { - resolvedType = Resolve(options); - return true; - } - catch (TinyIoCResolutionException) - { - resolvedType = default(ResolveType); - return false; - } - } - - /// - /// Attempts to resolve a type using the default options and given name - /// - /// Type to resolve - /// Name of registration - /// Resolved type or default if resolve fails - /// True if resolved successfully, false otherwise - public bool TryResolve(string name, out ResolveType resolvedType) - where ResolveType : class - { - try - { - resolvedType = Resolve(name); - return true; - } - catch (TinyIoCResolutionException) - { - resolvedType = default(ResolveType); - return false; - } - } - - /// - /// Attempts to resolve a type using the given options and name - /// - /// Type to resolve - /// Name of registration - /// Resolution options - /// Resolved type or default if resolve fails - /// True if resolved successfully, false otherwise - public bool TryResolve(string name, ResolveOptions options, out ResolveType resolvedType) - where ResolveType : class - { - try - { - resolvedType = Resolve(name, options); - return true; - } - catch (TinyIoCResolutionException) - { - resolvedType = default(ResolveType); - return false; - } - } - - /// - /// Attempts to resolve a type using the default options and supplied constructor parameters - /// - /// Type to resolve - /// User specified constructor parameters - /// Resolved type or default if resolve fails - /// True if resolved successfully, false otherwise - public bool TryResolve(NamedParameterOverloads parameters, out ResolveType resolvedType) - where ResolveType : class - { - try - { - resolvedType = Resolve(parameters); - return true; - } - catch (TinyIoCResolutionException) - { - resolvedType = default(ResolveType); - return false; - } - } - - /// - /// Attempts to resolve a type using the default options and supplied name and constructor parameters - /// - /// Type to resolve - /// Name of registration - /// User specified constructor parameters - /// Resolved type or default if resolve fails - /// True if resolved successfully, false otherwise - public bool TryResolve(string name, NamedParameterOverloads parameters, out ResolveType resolvedType) - where ResolveType : class - { - try - { - resolvedType = Resolve(name, parameters); - return true; - } - catch (TinyIoCResolutionException) - { - resolvedType = default(ResolveType); - return false; - } - } - - /// - /// Attempts to resolve a type using the supplied options and constructor parameters - /// - /// Type to resolve - /// User specified constructor parameters - /// Resolution options - /// Resolved type or default if resolve fails - /// True if resolved successfully, false otherwise - public bool TryResolve(NamedParameterOverloads parameters, ResolveOptions options, out ResolveType resolvedType) - where ResolveType : class - { - try - { - resolvedType = Resolve(parameters, options); - return true; - } - catch (TinyIoCResolutionException) - { - resolvedType = default(ResolveType); - return false; - } - } - - /// - /// Attempts to resolve a type using the supplied name, options and constructor parameters - /// - /// Type to resolve - /// Name of registration - /// User specified constructor parameters - /// Resolution options - /// Resolved type or default if resolve fails - /// True if resolved successfully, false otherwise - public bool TryResolve(string name, NamedParameterOverloads parameters, ResolveOptions options, out ResolveType resolvedType) - where ResolveType : class - { - try - { - resolvedType = Resolve(name, parameters, options); - return true; - } - catch (TinyIoCResolutionException) - { - resolvedType = default(ResolveType); - return false; - } - } - - /// - /// Returns all registrations of a type - /// - /// Type to resolveAll - /// Whether to include un-named (default) registrations - /// IEnumerable - public IEnumerable ResolveAll(Type resolveType, bool includeUnnamed) - { - return ResolveAllInternal(resolveType, includeUnnamed); - } - - /// - /// Returns all registrations of a type, both named and unnamed - /// - /// Type to resolveAll - /// IEnumerable - public IEnumerable ResolveAll(Type resolveType) - { - return ResolveAll(resolveType, true); - } - - /// - /// Returns all registrations of a type - /// - /// Type to resolveAll - /// Whether to include un-named (default) registrations - /// IEnumerable - public IEnumerable ResolveAll(bool includeUnnamed) - where ResolveType : class - { - return this.ResolveAll(typeof(ResolveType), includeUnnamed).Cast(); - } - - /// - /// Returns all registrations of a type, both named and unnamed - /// - /// Type to resolveAll - /// IEnumerable - public IEnumerable ResolveAll() - where ResolveType : class - { - return ResolveAll(true); - } - - /// - /// Attempts to resolve all public property dependencies on the given object. - /// - /// Object to "build up" - public void BuildUp(object input) - { - BuildUpInternal(input, ResolveOptions.Default); - } - - /// - /// Attempts to resolve all public property dependencies on the given object using the given resolve options. - /// - /// Object to "build up" - /// Resolve options to use - public void BuildUp(object input, ResolveOptions resolveOptions) - { - BuildUpInternal(input, resolveOptions); - } - #endregion - #endregion - - #region Object Factories - /// - /// Provides custom lifetime management for ASP.Net per-request lifetimes etc. - /// - public interface ITinyIoCObjectLifetimeProvider - { - /// - /// Gets the stored object if it exists, or null if not - /// - /// Object instance or null - object GetObject(); - - /// - /// Store the object - /// - /// Object to store - void SetObject(object value); - - /// - /// Release the object - /// - void ReleaseObject(); - } - - private abstract class ObjectFactoryBase - { - /// - /// Whether to assume this factory successfully constructs its objects - /// - /// Generally set to true for delegate style factories as CanResolve cannot delve - /// into the delegates they contain. - /// - public virtual bool AssumeConstruction { get { return false; } } - - /// - /// The type the factory instantiates - /// - public abstract Type CreatesType { get; } - - /// - /// Constructor to use, if specified - /// - public ConstructorInfo Constructor { get; protected set; } - - /// - /// Create the type - /// - /// Type user requested to be resolved - /// Container that requested the creation - /// Any user parameters passed - /// - /// - public abstract object GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options); - - public virtual ObjectFactoryBase SingletonVariant - { - get - { - throw new TinyIoCRegistrationException(this.GetType(), "singleton"); - } - } - - public virtual ObjectFactoryBase MultiInstanceVariant - { - get - { - throw new TinyIoCRegistrationException(this.GetType(), "multi-instance"); - } - } - - public virtual ObjectFactoryBase StrongReferenceVariant - { - get - { - throw new TinyIoCRegistrationException(this.GetType(), "strong reference"); - } - } - - public virtual ObjectFactoryBase WeakReferenceVariant - { - get - { - throw new TinyIoCRegistrationException(this.GetType(), "weak reference"); - } - } - - public virtual ObjectFactoryBase GetCustomObjectLifetimeVariant(ITinyIoCObjectLifetimeProvider lifetimeProvider, string errorString) - { - throw new TinyIoCRegistrationException(this.GetType(), errorString); - } - - public virtual void SetConstructor(ConstructorInfo constructor) - { - Constructor = constructor; - } - - public virtual ObjectFactoryBase GetFactoryForChildContainer(Type type, TinyIoCContainer parent, TinyIoCContainer child) - { - return this; - } - } - - /// - /// IObjectFactory that creates new instances of types for each resolution - /// - private class MultiInstanceFactory : ObjectFactoryBase - { - private readonly Type registerType; - private readonly Type registerImplementation; - public override Type CreatesType { get { return this.registerImplementation; } } - - public MultiInstanceFactory(Type registerType, Type registerImplementation) - { - //#if NETFX_CORE - // if (registerImplementation.GetTypeInfo().IsAbstract() || registerImplementation.GetTypeInfo().IsInterface()) - // throw new TinyIoCRegistrationTypeException(registerImplementation, "MultiInstanceFactory"); - //#else - if (registerImplementation.IsAbstract() || registerImplementation.IsInterface()) - throw new TinyIoCRegistrationTypeException(registerImplementation, "MultiInstanceFactory"); - //#endif - if (!IsValidAssignment(registerType, registerImplementation)) - throw new TinyIoCRegistrationTypeException(registerImplementation, "MultiInstanceFactory"); - - this.registerType = registerType; - this.registerImplementation = registerImplementation; - } - - public override object GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options) - { - try - { - return container.ConstructType(requestedType, this.registerImplementation, Constructor, parameters, options); - } - catch (TinyIoCResolutionException ex) - { - throw new TinyIoCResolutionException(this.registerType, ex); - } - } - - public override ObjectFactoryBase SingletonVariant - { - get - { - return new SingletonFactory(this.registerType, this.registerImplementation); - } - } - - public override ObjectFactoryBase GetCustomObjectLifetimeVariant(ITinyIoCObjectLifetimeProvider lifetimeProvider, string errorString) - { - return new CustomObjectLifetimeFactory(this.registerType, this.registerImplementation, lifetimeProvider, errorString); - } - - public override ObjectFactoryBase MultiInstanceVariant - { - get - { - return this; - } - } - } - - /// - /// IObjectFactory that invokes a specified delegate to construct the object - /// - private class DelegateFactory : ObjectFactoryBase - { - private readonly Type registerType; - - private Func _factory; - - public override bool AssumeConstruction { get { return true; } } - - public override Type CreatesType { get { return this.registerType; } } - - public override object GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options) - { - try - { - return _factory.Invoke(container, parameters); - } - catch (Exception ex) - { - throw new TinyIoCResolutionException(this.registerType, ex); - } - } - - public DelegateFactory(Type registerType, Func factory) - { - if (factory == null) - throw new ArgumentNullException("factory"); - - _factory = factory; - - this.registerType = registerType; - } - - public override ObjectFactoryBase WeakReferenceVariant - { - get - { - return new WeakDelegateFactory(this.registerType, _factory); - } - } - - public override ObjectFactoryBase StrongReferenceVariant - { - get - { - return this; - } - } - - public override void SetConstructor(ConstructorInfo constructor) - { - throw new TinyIoCConstructorResolutionException("Constructor selection is not possible for delegate factory registrations"); - } - } - - /// - /// IObjectFactory that invokes a specified delegate to construct the object - /// Holds the delegate using a weak reference - /// - private class WeakDelegateFactory : ObjectFactoryBase - { - private readonly Type registerType; - - private WeakReference _factory; - - public override bool AssumeConstruction { get { return true; } } - - public override Type CreatesType { get { return this.registerType; } } - - public override object GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options) - { - var factory = _factory.Target as Func; - - if (factory == null) - throw new TinyIoCWeakReferenceException(this.registerType); - - try - { - return factory.Invoke(container, parameters); - } - catch (Exception ex) - { - throw new TinyIoCResolutionException(this.registerType, ex); - } - } - - public WeakDelegateFactory(Type registerType, Func factory) - { - if (factory == null) - throw new ArgumentNullException("factory"); - - _factory = new WeakReference(factory); - - this.registerType = registerType; - } - - public override ObjectFactoryBase StrongReferenceVariant - { - get - { - var factory = _factory.Target as Func; - - if (factory == null) - throw new TinyIoCWeakReferenceException(this.registerType); - - return new DelegateFactory(this.registerType, factory); - } - } - - public override ObjectFactoryBase WeakReferenceVariant - { - get - { - return this; - } - } - - public override void SetConstructor(ConstructorInfo constructor) - { - throw new TinyIoCConstructorResolutionException("Constructor selection is not possible for delegate factory registrations"); - } - } - - /// - /// Stores an particular instance to return for a type - /// - private class InstanceFactory : ObjectFactoryBase, IDisposable - { - private readonly Type registerType; - private readonly Type registerImplementation; - private object _instance; - - public override bool AssumeConstruction { get { return true; } } - - public InstanceFactory(Type registerType, Type registerImplementation, object instance) - { - if (!IsValidAssignment(registerType, registerImplementation)) - throw new TinyIoCRegistrationTypeException(registerImplementation, "InstanceFactory"); - - this.registerType = registerType; - this.registerImplementation = registerImplementation; - _instance = instance; - } - - public override Type CreatesType - { - get { return this.registerImplementation; } - } - - public override object GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options) - { - return _instance; - } - - public override ObjectFactoryBase MultiInstanceVariant - { - get { return new MultiInstanceFactory(this.registerType, this.registerImplementation); } - } - - public override ObjectFactoryBase WeakReferenceVariant - { - get - { - return new WeakInstanceFactory(this.registerType, this.registerImplementation, this._instance); - } - } - - public override ObjectFactoryBase StrongReferenceVariant - { - get - { - return this; - } - } - - public override void SetConstructor(ConstructorInfo constructor) - { - throw new TinyIoCConstructorResolutionException("Constructor selection is not possible for instance factory registrations"); - } - - public void Dispose() - { - var disposable = _instance as IDisposable; - - if (disposable != null) - disposable.Dispose(); - } - } - - /// - /// Stores an particular instance to return for a type - /// - /// Stores the instance with a weak reference - /// - private class WeakInstanceFactory : ObjectFactoryBase, IDisposable - { - private readonly Type registerType; - private readonly Type registerImplementation; - private readonly WeakReference _instance; - - public WeakInstanceFactory(Type registerType, Type registerImplementation, object instance) - { - if (!IsValidAssignment(registerType, registerImplementation)) - throw new TinyIoCRegistrationTypeException(registerImplementation, "WeakInstanceFactory"); - - this.registerType = registerType; - this.registerImplementation = registerImplementation; - _instance = new WeakReference(instance); - } - - public override Type CreatesType - { - get { return this.registerImplementation; } - } - - public override object GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options) - { - var instance = _instance.Target; - - if (instance == null) - throw new TinyIoCWeakReferenceException(this.registerType); - - return instance; - } - - public override ObjectFactoryBase MultiInstanceVariant - { - get - { - return new MultiInstanceFactory(this.registerType, this.registerImplementation); - } - } - - public override ObjectFactoryBase WeakReferenceVariant - { - get - { - return this; - } - } - - public override ObjectFactoryBase StrongReferenceVariant - { - get - { - var instance = _instance.Target; - - if (instance == null) - throw new TinyIoCWeakReferenceException(this.registerType); - - return new InstanceFactory(this.registerType, this.registerImplementation, instance); - } - } - - public override void SetConstructor(ConstructorInfo constructor) - { - throw new TinyIoCConstructorResolutionException("Constructor selection is not possible for instance factory registrations"); - } - - public void Dispose() - { - var disposable = _instance.Target as IDisposable; - - if (disposable != null) - disposable.Dispose(); - } - } - - /// - /// A factory that lazy instantiates a type and always returns the same instance - /// - private class SingletonFactory : ObjectFactoryBase, IDisposable - { - private readonly Type registerType; - private readonly Type registerImplementation; - private readonly object SingletonLock = new object(); - private object _Current; - - public SingletonFactory(Type registerType, Type registerImplementation) - { - //#if NETFX_CORE - // if (registerImplementation.GetTypeInfo().IsAbstract() || registerImplementation.GetTypeInfo().IsInterface()) - //#else - if (registerImplementation.IsAbstract() || registerImplementation.IsInterface()) - //#endif - throw new TinyIoCRegistrationTypeException(registerImplementation, "SingletonFactory"); - - if (!IsValidAssignment(registerType, registerImplementation)) - throw new TinyIoCRegistrationTypeException(registerImplementation, "SingletonFactory"); - - this.registerType = registerType; - this.registerImplementation = registerImplementation; - } - - public override Type CreatesType - { - get { return this.registerImplementation; } - } - - public override object GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options) - { - if (parameters.Count != 0) - throw new ArgumentException("Cannot specify parameters for singleton types"); - - lock (SingletonLock) - if (_Current == null) - _Current = container.ConstructType(requestedType, this.registerImplementation, Constructor, options); - - return _Current; - } - - public override ObjectFactoryBase SingletonVariant - { - get - { - return this; - } - } - - public override ObjectFactoryBase GetCustomObjectLifetimeVariant(ITinyIoCObjectLifetimeProvider lifetimeProvider, string errorString) - { - return new CustomObjectLifetimeFactory(this.registerType, this.registerImplementation, lifetimeProvider, errorString); - } - - public override ObjectFactoryBase MultiInstanceVariant - { - get - { - return new MultiInstanceFactory(this.registerType, this.registerImplementation); - } - } - - public override ObjectFactoryBase GetFactoryForChildContainer(Type type, TinyIoCContainer parent, TinyIoCContainer child) - { - // We make sure that the singleton is constructed before the child container takes the factory. - // Otherwise the results would vary depending on whether or not the parent container had resolved - // the type before the child container does. - GetObject(type, parent, NamedParameterOverloads.Default, ResolveOptions.Default); - return this; - } - - public void Dispose() - { - if (this._Current == null) - return; - - var disposable = this._Current as IDisposable; - - if (disposable != null) - disposable.Dispose(); - } - } - - /// - /// A factory that offloads lifetime to an external lifetime provider - /// - private class CustomObjectLifetimeFactory : ObjectFactoryBase, IDisposable - { - private readonly object SingletonLock = new object(); - private readonly Type registerType; - private readonly Type registerImplementation; - private readonly ITinyIoCObjectLifetimeProvider _LifetimeProvider; - - public CustomObjectLifetimeFactory(Type registerType, Type registerImplementation, ITinyIoCObjectLifetimeProvider lifetimeProvider, string errorMessage) - { - if (lifetimeProvider == null) - throw new ArgumentNullException("lifetimeProvider", "lifetimeProvider is null."); - - if (!IsValidAssignment(registerType, registerImplementation)) - throw new TinyIoCRegistrationTypeException(registerImplementation, "SingletonFactory"); - - //#if NETFX_CORE - // if (registerImplementation.GetTypeInfo().IsAbstract() || registerImplementation.GetTypeInfo().IsInterface()) - //#else - if (registerImplementation.IsAbstract() || registerImplementation.IsInterface()) - //#endif - throw new TinyIoCRegistrationTypeException(registerImplementation, errorMessage); - - this.registerType = registerType; - this.registerImplementation = registerImplementation; - _LifetimeProvider = lifetimeProvider; - } - - public override Type CreatesType - { - get { return this.registerImplementation; } - } - - public override object GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options) - { - object current; - - lock (SingletonLock) - { - current = _LifetimeProvider.GetObject(); - if (current == null) - { - current = container.ConstructType(requestedType, this.registerImplementation, Constructor, options); - _LifetimeProvider.SetObject(current); - } - } - - return current; - } - - public override ObjectFactoryBase SingletonVariant - { - get - { - _LifetimeProvider.ReleaseObject(); - return new SingletonFactory(this.registerType, this.registerImplementation); - } - } - - public override ObjectFactoryBase MultiInstanceVariant - { - get - { - _LifetimeProvider.ReleaseObject(); - return new MultiInstanceFactory(this.registerType, this.registerImplementation); - } - } - - public override ObjectFactoryBase GetCustomObjectLifetimeVariant(ITinyIoCObjectLifetimeProvider lifetimeProvider, string errorString) - { - _LifetimeProvider.ReleaseObject(); - return new CustomObjectLifetimeFactory(this.registerType, this.registerImplementation, lifetimeProvider, errorString); - } - - public override ObjectFactoryBase GetFactoryForChildContainer(Type type, TinyIoCContainer parent, TinyIoCContainer child) - { - // We make sure that the singleton is constructed before the child container takes the factory. - // Otherwise the results would vary depending on whether or not the parent container had resolved - // the type before the child container does. - GetObject(type, parent, NamedParameterOverloads.Default, ResolveOptions.Default); - return this; - } - - public void Dispose() - { - _LifetimeProvider.ReleaseObject(); - } - } - #endregion - - #region Singleton Container - private static readonly TinyIoCContainer _Current = new TinyIoCContainer(); - - static TinyIoCContainer() - { - } - - /// - /// Lazy created Singleton instance of the container for simple scenarios - /// - public static TinyIoCContainer Current - { - get - { - return _Current; - } - } - #endregion - - #region Type Registrations - public sealed class TypeRegistration - { - private int _hashCode; - - public Type Type { get; private set; } - public string Name { get; private set; } - - public TypeRegistration(Type type) - : this(type, string.Empty) - { - } - - public TypeRegistration(Type type, string name) - { - Type = type; - Name = name; - - _hashCode = String.Concat(Type.FullName, "|", Name).GetHashCode(); - } - - public override bool Equals(object obj) - { - var typeRegistration = obj as TypeRegistration; - - if (typeRegistration == null) - return false; - - if (Type != typeRegistration.Type) - return false; - - if (String.Compare(Name, typeRegistration.Name, StringComparison.Ordinal) != 0) - return false; - - return true; - } - - public override int GetHashCode() - { - return _hashCode; - } - } - private readonly SafeDictionary _RegisteredTypes; -#if USE_OBJECT_CONSTRUCTOR - private delegate object ObjectConstructor(params object[] parameters); - private static readonly SafeDictionary _ObjectConstructorCache = new SafeDictionary(); -#endif - #endregion - - #region Constructors - public TinyIoCContainer() - { - _RegisteredTypes = new SafeDictionary(); - - RegisterDefaultTypes(); - } - - TinyIoCContainer _Parent; - private TinyIoCContainer(TinyIoCContainer parent) - : this() - { - _Parent = parent; - } - #endregion - - #region Internal Methods - private readonly object _AutoRegisterLock = new object(); - private void AutoRegisterInternal(IEnumerable assemblies, DuplicateImplementationActions duplicateAction, Func registrationPredicate) - { - lock (_AutoRegisterLock) - { - var types = assemblies.SelectMany(a => a.SafeGetTypes()).Where(t => !IsIgnoredType(t, registrationPredicate)).ToList(); - - var concreteTypes = types - .Where(type => type.IsClass() && (type.IsAbstract() == false) && (type != this.GetType() && (type.DeclaringType != this.GetType()) && (!type.IsGenericTypeDefinition()))) - .ToList(); - - foreach (var type in concreteTypes) - { - try - { - RegisterInternal(type, string.Empty, GetDefaultObjectFactory(type, type)); - } -#if PORTABLE || NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 || NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 || NETSTANDARD1_6 - catch (MemberAccessException) -#else - catch (MethodAccessException) -#endif - { - // Ignore methods we can't access - added for Silverlight - } - } - - var abstractInterfaceTypes = from type in types - where ((type.IsInterface() || type.IsAbstract()) && (type.DeclaringType != this.GetType()) && (!type.IsGenericTypeDefinition())) - select type; - - foreach (var type in abstractInterfaceTypes) - { - var localType = type; - var implementations = from implementationType in concreteTypes - where localType.IsAssignableFrom(implementationType) - select implementationType; - - if (implementations.Skip(1).Any()) - { - if (duplicateAction == DuplicateImplementationActions.Fail) - throw new TinyIoCAutoRegistrationException(type, implementations); - - if (duplicateAction == DuplicateImplementationActions.RegisterMultiple) - { - RegisterMultiple(type, implementations); - } - } - - var firstImplementation = implementations.FirstOrDefault(); - if (firstImplementation != null) - { - try - { - RegisterInternal(type, string.Empty, GetDefaultObjectFactory(type, firstImplementation)); - } -#if PORTABLE || NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 || NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 || NETSTANDARD1_6 - catch (MemberAccessException) -#else - catch (MethodAccessException) -#endif - { - // Ignore methods we can't access - added for Silverlight - } - } - } - } - } - - private bool IsIgnoredAssembly(Assembly assembly) - { - // TODO - find a better way to remove "system" assemblies from the auto registration - var ignoreChecks = new List>() - { - asm => asm.FullName.StartsWith("Microsoft.", StringComparison.Ordinal), - asm => asm.FullName.StartsWith("System.", StringComparison.Ordinal), - asm => asm.FullName.StartsWith("System,", StringComparison.Ordinal), - asm => asm.FullName.StartsWith("CR_ExtUnitTest", StringComparison.Ordinal), - asm => asm.FullName.StartsWith("mscorlib,", StringComparison.Ordinal), - asm => asm.FullName.StartsWith("CR_VSTest", StringComparison.Ordinal), - asm => asm.FullName.StartsWith("DevExpress.CodeRush", StringComparison.Ordinal), - asm => asm.FullName.StartsWith("xunit.", StringComparison.Ordinal), - }; - - foreach (var check in ignoreChecks) - { - if (check(assembly)) - return true; - } - - return false; - } - - private bool IsIgnoredType(Type type, Func registrationPredicate) - { - // TODO - find a better way to remove "system" types from the auto registration - var ignoreChecks = new List>() - { - t => t.FullName.StartsWith("System.", StringComparison.Ordinal), - t => t.FullName.StartsWith("Microsoft.", StringComparison.Ordinal), - t => t.IsPrimitive(), -#if !UNBOUND_GENERICS_GETCONSTRUCTORS - t => t.IsGenericTypeDefinition(), -#endif - t => (t.GetConstructors(BindingFlags.Instance | BindingFlags.Public).Length == 0) && !(t.IsInterface() || t.IsAbstract()), - }; - - if (registrationPredicate != null) - { - ignoreChecks.Add(t => !registrationPredicate(t)); - } - - foreach (var check in ignoreChecks) - { - if (check(type)) - return true; - } - - return false; - } - - private void RegisterDefaultTypes() - { - Register(this); - -#if TINYMESSENGER - // Only register the TinyMessenger singleton if we are the root container - if (_Parent == null) - Register(); -#endif - } - - private ObjectFactoryBase GetCurrentFactory(TypeRegistration registration) - { - ObjectFactoryBase current = null; - - _RegisteredTypes.TryGetValue(registration, out current); - - return current; - } - - private RegisterOptions RegisterInternal(Type registerType, string name, ObjectFactoryBase factory) - { - var typeRegistration = new TypeRegistration(registerType, name); - - return AddUpdateRegistration(typeRegistration, factory); - } - - private RegisterOptions AddUpdateRegistration(TypeRegistration typeRegistration, ObjectFactoryBase factory) - { - _RegisteredTypes[typeRegistration] = factory; - - return new RegisterOptions(this, typeRegistration); - } - - private bool RemoveRegistration(TypeRegistration typeRegistration) - { - return _RegisteredTypes.Remove(typeRegistration); - } - - private ObjectFactoryBase GetDefaultObjectFactory(Type registerType, Type registerImplementation) - { - //#if NETFX_CORE - // if (registerType.GetTypeInfo().IsInterface() || registerType.GetTypeInfo().IsAbstract()) - //#else - if (registerType.IsInterface() || registerType.IsAbstract()) - //#endif - return new SingletonFactory(registerType, registerImplementation); - - return new MultiInstanceFactory(registerType, registerImplementation); - } - - private bool CanResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options) - { - if (parameters == null) - throw new ArgumentNullException("parameters"); - - Type checkType = registration.Type; - string name = registration.Name; - - ObjectFactoryBase factory; - if (_RegisteredTypes.TryGetValue(new TypeRegistration(checkType, name), out factory)) - { - if (factory.AssumeConstruction) - return true; - - if (factory.Constructor == null) - return (GetBestConstructor(factory.CreatesType, parameters, options) != null) ? true : false; - else - return CanConstruct(factory.Constructor, parameters, options); - } - -#if RESOLVE_OPEN_GENERICS - if (checkType.IsInterface() && checkType.IsGenericType()) - { - // if the type is registered as an open generic, then see if the open generic is registered - if (_RegisteredTypes.TryGetValue(new TypeRegistration(checkType.GetGenericTypeDefinition(), name), out factory)) - { - if (factory.AssumeConstruction) - return true; - - if (factory.Constructor == null) - return (GetBestConstructor(factory.CreatesType, parameters, options) != null) ? true : false; - else - return CanConstruct(factory.Constructor, parameters, options); - } - } -#endif - - // Fail if requesting named resolution and settings set to fail if unresolved - // Or bubble up if we have a parent - if (!string.IsNullOrEmpty(name) && options.NamedResolutionFailureAction == NamedResolutionFailureActions.Fail) - return (_Parent != null) ? _Parent.CanResolveInternal(registration, parameters, options) : false; - - // Attempted unnamed fallback container resolution if relevant and requested - if (!string.IsNullOrEmpty(name) && options.NamedResolutionFailureAction == NamedResolutionFailureActions.AttemptUnnamedResolution) - { - if (_RegisteredTypes.TryGetValue(new TypeRegistration(checkType), out factory)) - { - if (factory.AssumeConstruction) - return true; - - return (GetBestConstructor(factory.CreatesType, parameters, options) != null) ? true : false; - } - } - - // Check if type is an automatic lazy factory request - if (IsAutomaticLazyFactoryRequest(checkType)) - return true; - - // Check if type is an IEnumerable - if (IsIEnumerableRequest(registration.Type)) - return true; - - // Attempt unregistered construction if possible and requested - // If we cant', bubble if we have a parent - if ((options.UnregisteredResolutionAction == UnregisteredResolutionActions.AttemptResolve) || (checkType.IsGenericType() && options.UnregisteredResolutionAction == UnregisteredResolutionActions.GenericsOnly)) - return (GetBestConstructor(checkType, parameters, options) != null) ? true : (_Parent != null) ? _Parent.CanResolveInternal(registration, parameters, options) : false; - - // Bubble resolution up the container tree if we have a parent - if (_Parent != null) - return _Parent.CanResolveInternal(registration, parameters, options); - - return false; - } - - private bool IsIEnumerableRequest(Type type) - { - if (!type.IsGenericType()) - return false; - - Type genericType = type.GetGenericTypeDefinition(); - - if (genericType == typeof(IEnumerable<>)) - return true; - - return false; - } - - private bool IsAutomaticLazyFactoryRequest(Type type) - { - if (!type.IsGenericType()) - return false; - - Type genericType = type.GetGenericTypeDefinition(); - - // Just a func - if (genericType == typeof(Func<>)) - return true; - - // 2 parameter func with string as first parameter (name) - //#if NETFX_CORE - // if ((genericType == typeof(Func<,>) && type.GetTypeInfo().GenericTypeArguments[0] == typeof(string))) - //#else - if ((genericType == typeof(Func<,>) && type.GetGenericArguments()[0] == typeof(string))) - //#endif - return true; - - // 3 parameter func with string as first parameter (name) and IDictionary as second (parameters) - //#if NETFX_CORE - // if ((genericType == typeof(Func<,,>) && type.GetTypeInfo().GenericTypeArguments[0] == typeof(string) && type.GetTypeInfo().GenericTypeArguments[1] == typeof(IDictionary))) - //#else - if ((genericType == typeof(Func<,,>) && type.GetGenericArguments()[0] == typeof(string) && type.GetGenericArguments()[1] == typeof(IDictionary))) - //#endif - return true; - - return false; - } - - private ObjectFactoryBase GetParentObjectFactory(TypeRegistration registration) - { - if (_Parent == null) - return null; - - ObjectFactoryBase factory; - - if (registration.Type.IsGenericType()) - { - var openTypeRegistration = new TypeRegistration(registration.Type, - registration.Name); - - if (_Parent._RegisteredTypes.TryGetValue(openTypeRegistration, out factory)) - { - return factory.GetFactoryForChildContainer(openTypeRegistration.Type, _Parent, this); - } - - return _Parent.GetParentObjectFactory(registration); - } - - if (_Parent._RegisteredTypes.TryGetValue(registration, out factory)) - { - return factory.GetFactoryForChildContainer(registration.Type, _Parent, this); - } - - return _Parent.GetParentObjectFactory(registration); - } - - private object ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options) - { - ObjectFactoryBase factory; - - // Attempt container resolution - if (_RegisteredTypes.TryGetValue(registration, out factory)) - { - try - { - return factory.GetObject(registration.Type, this, parameters, options); - } - catch (TinyIoCResolutionException) - { - throw; - } - catch (Exception ex) - { - throw new TinyIoCResolutionException(registration.Type, ex); - } - } - -#if RESOLVE_OPEN_GENERICS - // Attempt container resolution of open generic - if (registration.Type.IsGenericType()) - { - var openTypeRegistration = new TypeRegistration(registration.Type.GetGenericTypeDefinition(), - registration.Name); - - if (_RegisteredTypes.TryGetValue(openTypeRegistration, out factory)) - { - try - { - return factory.GetObject(registration.Type, this, parameters, options); - } - catch (TinyIoCResolutionException) - { - throw; - } - catch (Exception ex) - { - throw new TinyIoCResolutionException(registration.Type, ex); - } - } - } -#endif - - // Attempt to get a factory from parent if we can - var bubbledObjectFactory = GetParentObjectFactory(registration); - if (bubbledObjectFactory != null) - { - try - { - return bubbledObjectFactory.GetObject(registration.Type, this, parameters, options); - } - catch (TinyIoCResolutionException) - { - throw; - } - catch (Exception ex) - { - throw new TinyIoCResolutionException(registration.Type, ex); - } - } - - // Fail if requesting named resolution and settings set to fail if unresolved - if (!string.IsNullOrEmpty(registration.Name) && options.NamedResolutionFailureAction == NamedResolutionFailureActions.Fail) - throw new TinyIoCResolutionException(registration.Type); - - // Attempted unnamed fallback container resolution if relevant and requested - if (!string.IsNullOrEmpty(registration.Name) && options.NamedResolutionFailureAction == NamedResolutionFailureActions.AttemptUnnamedResolution) - { - if (_RegisteredTypes.TryGetValue(new TypeRegistration(registration.Type, string.Empty), out factory)) - { - try - { - return factory.GetObject(registration.Type, this, parameters, options); - } - catch (TinyIoCResolutionException) - { - throw; - } - catch (Exception ex) - { - throw new TinyIoCResolutionException(registration.Type, ex); - } - } - } - -#if EXPRESSIONS - // Attempt to construct an automatic lazy factory if possible - if (IsAutomaticLazyFactoryRequest(registration.Type)) - return GetLazyAutomaticFactoryRequest(registration.Type); -#endif - if (IsIEnumerableRequest(registration.Type)) - return GetIEnumerableRequest(registration.Type); - - // Attempt unregistered construction if possible and requested - if ((options.UnregisteredResolutionAction == UnregisteredResolutionActions.AttemptResolve) || (registration.Type.IsGenericType() && options.UnregisteredResolutionAction == UnregisteredResolutionActions.GenericsOnly)) - { - if (!registration.Type.IsAbstract() && !registration.Type.IsInterface()) - return ConstructType(null, registration.Type, parameters, options); - } - - // Unable to resolve - throw - throw new TinyIoCResolutionException(registration.Type); - } - -#if EXPRESSIONS - private object GetLazyAutomaticFactoryRequest(Type type) - { - if (!type.IsGenericType()) - return null; - - Type genericType = type.GetGenericTypeDefinition(); - //#if NETFX_CORE - // Type[] genericArguments = type.GetTypeInfo().GenericTypeArguments.ToArray(); - //#else - Type[] genericArguments = type.GetGenericArguments(); - //#endif - - // Just a func - if (genericType == typeof(Func<>)) - { - Type returnType = genericArguments[0]; - - //#if NETFX_CORE - // MethodInfo resolveMethod = typeof(TinyIoCContainer).GetTypeInfo().GetDeclaredMethods("Resolve").First(mi => !mi.GetParameters().Any()); - //#else - MethodInfo resolveMethod = typeof(TinyIoCContainer).GetMethod("Resolve", new Type[] { }); - //#endif - resolveMethod = resolveMethod.MakeGenericMethod(returnType); - - var resolveCall = Expression.Call(Expression.Constant(this), resolveMethod); - - var resolveLambda = Expression.Lambda(resolveCall).Compile(); - - return resolveLambda; - } - - // 2 parameter func with string as first parameter (name) - if ((genericType == typeof(Func<,>)) && (genericArguments[0] == typeof(string))) - { - Type returnType = genericArguments[1]; - - //#if NETFX_CORE - // MethodInfo resolveMethod = typeof(TinyIoCContainer).GetTypeInfo().GetDeclaredMethods("Resolve").First(mi => mi.GetParameters().Length == 1 && mi.GetParameters()[0].GetType() == typeof(String)); - //#else - MethodInfo resolveMethod = typeof(TinyIoCContainer).GetMethod("Resolve", new Type[] { typeof(String) }); - //#endif - resolveMethod = resolveMethod.MakeGenericMethod(returnType); - - ParameterExpression[] resolveParameters = new ParameterExpression[] { Expression.Parameter(typeof(String), "name") }; - var resolveCall = Expression.Call(Expression.Constant(this), resolveMethod, resolveParameters); - - var resolveLambda = Expression.Lambda(resolveCall, resolveParameters).Compile(); - - return resolveLambda; - } - - // 3 parameter func with string as first parameter (name) and IDictionary as second (parameters) - //#if NETFX_CORE - // if ((genericType == typeof(Func<,,>) && type.GenericTypeArguments[0] == typeof(string) && type.GenericTypeArguments[1] == typeof(IDictionary))) - //#else - if ((genericType == typeof(Func<,,>) && type.GetGenericArguments()[0] == typeof(string) && type.GetGenericArguments()[1] == typeof(IDictionary))) - //#endif - { - Type returnType = genericArguments[2]; - - var name = Expression.Parameter(typeof(string), "name"); - var parameters = Expression.Parameter(typeof(IDictionary), "parameters"); - - //#if NETFX_CORE - // MethodInfo resolveMethod = typeof(TinyIoCContainer).GetTypeInfo().GetDeclaredMethods("Resolve").First(mi => mi.GetParameters().Length == 2 && mi.GetParameters()[0].GetType() == typeof(String) && mi.GetParameters()[1].GetType() == typeof(NamedParameterOverloads)); - //#else - MethodInfo resolveMethod = typeof(TinyIoCContainer).GetMethod("Resolve", new Type[] { typeof(String), typeof(NamedParameterOverloads) }); - //#endif - resolveMethod = resolveMethod.MakeGenericMethod(returnType); - - var resolveCall = Expression.Call(Expression.Constant(this), resolveMethod, name, Expression.Call(typeof(NamedParameterOverloads), "FromIDictionary", null, parameters)); - - var resolveLambda = Expression.Lambda(resolveCall, name, parameters).Compile(); - - return resolveLambda; - } - - throw new TinyIoCResolutionException(type); - } -#endif - private object GetIEnumerableRequest(Type type) - { - //#if NETFX_CORE - // var genericResolveAllMethod = this.GetType().GetGenericMethod("ResolveAll", type.GenericTypeArguments, new[] { typeof(bool) }); - //#else - var genericResolveAllMethod = this.GetType().GetGenericMethod(BindingFlags.Public | BindingFlags.Instance, "ResolveAll", type.GetGenericArguments(), new[] { typeof(bool) }); - //#endif - - return genericResolveAllMethod.Invoke(this, new object[] { false }); - } - - private bool CanConstruct(ConstructorInfo ctor, NamedParameterOverloads parameters, ResolveOptions options) - { - if (parameters == null) - throw new ArgumentNullException("parameters"); - - foreach (var parameter in ctor.GetParameters()) - { - if (string.IsNullOrEmpty(parameter.Name)) - return false; - - var isParameterOverload = parameters.ContainsKey(parameter.Name); - - //#if NETFX_CORE - // if (parameter.ParameterType.GetTypeInfo().IsPrimitive && !isParameterOverload) - //#else - if (parameter.ParameterType.IsPrimitive() && !isParameterOverload) - //#endif - return false; - - if (!isParameterOverload && !CanResolveInternal(new TypeRegistration(parameter.ParameterType), NamedParameterOverloads.Default, options)) - return false; - } - - return true; - } - - private ConstructorInfo GetBestConstructor(Type type, NamedParameterOverloads parameters, ResolveOptions options) - { - if (parameters == null) - throw new ArgumentNullException("parameters"); - - //#if NETFX_CORE - // if (type.GetTypeInfo().IsValueType) - //#else - if (type.IsValueType()) - //#endif - return null; - - // Get constructors in reverse order based on the number of parameters - // i.e. be as "greedy" as possible so we satify the most amount of dependencies possible - var ctors = this.GetTypeConstructors(type); - - foreach (var ctor in ctors) - { - if (this.CanConstruct(ctor, parameters, options)) - return ctor; - } - - return null; - } - - private IEnumerable GetTypeConstructors(Type type) - { - //#if NETFX_CORE - // return type.GetTypeInfo().DeclaredConstructors.OrderByDescending(ctor => ctor.GetParameters().Count()); - //#else - var candidateCtors = type.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) - .Where(x => !x.IsPrivate) // Includes internal constructors but not private constructors - .Where(x => !x.IsFamily) // Excludes protected constructors - .ToList(); - - var attributeCtors = candidateCtors.Where(x => x.GetCustomAttributes(typeof(TinyIoCConstructorAttribute), false).Any()) - .ToList(); - - if (attributeCtors.Any()) - candidateCtors = attributeCtors; - - return candidateCtors.OrderByDescending(ctor => ctor.GetParameters().Count()); - //#endif - } - - private object ConstructType(Type requestedType, Type implementationType, ResolveOptions options) - { - return ConstructType(requestedType, implementationType, null, NamedParameterOverloads.Default, options); - } - - private object ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, ResolveOptions options) - { - return ConstructType(requestedType, implementationType, constructor, NamedParameterOverloads.Default, options); - } - - private object ConstructType(Type requestedType, Type implementationType, NamedParameterOverloads parameters, ResolveOptions options) - { - return ConstructType(requestedType, implementationType, null, parameters, options); - } - - private object ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options) - { - var typeToConstruct = implementationType; - -#if RESOLVE_OPEN_GENERICS - if (implementationType.IsGenericTypeDefinition()) - { - if (requestedType == null || !requestedType.IsGenericType() || !requestedType.GetGenericArguments().Any()) - throw new TinyIoCResolutionException(typeToConstruct); - - typeToConstruct = typeToConstruct.MakeGenericType(requestedType.GetGenericArguments()); - } -#endif - if (constructor == null) - { - // Try and get the best constructor that we can construct - // if we can't construct any then get the constructor - // with the least number of parameters so we can throw a meaningful - // resolve exception - constructor = GetBestConstructor(typeToConstruct, parameters, options) ?? GetTypeConstructors(typeToConstruct).LastOrDefault(); - } - - if (constructor == null) - throw new TinyIoCResolutionException(typeToConstruct); - - var ctorParams = constructor.GetParameters(); - object[] args = new object[ctorParams.Count()]; - - for (int parameterIndex = 0; parameterIndex < ctorParams.Count(); parameterIndex++) - { - var currentParam = ctorParams[parameterIndex]; - - try - { - args[parameterIndex] = parameters.ContainsKey(currentParam.Name) ? - parameters[currentParam.Name] : - ResolveInternal( - new TypeRegistration(currentParam.ParameterType), - NamedParameterOverloads.Default, - options); - } - catch (TinyIoCResolutionException ex) - { - // If a constructor parameter can't be resolved - // it will throw, so wrap it and throw that this can't - // be resolved. - throw new TinyIoCResolutionException(typeToConstruct, ex); - } - catch (Exception ex) - { - throw new TinyIoCResolutionException(typeToConstruct, ex); - } - } - - try - { -#if USE_OBJECT_CONSTRUCTOR - var constructionDelegate = CreateObjectConstructionDelegateWithCache(constructor); - return constructionDelegate.Invoke(args); -#else - return constructor.Invoke(args); -#endif - } - catch (Exception ex) - { - throw new TinyIoCResolutionException(typeToConstruct, ex); - } - } - -#if USE_OBJECT_CONSTRUCTOR - private static ObjectConstructor CreateObjectConstructionDelegateWithCache(ConstructorInfo constructor) - { - ObjectConstructor objectConstructor; - if (_ObjectConstructorCache.TryGetValue(constructor, out objectConstructor)) - return objectConstructor; - - // We could lock the cache here, but there's no real side - // effect to two threads creating the same ObjectConstructor - // at the same time, compared to the cost of a lock for - // every creation. - var constructorParams = constructor.GetParameters(); - var lambdaParams = Expression.Parameter(typeof(object[]), "parameters"); - var newParams = new Expression[constructorParams.Length]; - - for (int i = 0; i < constructorParams.Length; i++) - { - var paramsParameter = Expression.ArrayIndex(lambdaParams, Expression.Constant(i)); - - newParams[i] = Expression.Convert(paramsParameter, constructorParams[i].ParameterType); - } - - var newExpression = Expression.New(constructor, newParams); - - var constructionLambda = Expression.Lambda(typeof(ObjectConstructor), newExpression, lambdaParams); - - objectConstructor = (ObjectConstructor)constructionLambda.Compile(); - - _ObjectConstructorCache[constructor] = objectConstructor; - return objectConstructor; - } -#endif - - private void BuildUpInternal(object input, ResolveOptions resolveOptions) - { - //#if NETFX_CORE - // var properties = from property in input.GetType().GetTypeInfo().DeclaredProperties - // where (property.GetMethod != null) && (property.SetMethod != null) && !property.PropertyType.GetTypeInfo().IsValueType - // select property; - //#else - var properties = from property in input.GetType().GetProperties() - where (property.GetGetMethod() != null) && (property.GetSetMethod() != null) && !property.PropertyType.IsValueType() - select property; - //#endif - - foreach (var property in properties) - { - if (property.GetValue(input, null) == null) - { - try - { - property.SetValue(input, ResolveInternal(new TypeRegistration(property.PropertyType), NamedParameterOverloads.Default, resolveOptions), null); - } - catch (TinyIoCResolutionException) - { - // Catch any resolution errors and ignore them - } - } - } - } - - private IEnumerable GetParentRegistrationsForType(Type resolveType) - { - if (_Parent == null) - return new TypeRegistration[] { }; - - var registrations = _Parent._RegisteredTypes.Keys.Where(tr => tr.Type == resolveType); - - return registrations.Concat(_Parent.GetParentRegistrationsForType(resolveType)); - } - - private IEnumerable ResolveAllInternal(Type resolveType, bool includeUnnamed) - { - var registrations = _RegisteredTypes.Keys.Where(tr => tr.Type == resolveType).Concat(GetParentRegistrationsForType(resolveType)).Distinct(); - - if (!includeUnnamed) - registrations = registrations.Where(tr => tr.Name != string.Empty); - - return registrations.Select(registration => this.ResolveInternal(registration, NamedParameterOverloads.Default, ResolveOptions.Default)); - } - - private static bool IsValidAssignment(Type registerType, Type registerImplementation) - { - if (!registerType.IsGenericTypeDefinition()) - { - if (!registerType.IsAssignableFrom(registerImplementation)) - return false; - } - else - { - if (registerType.IsInterface()) - { -#if (PORTABLE || NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 || NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 || NETSTANDARD1_6) - if (!registerImplementation.GetInterfaces().Any(t => t.Name == registerType.Name)) - return false; -#else - if (!registerImplementation.FindInterfaces((t, o) => t.Name == registerType.Name, null).Any()) - return false; -#endif - } - else if (registerType.IsAbstract() && registerImplementation.BaseType() != registerType) - { - return false; - } - } - //#endif - return true; - } - - #endregion - - #region IDisposable Members - bool disposed = false; - public void Dispose() - { - if (!disposed) - { - disposed = true; - - _RegisteredTypes.Dispose(); - - GC.SuppressFinalize(this); - } - } - - #endregion - } - -#if PORTABLE || NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 || NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 || NETSTANDARD1_6 - static class ReverseTypeExtender - { - public static bool IsClass(this Type type) - { - return type.GetTypeInfo().IsClass; - } - - public static bool IsAbstract(this Type type) - { - return type.GetTypeInfo().IsAbstract; - } - - public static bool IsInterface(this Type type) - { - return type.GetTypeInfo().IsInterface; - } - - public static bool IsPrimitive(this Type type) - { - return type.GetTypeInfo().IsPrimitive; - } - - public static bool IsValueType(this Type type) - { - return type.GetTypeInfo().IsValueType; - } - - public static bool IsGenericType(this Type type) - { - return type.GetTypeInfo().IsGenericType; - } - - public static bool IsGenericParameter(this Type type) - { - return type.IsGenericParameter; - } - - public static bool IsGenericTypeDefinition(this Type type) - { - return type.GetTypeInfo().IsGenericTypeDefinition; - } - - public static Type BaseType(this Type type) - { - return type.GetTypeInfo().BaseType; - } - - public static Assembly Assembly(this Type type) - { - return type.GetTypeInfo().Assembly; - } - } -#endif - // reverse shim for WinRT SR changes... -#if (!NETFX_CORE && !PORTABLE && !NETSTANDARD1_0 && !NETSTANDARD1_1 && !NETSTANDARD1_2 && !NETSTANDARD1_3 && !NETSTANDARD1_4 && !NETSTANDARD1_5 && !NETSTANDARD1_6) - static class ReverseTypeExtender - { - public static bool IsClass(this Type type) - { - return type.IsClass; - } - - public static bool IsAbstract(this Type type) - { - return type.IsAbstract; - } - - public static bool IsInterface(this Type type) - { - return type.IsInterface; - } - - public static bool IsPrimitive(this Type type) - { - return type.IsPrimitive; - } - - public static bool IsValueType(this Type type) - { - return type.IsValueType; - } - - public static bool IsGenericType(this Type type) - { - return type.IsGenericType; - } - - public static bool IsGenericParameter(this Type type) - { - return type.IsGenericParameter; - } - - public static bool IsGenericTypeDefinition(this Type type) - { - return type.IsGenericTypeDefinition; - } - - public static Type BaseType(this Type type) - { - return type.BaseType; - } - - public static Assembly Assembly(this Type type) - { - return type.Assembly; - } - } -#endif - - [AttributeUsage(AttributeTargets.Constructor, Inherited = false, AllowMultiple = false)] -#if TINYIOC_INTERNAL - internal -#else - public -#endif - sealed class TinyIoCConstructorAttribute : Attribute - { - } -} diff --git a/Borepin/Borepin/Behaviour/Base/BehaviorBase.cs b/Borepin/Borepin/Behaviour/Base/BehaviorBase.cs deleted file mode 100644 index 807a4f2..0000000 --- a/Borepin/Borepin/Behaviour/Base/BehaviorBase.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using Xamarin.Forms; - -namespace Borepin.Behaviour.Base -{ - public class BehaviorBase : Behavior where T : BindableObject - { - public T AssociatedObject { get; private set; } - protected override void OnAttachedTo(T bindable) - { - base.OnAttachedTo(bindable); - AssociatedObject = bindable; - - if (bindable.BindingContext != null) - BindingContext = bindable.BindingContext; - - bindable.BindingContextChanged += OnBindingContextChanged; - } - protected override void OnDetachingFrom(T bindable) - { - base.OnDetachingFrom(bindable); - bindable.BindingContextChanged -= OnBindingContextChanged; - AssociatedObject = null; - } - - void OnBindingContextChanged(object sender, EventArgs e) - { - OnBindingContextChanged(); - } - - protected override void OnBindingContextChanged() - { - base.OnBindingContextChanged(); - BindingContext = AssociatedObject.BindingContext; - } - } -} diff --git a/Borepin/Borepin/Behaviour/EventToCommandBehavior.cs b/Borepin/Borepin/Behaviour/EventToCommandBehavior.cs deleted file mode 100644 index 65441a2..0000000 --- a/Borepin/Borepin/Behaviour/EventToCommandBehavior.cs +++ /dev/null @@ -1,91 +0,0 @@ -using Borepin.Behaviour.Base; -using System; -using System.Reflection; -using System.Windows.Input; -using Xamarin.Forms; - -namespace Borepin.Behaviour -{ - public class EventToCommandBehavior : BehaviorBase - { - Delegate eventHandler; - public static readonly BindableProperty EventNameProperty = BindableProperty.Create("EventName", typeof(string), typeof(EventToCommandBehavior), null, propertyChanged: OnEventNameChanged); - public static readonly BindableProperty CommandProperty = BindableProperty.Create("Command", typeof(ICommand), typeof(EventToCommandBehavior), null); - - public string EventName - { - get { return (string)GetValue(EventNameProperty); } - set { SetValue(EventNameProperty, value); } - } - public ICommand Command - { - get { return (ICommand)GetValue(CommandProperty); } - set { SetValue(CommandProperty, value); } - } - - protected override void OnAttachedTo(VisualElement bindable) - { - base.OnAttachedTo(bindable); - RegisterEvent(EventName); - } - - protected override void OnDetachingFrom(VisualElement bindable) - { - DeregisterEvent(EventName); - base.OnDetachingFrom(bindable); - } - static void OnEventNameChanged(BindableObject bindable, object oldValue, object newValue) - { - var behavior = (EventToCommandBehavior)bindable; - - if (behavior.AssociatedObject == null) return; - - string oldEventName = (string)oldValue; - string newEventName = (string)newValue; - - behavior.DeregisterEvent(oldEventName); - behavior.RegisterEvent(newEventName); - } - - void RegisterEvent(string name) - { - if (string.IsNullOrWhiteSpace(name)) return; - - EventInfo eventInfo = AssociatedObject.GetType().GetRuntimeEvent(name); - - if (eventInfo == null) - throw new ArgumentException(string.Format("EventToCommandBehavior: Can't register the '{0}' event.", EventName)); - - MethodInfo methodInfo = typeof(EventToCommandBehavior).GetTypeInfo().GetDeclaredMethod("OnEvent"); - eventHandler = methodInfo.CreateDelegate(eventInfo.EventHandlerType, this); - eventInfo.AddEventHandler(AssociatedObject, eventHandler); - } - - void DeregisterEvent(string name) - { - if (string.IsNullOrWhiteSpace(name) || eventHandler == null) - return; - - EventInfo eventInfo = AssociatedObject.GetType().GetRuntimeEvent(name); - - if (eventInfo == null) - throw new ArgumentException(string.Format("EventToCommandBehavior: Can't de-register the '{0}' event.", EventName)); - - eventInfo.RemoveEventHandler(AssociatedObject, eventHandler); - eventHandler = null; - } - - void OnEvent(object sender, object eventArgs) - { - if (Command == null) return; - - object resolvedParameter; - - resolvedParameter = eventArgs; - - if (Command.CanExecute(resolvedParameter)) - Command.Execute(resolvedParameter); - } - - } -} diff --git a/Borepin/Borepin/Borepin.csproj b/Borepin/Borepin/Borepin.csproj index 4cdc56d..c0c1859 100644 --- a/Borepin/Borepin/Borepin.csproj +++ b/Borepin/Borepin/Borepin.csproj @@ -20,19 +20,11 @@ - + + - - BorpinMasterDetailPage.xaml - - - BorpinMasterPage.xaml - - - MachinesPage.xaml - True True @@ -48,22 +40,13 @@ - + MSBuild:UpdateDesignTimeXaml - + MSBuild:UpdateDesignTimeXaml - - MSBuild:UpdateDesignTimeXaml - - - MSBuild:UpdateDesignTimeXaml - - - MSBuild:UpdateDesignTimeXaml - - + MSBuild:UpdateDesignTimeXaml @@ -78,4 +61,9 @@ MSBuild:UpdateDesignTimeXaml + + + + + \ No newline at end of file diff --git a/Borepin/Borepin/MainPage.xaml b/Borepin/Borepin/MainPage.xaml deleted file mode 100644 index 9496e16..0000000 --- a/Borepin/Borepin/MainPage.xaml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - diff --git a/Borepin/Borepin/MainPage.xaml.cs b/Borepin/Borepin/MainPage.xaml.cs deleted file mode 100644 index 9e9ded9..0000000 --- a/Borepin/Borepin/MainPage.xaml.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Xamarin.Forms; - -namespace Borepin -{ - public partial class MainPage : ContentPage - { - public MainPage() - { - InitializeComponent(); - } - } -} diff --git a/Borepin/Borepin/Page/BorpinMasterDetailPage.xaml b/Borepin/Borepin/Page/BorpinMasterDetailPage.xaml deleted file mode 100644 index 013e144..0000000 --- a/Borepin/Borepin/Page/BorpinMasterDetailPage.xaml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/Borepin/Borepin/Page/BorpinMasterDetailPage.xaml.cs b/Borepin/Borepin/Page/BorpinMasterDetailPage.xaml.cs deleted file mode 100644 index bdcd427..0000000 --- a/Borepin/Borepin/Page/BorpinMasterDetailPage.xaml.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Xamarin.Forms; -using Xamarin.Forms.Xaml; - -namespace Borepin.Page -{ - [XamlCompilation(XamlCompilationOptions.Compile)] - public partial class BorpinMasterDetailPage : MasterDetailPage - { - public BorpinMasterDetailPage() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/Borepin/Borepin/Page/BorpinMasterPage.xaml b/Borepin/Borepin/Page/BorpinMasterPage.xaml deleted file mode 100644 index 2547888..0000000 --- a/Borepin/Borepin/Page/BorpinMasterPage.xaml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Borepin/Borepin/Page/BorpinMasterPage.xaml.cs b/Borepin/Borepin/Page/BorpinMasterPage.xaml.cs deleted file mode 100644 index e88b29d..0000000 --- a/Borepin/Borepin/Page/BorpinMasterPage.xaml.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -using Xamarin.Forms; -using Xamarin.Forms.Xaml; - -namespace Borepin.Page -{ - [XamlCompilation(XamlCompilationOptions.Compile)] - public partial class BorpinMasterPage : ContentPage - { - public BorpinMasterPage() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/Borepin/Borepin/Page/DashboardPage.xaml.cs b/Borepin/Borepin/Page/DashboardPage.xaml.cs deleted file mode 100644 index 2a48fbd..0000000 --- a/Borepin/Borepin/Page/DashboardPage.xaml.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using Xamarin.Forms; -using Xamarin.Forms.Xaml; - -namespace Borepin.Page -{ - [XamlCompilation(XamlCompilationOptions.Compile)] - public partial class DashboardPage : ContentPage - { - public DashboardPage() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/Borepin/Borepin/Page/MachinesPage.xaml b/Borepin/Borepin/Page/MachinesPage.xaml deleted file mode 100644 index 2aaf35a..0000000 --- a/Borepin/Borepin/Page/MachinesPage.xaml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Borepin/Borepin/Page/MachinesPage.xaml.cs b/Borepin/Borepin/Page/MachinesPage.xaml.cs deleted file mode 100644 index 83d1f70..0000000 --- a/Borepin/Borepin/Page/MachinesPage.xaml.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using Xamarin.Forms; -using Xamarin.Forms.Xaml; - -namespace Borepin.Page -{ - [XamlCompilation(XamlCompilationOptions.Compile)] - public partial class MachinesPage : ContentPage - { - public MachinesPage() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/Borepin/Borepin/Page/MainPage.xaml b/Borepin/Borepin/Page/MainPage.xaml new file mode 100644 index 0000000..f7c33b8 --- /dev/null +++ b/Borepin/Borepin/Page/MainPage.xaml @@ -0,0 +1,32 @@ + + + + + +