void UpdateFlyoutPageContainers() { ((FlyoutPage)Element).Flyout.PropertyChanged -= HandleFlyoutPropertyChanged; EmptyContainers(); var flyoutRenderer = ((FlyoutPage)Element).Flyout.ToHandler(MauiContext); var detailRenderer = ((FlyoutPage)Element).Detail.ToHandler(MauiContext); ((FlyoutPage)Element).Flyout.PropertyChanged += HandleFlyoutPropertyChanged; UIView flyoutView = flyoutRenderer.ViewController.View; _flyoutController.View.AddSubview(flyoutView); _flyoutController.AddChildViewController(flyoutRenderer.ViewController); UIView detailView = detailRenderer.ViewController.View; _detailController.View.AddSubview(detailView); _detailController.AddChildViewController(detailRenderer.ViewController); SetNeedsStatusBarAppearanceUpdate(); if (PlatformVersion.Supports(PlatformApis.RespondsToSetNeedsUpdateOfHomeIndicatorAutoHidden)) { SetNeedsUpdateOfHomeIndicatorAutoHidden(); } if (detailRenderer.ViewController.View.Superview != null) { detailRenderer.ViewController.View.Superview.BackgroundColor = Microsoft.Maui.Graphics.Colors.Black.ToPlatform(); } ToggleAccessibilityElementsHidden(); }
void AlignEmptyView() { if (_emptyUIView == null) { return; } bool isRtl; if (PlatformVersion.IsAtLeast(10)) isRtl = CollectionView.EffectiveUserInterfaceLayoutDirection == UIUserInterfaceLayoutDirection.RightToLeft; else isRtl = CollectionView.SemanticContentAttribute == UISemanticContentAttribute.ForceRightToLeft; if (isRtl) { if (_emptyUIView.Transform.A == -1) { return; } FlipEmptyView(); } else { if (_emptyUIView.Transform.A == -1) { FlipEmptyView(); } } }
void UpdateSelectedTabColors() { if (Tabbed == null || TabBar == null || TabBar.Items == null) { return; } if (Tabbed.IsSet(TabbedPage.SelectedTabColorProperty) && Tabbed.SelectedTabColor != null) { TabBar.TintColor = Tabbed.SelectedTabColor.ToPlatform(); } else { TabBar.TintColor = UITabBar.Appearance.TintColor; } if (PlatformVersion.IsAtLeast(15)) { UpdateiOS15TabBarAppearance(); } else { if (Tabbed.IsSet(TabbedPage.UnselectedTabColorProperty) && Tabbed.UnselectedTabColor != null) { TabBar.UnselectedItemTintColor = Tabbed.UnselectedTabColor.ToPlatform(); } else { TabBar.UnselectedItemTintColor = UITabBar.Appearance.TintColor; } } }
public virtual void SetAppearance(UITabBarController controller, ShellAppearance appearance) { IShellAppearanceElement appearanceElement = appearance; var backgroundColor = appearanceElement.EffectiveTabBarBackgroundColor; var foregroundColor = appearanceElement.EffectiveTabBarForegroundColor; // Currently unused var disabledColor = appearanceElement.EffectiveTabBarDisabledColor; // Unused on iOS var unselectedColor = appearanceElement.EffectiveTabBarUnselectedColor; var titleColor = appearanceElement.EffectiveTabBarTitleColor; var tabBar = controller.TabBar; if (_defaultTint == null) { _defaultBarTint = tabBar.BarTintColor; _defaultTint = tabBar.TintColor; _defaultUnselectedTint = tabBar.UnselectedItemTintColor; } if (PlatformVersion.IsAtLeast(15)) { UpdateiOS15TabBarAppearance(controller, appearance); } else { UpdateTabBarAppearance(controller, appearance); } }
internal async Task FirstLoadUrlAsync(string url) { try { var uri = new Uri(url); var safeHostUri = new Uri($"{uri.Scheme}://{uri.Authority}", UriKind.Absolute); var safeRelativeUri = new Uri($"{uri.PathAndQuery}{uri.Fragment}", UriKind.Relative); NSUrlRequest request = new NSUrlRequest(new Uri(safeHostUri, safeRelativeUri)); if (HasCookiesToLoad(url) && !PlatformVersion.IsAtLeast(11)) { return; } await SyncPlatformCookiesAsync(url); PlatformView?.LoadRequest(request); } catch (UriFormatException) { // If we got a format exception trying to parse the URI, it might be because // someone is passing in a local bundled file page. If we can find a better way // to detect that scenario, we should use it; until then, we'll fall back to // local file loading here and see if that works: if (!LoadFile(url)) { MauiContext?.CreateLogger <WebViewHandler>()?.LogWarning($"Unable to Load Url {url}"); } } catch (Exception) { MauiContext?.CreateLogger <WebViewHandler>()?.LogWarning($"Unable to Load Url {url}"); } }
private WPDevice GetDevice(PlatformVersion version) { var platform = GetPlatform(version); var getDevicesMethod = platform.GetType().GetMethod("GetDevices", new Type[0]); var devices = (IEnumerable)getDevicesMethod.Invoke(platform, new object[0]); object device = null; foreach (var d in devices) { var nameProperty = d.GetType().GetProperty("Name").GetGetMethod(); var name = (string)nameProperty.Invoke(d, new object[0]); if (CheckDevice(name, version)) { device = d; break; } } if (device == null) { throw new InvalidOperationException("There is no registered Windows Phone device."); } return(CreateDevice(device, version)); }
public ApplicationCodeStyle() { DoNotPrintEmptyReportDataItems = true; DoNotPrintEmptyWordReportLayout = true; DoNotPrintEmptyRequestForm = true; PlatformVersion = new PlatformVersion("NAV2013"); }
void OnPagePropertyChanged(object sender, PropertyChangedEventArgs e) { // Setting TabBarItem.Title in iOS 10 causes rendering bugs // Work around this by creating a new UITabBarItem on each change if (e.PropertyName == Page.TitleProperty.PropertyName && !PlatformVersion.IsAtLeast(10)) { var page = (Page)sender; var renderer = page.ToHandler(_mauiContext); if (renderer == null) { return; } if (renderer.ViewController.TabBarItem != null) { renderer.ViewController.TabBarItem.Title = page.Title; } } else if (e.PropertyName == Page.IconImageSourceProperty.PropertyName || e.PropertyName == Page.TitleProperty.PropertyName && PlatformVersion.IsAtLeast(10)) { var page = (Page)sender; IPlatformViewHandler renderer = page.ToHandler(_mauiContext); if (renderer?.ViewController.TabBarItem == null) { return; } SetTabBarItem(renderer); } }
void UpdateVerticalBounce() { // Normally we dont want to do this unless this scrollview is vertical and its // element is the child of a Page with a SearchHandler that is collapsible. // If we can't bounce in that case you may not be able to expose the handler. // Also the hiding behavior only depends on scroll on iOS 11. In 10 and below // the search goes in the TitleView so there is nothing to collapse/expand. if (!PlatformVersion.IsAtLeast(11) || (_renderer.VirtualView is ScrollView scrollView && scrollView.Orientation == ScrollOrientation.Horizontal)) { return; } var parent = _renderer.VirtualView.Parent; while (!Application.IsApplicationOrNull(parent)) { if (parent is Page page) { var searchHandler = Shell.GetSearchHandler(page); if (searchHandler?.SearchBoxVisibility == SearchBoxVisibility.Collapsible) { _scrollView.AlwaysBounceVertical = true; } return; } parent = parent.Parent; } }
public bool Reset() { if (!_isInShell) { return(false); } if (_lastInset == 0 && _tabThickness == 0) { return(false); } if (!PlatformVersion.IsAtLeast(11)) { UpdateContentInset(_lastInset, _tabThickness); return(true); } if (ShellSectionController.GetItems().Count > 1 && _isInItems) { UpdateContentInset(_lastInset, _tabThickness); return(true); } return(false); }
private void ReadCommandLineArgs() { string[] args = Environment.GetCommandLineArgs(); appID = new Guid(args[1]); deviceType = (DeviceType)Enum.Parse(typeof(DeviceType), args[2]); platformVersion = (PlatformVersion)Enum.Parse(typeof(PlatformVersion), args[3]); }
static bool CanExecuteTest() { #if __IOS__ return(PlatformVersion.IsAtLeast(13)); #else return(true); #endif }
private static object GetDatastore(PlatformVersion version) { Assembly assembly = SelectSDKAssembly(version); Type datastoreType = assembly.GetType(DatastoreManagerTypeName); var ctor = datastoreType.GetConstructor(new Type[] { typeof(int) }); return(ctor.Invoke(new object[] { LocaleId })); }
void UpdateBarTextColor() { if (Tabbed == null || TabBar == null || TabBar.Items == null) { return; } var barTextColor = Tabbed.BarTextColor; var isDefaultColor = barTextColor == null; if (isDefaultColor && !_barTextColorWasSet) { return; } if (!_defaultBarTextColorSet) { _defaultBarTextColor = TabBar.TintColor; _defaultBarTextColorSet = true; } if (!isDefaultColor) { _barTextColorWasSet = true; } UIColor tabBarTextColor; if (isDefaultColor) { tabBarTextColor = _defaultBarTextColor; } else { tabBarTextColor = barTextColor.ToPlatform(); } var attributes = new UIStringAttributes(); attributes.ForegroundColor = tabBarTextColor; foreach (UITabBarItem item in TabBar.Items) { item.SetTitleTextAttributes(attributes, UIControlState.Normal); } // set TintColor for selected icon // setting the unselected icon tint is not supported by iOS if (PlatformVersion.IsAtLeast(15)) { UpdateiOS15TabBarAppearance(); } else { TabBar.TintColor = isDefaultColor ? _defaultBarTextColor : barTextColor.ToPlatform(); } }
public static JObject CreateNetCoreRuntimeOptions(PlatformVersion version) { return(new JObject( new JProperty("runtimeOptions", new JObject( new JProperty("tfm", version.TargetFrameworkMoniker), new JProperty("framework", new JObject( new JProperty("name", version.FrameworkName), new JProperty("version", version.FrameworkVersion))))))); }
protected virtual void OnRendererSet() { NavigationItem = ViewController.NavigationItem; if (!PlatformVersion.IsAtLeast(11)) { ViewController.AutomaticallyAdjustsScrollViewInsets = false; } }
public override void ViewDidLoad() { base.ViewDidLoad(); SetNeedsStatusBarAppearanceUpdate(); if (PlatformVersion.Supports(PlatformApis.RespondsToSetNeedsUpdateOfHomeIndicatorAutoHidden)) { SetNeedsUpdateOfHomeIndicatorAutoHidden(); } }
public override void TraitCollectionDidChange(UITraitCollection previousTraitCollection) { base.TraitCollectionDidChange(previousTraitCollection); // Make sure the cells adhere to changes UI theme if (PlatformVersion.IsAtLeast(13) && previousTraitCollection?.UserInterfaceStyle != TraitCollection.UserInterfaceStyle) { Control.ReloadData(); } }
public override void TraitCollectionDidChange(UITraitCollection previousTraitCollection) { base.TraitCollectionDidChange(previousTraitCollection); // Make sure the control adheres to changes in UI theme if (PlatformVersion.IsAtLeast(13) && previousTraitCollection?.UserInterfaceStyle != TraitCollection.UserInterfaceStyle) { SetupLayer(); } }
void ApplyWindowsAttributes(PlatformVersion result) { result.Attributes.Add("\"" + PlainWindowsSku + "\""); if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ProgramW6432"))) { result.Attributes.Add("WOW64"); } }
double GetNativeMinimum(SliderHandler sliderHandler) { if (PlatformVersion.Supports(PlatformApis.SeekBarSetMin)) { return(GetNativeSlider(sliderHandler).Min); } return(0); }
IEnumerable <PlatformVersion> IPlatformVersionFinder.FindPlatformVersions() { var s = Environment.OSVersion; if (s.Version != null) { var result = new PlatformVersion(s.Platform.ToString(), s.Version.ToString(), null); yield return(result); } }
public static bool UseGradients(this GradientDrawable gradientDrawable) { if (!PlatformVersion.IsAtLeast(24)) { return(false); } var colors = gradientDrawable.GetColors(); return(colors != null && colors.Length > 1); }
/// <summary> /// Returns Windows Phone device or emulator. /// </summary> /// <exception cref="InvalidOperationException">If no Windows Phone device or emulator is registered.</exception> public WPDevice GetDevice(DeviceType deviceType, PlatformVersion version) { switch (deviceType) { case DeviceType.Emulator: return GetEmulator(version); case DeviceType.Device: return GetDevice(version); default: throw new NotSupportedException(String.Format("Device type '{0}' is not supported.", deviceType.ToString())); } }
public void Load(DataRow row) { try { m_id = (row.Table.Columns.Contains("id") && row["id"].ToString().Trim().Length > 0) ? new Guid(row["id"] as string) : Guid.NewGuid(); //m_sipUsername = row["sipusername"] as string; //m_sipPassword = row["sippassword"] as string; //m_sipDomain = row["sipdomain"] as string; //m_owner = (row.Table.Columns.Contains("owner") && row["owner"] != null) ? row["owner"] as string : SIPUsername; m_localID = (row.Table.Columns.Contains("localID") && row["localID"] != null) ? row["localID"] as string : null; string localEP = (row.Table.Columns.Contains("localSocket") && row["localSocket"] != null) ? row["localSocket"] as string : null; if (localEP != null) { m_localIP = IPAddress.Parse(localEP.Split(':')[0]); m_localPort = ushort.Parse(localEP.Split(':')[1]); } m_remoteID = (row.Table.Columns.Contains("remoteID") && row["remoteID"] != null) ? row["remoteID"] as string : null; string remoteEP = (row.Table.Columns.Contains("remoteSocket") && row["remoteSocket"] != null) ? row["remoteSocket"] as string : null; if (remoteEP != null) { m_remoteIP = IPAddress.Parse(remoteEP.Split(':')[0]); m_remotePort = ushort.Parse(remoteEP.Split(':')[1]); } byte platformType = (row.Table.Columns.Contains("platformType") && row["platformType"] != null) ? byte.Parse(row["platformType"].ToString()) : (byte)0; m_platformType = (PlatformType)platformType; byte platformVersion = (row.Table.Columns.Contains("platformVersion") && row["platformVersion"] != null) ? byte.Parse(row["platformVersion"].ToString()) : (byte)0; m_platformVersion = (PlatformVersion)platformVersion; m_remoteID = (row.Table.Columns.Contains("remoteID") && row["remoteID"] != null) ? row["remoteID"] as string : null; m_owner = (row.Table.Columns.Contains("owner") && row["owner"] != null) ? row["owner"] as string : SIPUsername; AdminMemberId = (row.Table.Columns.Contains("adminmemberid") && row["adminmemberid"] != null) ? row["adminmemberid"] as string : null; m_sendNATKeepAlives = (row.Table.Columns.Contains("sendnatkeepalives") && row["sendnatkeepalives"] != null && row["sendnatkeepalives"] != DBNull.Value) ? Convert.ToBoolean(row["sendnatkeepalives"]) : false; m_isIncomingOnly = (row.Table.Columns.Contains("isincomingonly") && row["isincomingonly"] != null && row["isincomingonly"] != DBNull.Value) ? Convert.ToBoolean(row["isincomingonly"]) : false; m_outDialPlanName = (row.Table.Columns.Contains("outdialplanname") && row["outdialplanname"] != null && row["outdialplanname"].ToString().Trim().Length > 0) ? row["outdialplanname"] as string : null; m_inDialPlanName = (row.Table.Columns.Contains("indialplanname") && row["indialplanname"] != null && row["indialplanname"].ToString().Trim().Length > 0) ? row["indialplanname"] as string : null; m_isUserDisabled = (row.Table.Columns.Contains("isuserdisabled") && row["isuserdisabled"] != null && row["isuserdisabled"] != DBNull.Value) ? Convert.ToBoolean(row["isuserdisabled"]) : false; m_isAdminDisabled = (row.Table.Columns.Contains("isadmindisabled") && row["isadmindisabled"] != null && row["isadmindisabled"] != DBNull.Value) ? Convert.ToBoolean(row["isadmindisabled"]) : false; m_adminDisabledReason = (row.Table.Columns.Contains("admindisabledreason") && row["admindisabledreason"] != null) ? row["admindisabledreason"] as string : null; m_inserted = (row.Table.Columns.Contains("inserted") && row["inserted"] != null) ? DateTimeOffset.Parse(row["inserted"] as string) : DateTimeOffset.UtcNow; m_networkId = (row.Table.Columns.Contains("networkid") && row["networkid"] != null) ? row["networkid"] as string : null; m_ipAddressACL = (row.Table.Columns.Contains("ipaddressacl") && row["ipaddressacl"] != null) ? row["ipaddressacl"] as string : null; m_isSwitchboardEnabled = (row.Table.Columns.Contains("isswitchboardenabled") && row["isswitchboardenabled"] != null && row["isswitchboardenabled"] != DBNull.Value) ? Convert.ToBoolean(row["isswitchboardenabled"]) : false; m_dontMangleEnabled = (row.Table.Columns.Contains("dontmangleenabled") && row["dontmangleenabled"] != null && row["dontmangleenabled"] != DBNull.Value) ? Convert.ToBoolean(row["dontmangleenabled"]) : false; m_avatarURL = (row.Table.Columns.Contains("avatarurl") && row["avatarurl"] != null) ? row["avatarurl"] as string : null; m_accountCode = (row.Table.Columns.Contains("accountcode") && row["accountcode"] != null) ? row["accountcode"] as string : null; m_description = (row.Table.Columns.Contains("description") && row["description"] != null) ? row["description"] as string : null; } catch (Exception excp) { logger.Error("Exception SIPAccount Load. " + excp); throw excp; } }
IEnumerable <PlatformVersion> IPlatformVersionFinder.FindPlatformVersions() { string windowsVersion = SafelyFindFileVersion(@"%SystemRoot%\system32\winver.exe"); if (windowsVersion != null) { var result = new PlatformVersion("Windows", windowsVersion, "Windows"); ApplyWindowsAttributes(result); yield return(result); } }
public ShellPageContainer(Context context, IVisualElementRenderer child, bool inFragment = false) : base(context, child, inFragment) { if (child.Element.Handler is IPlatformViewHandler nvh && nvh.VirtualView.Background == null) { var color = PlatformVersion.IsAtLeast(23) ? Context.Resources.GetColor(AColorRes.BackgroundLight, Context.Theme) : new AColor(ContextCompat.GetColor(Context, AColorRes.BackgroundLight)); nvh.PlatformView.SetBackgroundColor(color); } }
protected SemanticHeadingLevel GetSemanticHeading(IViewHandler viewHandler) { // AccessibilityHeading is only available on API 28+ // With lower Apis you use ViewCompat.SetAccessibilityHeading // but there exists no ViewCompat.GetAccessibilityHeading if (PlatformVersion.IsAtLeast(28)) { return(((View)viewHandler.PlatformView).AccessibilityHeading ? SemanticHeadingLevel.Level1 : SemanticHeadingLevel.None); } return(viewHandler.VirtualView.Semantics.HeadingLevel); }
public Dictionary <string, string> ToCustomDictionary() { var resultCollection = new Dictionary <string, string>(); if (BrowserName.HasValue()) { resultCollection.Add("browserName", BrowserName); } if (Platform.HasValue()) { resultCollection.Add("platform", Platform); } if (Version.HasValue()) { resultCollection.Add("version", Version); } if (ScreenResolution.HasValue()) { resultCollection.Add("screenResolution", ScreenResolution); } if (AppiumVersion.HasValue()) { resultCollection.Add("appiumVersion", AppiumVersion); } if (DeviceName.HasValue()) { resultCollection.Add("deviceName", DeviceName); } if (DeviceOrientation.HasValue()) { resultCollection.Add("deviceOrientation", DeviceOrientation); } if (PlatformVersion.HasValue()) { resultCollection.Add("platformVersion", PlatformVersion); } if (PlatformName.HasValue()) { resultCollection.Add("platformName", PlatformName); } return(resultCollection); }
void RestoreFocusability(AView platformView) { platformView.ImportantForAccessibility = ImportantForAccessibility.Auto; if (PlatformVersion.IsAtLeast(26)) { platformView.SetFocusable(ViewFocusability.FocusableAuto); } if (platformView is ViewGroup vg) { vg.DescendantFocusability = DescendantFocusability.BeforeDescendants; } }
public TitleViewContainer(View view) : base(view) { MatchHeight = true; if (PlatformVersion.IsAtLeast(11)) { TranslatesAutoresizingMaskIntoConstraints = false; } else { TranslatesAutoresizingMaskIntoConstraints = true; AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; } }
public AssemblyPatcher(string assemblyPath, IHookProvider hookProvider, DeviceType deviceType, PlatformVersion version) { AssemblyDefinition def = LoadAssembly(assemblyPath); m_assemblyDefinition = def; m_assemblyPath = assemblyPath; m_hookProvider = hookProvider; m_deviceType = deviceType; m_version = version; // TODO: dependency m_codeGenerator = new CustomCodeGenerator(); InitializeConsoleMethods(); m_stringTypeReference = m_assemblyDefinition.MainModule.Import(typeof(string)); }
private WPDevice CreateDevice(object device, PlatformVersion version) { switch (version) { case PlatformVersion.Version71: return new WPDevice(device); case PlatformVersion.Version80: return new WP8Device(device); default: return new WPDevice(device); } }
private static object GetPlatform(PlatformVersion version) { object platform = null; var datastore = GetDatastore(version); var getPlatformsMethod = datastore.GetType().GetMethod("GetPlatforms", new Type[0]); var platforms = (IEnumerable)getPlatformsMethod.Invoke(datastore, new object[0]); foreach (var p in platforms) { var nameProperty = p.GetType().GetProperty("Name").GetGetMethod(); var name = (string)nameProperty.Invoke(p, new object[0]); if (version == PlatformVersion.Version71) { if (name == WP7PlatformName) { platform = p; break; } } else if (version == PlatformVersion.Version80) { if (name == WP8PlatformName) { platform = p; break; } } } if (platform == null) { throw new InvalidOperationException(String.Format("Platform for version '{0}' was not found.", version)); } return platform; }
private static Assembly SelectSDKAssembly(PlatformVersion version) { switch (version) { case PlatformVersion.Version71: return WP7SDKAssembly; case PlatformVersion.Version80: return WP8SDKAssembly; default: throw new InvalidOperationException(String.Format("Platform version '{0} is not supported.'", version)); } }
private bool CheckDevice(string name, PlatformVersion version) { bool found = false; switch (version) { case PlatformVersion.Version71: found = (name == WP7DeviceName); break; case PlatformVersion.Version80: found = (name == WP8DeviceName); break; default: throw new NotSupportedException(String.Format("SDK '{0}' is not supported.", version.ToString())); } return found; }
private bool CheckEmulator(string name, PlatformVersion version) { bool found = false; switch (version) { case PlatformVersion.Version71: found = (name == WP70EmulatorName) || name.StartsWith(WP71EmulatorName); break; case PlatformVersion.Version80: found = name.StartsWith(WP8EmulatorName); break; default: throw new NotSupportedException(String.Format("SDK '{0}' is not supported.", version.ToString())); } return found; }
private static object GetDatastore(PlatformVersion version) { Assembly assembly = SelectSDKAssembly(version); Type datastoreType = assembly.GetType(DatastoreManagerTypeName); var ctor = datastoreType.GetConstructor(new Type[] { typeof(int) }); return ctor.Invoke(new object[] { LocaleId }); }
private WPDevice GetEmulator(PlatformVersion version) { var platform = GetPlatform(version); var getDevicesMethod = platform.GetType().GetMethod("GetDevices", new Type[0]); var devices = (IEnumerable)getDevicesMethod.Invoke(platform, new object[0]); object emulator = null; foreach (var d in devices) { var nameProperty = d.GetType().GetProperty("Name").GetGetMethod(); var name = (string)nameProperty.Invoke(d, new object[0]); if (CheckEmulator(name, version)) { emulator = d; break; } } if (emulator == null) { throw new InvalidOperationException("There is no registered Windows Phone emulator."); } return CreateDevice(emulator, version); }