public AndroidAgent(
            IActivityTracker activityTracker,
            int contentId = -1)
        {
            ActivityTracker = activityTracker;
            ContentId       = contentId;

            var displaySize = GetRealSize(Application
                                          .Context
                                          .GetSystemService(global::Android.Content.Context.WindowService)
                                          .JavaCast <IWindowManager> ()
                                          .DefaultDisplay);

            Identity = new AgentIdentity(
                AgentType.Android,
                new Sdk(
                    SdkId.XamarinAndroid,
                    new FrameworkName(typeof(Java.Interop.Runtime)
                                      .Assembly
                                      .GetCustomAttribute <TargetFrameworkAttribute> ()
                                      .FrameworkName),
                    Array.Empty <string> (),
                    "Android"),
                GetApplicationName(),
                deviceManufacturer: Build.Manufacturer,
                screenWidth: displaySize.X,
                screenHeight: displaySize.Y);

            RepresentationManager.AddProvider(new AndroidRepresentationProvider());

            ViewHierarchyHandlerManager.AddViewHierarchyHandler("Android", this);
        }
예제 #2
0
        public iOSAgent()
        {
            Identity = new AgentIdentity(
                AgentType.iOS,
                Sdk.FromEntryAssembly(SdkId.XamarinIos, "iOS"),
                NSBundle.MainBundle.InfoDictionary ["CFBundleName"] as NSString,
                screenWidth: (int)UIScreen.MainScreen.Bounds.Width,
                screenHeight: (int)UIScreen.MainScreen.Bounds.Height);

            RepresentationManager.AddProvider(new iOSRepresentationProvider());
            new UnifiedNativeHelper().Initialize();

            ViewHierarchyHandlerManager.AddViewHierarchyHandler("UIKit", this);
        }
예제 #3
0
        public WpfAgent(Func <Window> mainWindowCreator = null)
        {
            this.mainWindowCreator = mainWindowCreator;
            latestMainWindow       = mainWindowCreator?.Invoke();
            if (latestMainWindow != null)
            {
                latestMainWindow.WindowState = WindowState.Minimized;
                latestMainWindow.Show();
            }

            Identity = new AgentIdentity(
                AgentType.WPF,
                Sdk.FromEntryAssembly("WPF"),
                Assembly.GetEntryAssembly().GetName().Name);

            RepresentationManager.AddProvider(wpfRepresentationProvider = new WpfRepresentationProvider());

            ViewHierarchyHandlerManager.AddViewHierarchyHandler("WPF", this);
        }
예제 #4
0
        public MacAgent()
        {
            #if MAC_MOBILE
            var          agentType = AgentType.MacMobile;
            const string profile   = "Modern";
            #elif MAC_DESKTOP
            var          agentType = AgentType.MacNet45;
            const string profile   = "Full";
            #endif

            Identity = new AgentIdentity(
                agentType,
                Sdk.FromEntryAssembly("Xamarin.Mac", profile),
                NSBundle.MainBundle.InfoDictionary ["CFBundleName"] as NSString);

            RepresentationManager.AddProvider(new MacRepresentationProvider());
            new UnifiedNativeHelper().Initialize();

            ViewHierarchyHandlerManager.AddViewHierarchyHandler("AppKit", this);
        }
예제 #5
0
 public override InspectView HighlightView(double x, double y, bool clear, string hierarchyKind)
 => ViewHierarchyHandlerManager.HighlightView(x, y, clear, hierarchyKind);
예제 #6
0
 public override InspectView GetVisualTree(string hierarchyKind)
 => ViewHierarchyHandlerManager.GetView(
     NSApplication.SharedApplication,
     hierarchyKind);
 public override InspectView GetVisualTree(string hierarchyKind)
 => ViewHierarchyHandlerManager.GetView(
     GetTopActivity()?.Window?.DecorView,
     hierarchyKind);
예제 #8
0
 public override InspectView GetVisualTree(string hierarchyKind)
 => ViewHierarchyHandlerManager.GetView(
     iOSEvaluationContextGlobalObject.KeyWindow,
     hierarchyKind);
예제 #9
0
 public override InspectView GetVisualTree(string hierarchyKind)
 => ViewHierarchyHandlerManager.GetView(
     Application.Current,
     hierarchyKind);