Commit 25a970e3 authored by Mattia's avatar Mattia

Debug fun4

parent 4d3d99dc
<Properties StartupConfiguration="{784FCD54-187B-4098-BD87-559640B3EA57}|Default">
<MonoDevelop.Ide.Workbench ActiveDocument="CustomViewAccessibility.iOS/IOSAccessibleButton.cs">
<Files>
<File FileName="CustomViewAccessibility/MainPage.xaml.cs" Line="1" Column="1" />
<File FileName="CustomViewAccessibility.iOS/IOSAccessibleButton.cs" Line="47" Column="41" />
</Files>
<Pads>
<Pad Id="ProjectPad">
<State name="__root__">
<Node name="CustomViewAccessibility" expanded="True">
<Node name="CustomViewAccessibility" expanded="True">
<Node name="MainPage.xaml" expanded="True" />
</Node>
<Node name="CustomViewAccessibility.iOS" expanded="True">
<Node name="IOSAccessibleButton.cs" selected="True" />
</Node>
</Node>
</State>
</Pad>
</Pads>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore />
</MonoDevelop.Ide.DebuggingService.Breakpoints>
<MultiItemStartupConfigurations />
<MonoDevelop.Ide.ItemProperties.CustomViewAccessibility.Android PreferredExecutionTarget="Android.pixel_2_q_10_0_-_api_29" />
</Properties>
\ No newline at end of file
......@@ -2,7 +2,6 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
......
......@@ -3,6 +3,8 @@ using SampleApp.DependencyServices;
using Xamarin.Forms;
using SampleApp.iOS;
using Xamarin.Forms.Platform.iOS;
using SampleApp.Views;
using SampleApp.Models;
[assembly: ExportRenderer(typeof(IFocusEvents), typeof(iOSFocusEvents))]
namespace SampleApp.iOS
......@@ -41,14 +43,14 @@ namespace SampleApp.iOS
{
base.AccessibilityElementDidBecomeFocused();
Console.WriteLine("Ding Dong");
Functionality4.myLabel.Text = "Bell Image Has Focus";
}
public override void AccessibilityElementDidLoseFocus()
{
base.AccessibilityElementDidLoseFocus();
Console.WriteLine("Campanello ha perso il focus");
Functionality4.myLabel.Text = "Bell Image does not have focus";
}
......
......@@ -19,37 +19,51 @@ namespace SampleApp.iOS
{
base.OnElementChanged(e);
if(Control != null)
if (Control != null)
{
Task.Delay(3000).ContinueWith((arg) =>
{
Device.BeginInvokeOnMainThread(() => {
Console.WriteLine(Control.AccessibilityElementIsFocused().ToString());
if (Control.AccessibilityElementIsFocused())
{
Control.Text = "Focus";
SetNativeControl(new AccessibleLabel());
}
else
{
Control.Text = "Not in focus";
}
});
});
}
}
public class AccessibleLabel : UILabel
{
public AccessibleLabel() : base()
{
Console.WriteLine("ACCESSIBLE LABEL CREATED");
if (AccessibilityElementIsFocused())
{
this.Text = "focus";
Console.WriteLine("accessibilityelementisfocused");
}
else
{
this.Text = "NOTinfocus";
Console.WriteLine("accessibilityelementisNOTinfocus");
}
}
public override bool AccessibilityElementIsFocused()
{
if (base.AccessibilityElementIsFocused())
{
return true;
}
else
{
return false;
}
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="SampleApp.Views.Functionality4" xmlns:local="clr-namespace:SampleApp;assembly=SampleApp">
<ContentPage.BindingContext>
</ContentPage.BindingContext>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="SampleApp.Views.Functionality4" xmlns:local="clr-namespace:SampleApp;assembly=SampleApp" xmlns:local1="clr-namespace:SampleApp.Models">
<StackLayout VerticalOptions="CenterAndExpand" x:Name="background" HorizontalOptions="CenterAndExpand">
<Label Text="Bell Image does not have focus" x:Name="infoLabel"></Label>
</StackLayout>
</ContentPage>
......@@ -11,23 +11,27 @@ namespace SampleApp.Views
[DesignTimeVisible(false)]
public partial class Functionality4 : ContentPage
{
public Label InfoLabel
{
get;
set;
}
public static Label myLabel = new Label { Text = "Select the Bell Image with the accessibility focus", HorizontalOptions = LayoutOptions.CenterAndExpand};
public Functionality4()
{
InitializeComponent();
// immagine campanello
IFocusEvents BellImage = new IFocusEvents
{
Source = ImageSource.FromResource("SampleApp.images.bell.png", typeof(Functionality4).GetTypeInfo().Assembly)
};
AutomationProperties.SetIsInAccessibleTree(infoLabel, true);
AutomationProperties.SetIsInAccessibleTree(myLabel, true);
AutomationProperties.SetIsInAccessibleTree(BellImage, true);
AutomationProperties.SetName(BellImage, "Bell Image");
background.Children.Add(myLabel);
background.Children.Add(BellImage);
}
}
}
......@@ -17,13 +17,14 @@ namespace SampleApp.Views
CustomLabel label = new CustomLabel
{
Text = "Focus?",
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center
};
background.Children.Add(label);
AutomationProperties.SetIsInAccessibleTree(label, true);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment