Ejemplo n.º 1
0
 static string GetVersionString()
 {
     using (var info = new NSProcessInfo())
     {
         return(info.OperatingSystemVersion.ToString());
     }
 }
        NSScrollView SetupTableView()
        {
            _tableView = new GridTableView(Title, Self);
            AddTableColumns(_tableView);
            NSProcessInfo info = new NSProcessInfo();

            if (info.IsOperatingSystemAtLeastVersion(new NSOperatingSystemVersion(10, 13, 0)))
            {
                _tableView.UsesAutomaticRowHeights = true; // only available in OSX 13 and above.AddTableColumns(_tableView);
            }
            var scrollView = new NSScrollView
            {
                DocumentView          = _tableView,
                HasVerticalScroller   = true,
                HasHorizontalScroller = true,
                AutohidesScrollers    = true,
                WantsLayer            = true,
                Layer = new CALayer {
                    Bounds = new CGRect(0, 0, 0, 0)
                },
                Bounds = new CGRect(0, 0, 0, 0)
            };

            scrollView.ContentView.AutoresizingMask    = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable;
            scrollView.ContentView.AutoresizesSubviews = true;
            scrollView.ScrollRectToVisible(new CGRect(0, 0, 0, 0));
            return(scrollView);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Requests an app review.
        /// </summary>
        public Task RequestReview(bool testMode)
        {
#if __IOS__
            if (IsiOS103)
            {
                if (IsiOS14)
                {
                    var windowScene = UIApplication.SharedApplication?.ConnectedScenes?.ToArray <UIScene>()?.FirstOrDefault(x => x.ActivationState == UISceneActivationState.ForegroundActive) as UIWindowScene;
                    if (windowScene != null)
                    {
                        SKStoreReviewController.RequestReview(windowScene);
                        return(Task.CompletedTask);
                    }
                }
                SKStoreReviewController.RequestReview();
            }
#elif __MACOS__
            using var info = new NSProcessInfo();
            if (ParseVersion(info.OperatingSystemVersion.ToString()) >= new Version(10, 14))
            {
                SKStoreReviewController.RequestReview();
            }
#endif

            return(Task.CompletedTask);
        }
Ejemplo n.º 4
0
 static IosVersion()
 {
     using ( var pi = new NSProcessInfo() )
       {
     Major = (int)pi.OperatingSystemVersion.Major;
     Minor = (int)pi.OperatingSystemVersion.Minor;
       }
 }
Ejemplo n.º 5
0
        static Analytics()
        {
#if __PC__
            if (Settings.Default.GUID == "00000000-0000-0000-0000-000000000000")
            {
                Settings.Default.GUID = Guid.NewGuid().ToString();
                Settings.Default.Save();
            }
            GUID = Settings.Default.GUID;
            OperatingSystem os = Environment.OSVersion;
            trackerEnvironment = new SimpleTrackerEnvironment(os.Platform.ToString(), os.Version.ToString(), os.VersionString);
            analyticsSession   = new AnalyticsSession();
            tracker            = new SimpleTracker("UA-125850339-2", analyticsSession, trackerEnvironment);
            AppVersion         = MainForm.VERSION;
            OSVersion          = SetWindowsVersion(os.Version.ToString());
            bool windowsStoreApp = Application.ExecutablePath.Contains("WindowsApps");
            bool debugging       = Application.ExecutablePath.Contains("GitRepo");
            DeploymentType = windowsStoreApp ? "Windows Store" : debugging ? "Development" : "Zip File";
            string resolution = Screen.PrimaryScreen.Bounds.ToString();
#elif __MACOS__
            var userDefaults = new NSUserDefaults();
            GUID = userDefaults.StringForKey("AnalyticsKey");
            if (string.IsNullOrEmpty(GUID))
            {
                GUID = Guid.NewGuid().ToString();
                userDefaults.SetString(GUID, "AnalyticsKey");
                userDefaults.Synchronize();
            }
            NSProcessInfo info = new NSProcessInfo();
            OSVersion          = $"MacOSX {info.OperatingSystemVersionString}";
            trackerEnvironment = new SimpleTrackerEnvironment("Mac OSX", info.OperatingSystemVersion.ToString(), OSVersion);
            analyticsSession   = new AnalyticsSession();
            tracker            = new SimpleTracker("UA-125850339-2", analyticsSession, trackerEnvironment);
            var app = (AppDelegate)NSApplication.SharedApplication.Delegate;
            AppVersion     = FamilyTree.Instance.Version;
            DeploymentType = "Mac Website";
            string resolution = NSScreen.MainScreen.Frame.ToString();
#elif __IOS__
            var userDefaults = new NSUserDefaults();
            GUID = userDefaults.StringForKey("AnalyticsKey");
            if (string.IsNullOrEmpty(GUID))
            {
                GUID = Guid.NewGuid().ToString();
                userDefaults.SetString(GUID, "AnalyticsKey");
                userDefaults.Synchronize();
            }
            NSProcessInfo info = new NSProcessInfo();
            OSVersion          = $"MacOSX {info.OperatingSystemVersionString}";
            trackerEnvironment = new SimpleTrackerEnvironment("Mac OSX", info.OperatingSystemVersion.ToString(), OSVersion);
            analyticsSession   = new AnalyticsSession();
            tracker            = new SimpleTracker("UA-125850339-2", analyticsSession, trackerEnvironment);
            var app = (AppDelegate)UIApplication.SharedApplication.Delegate;
            AppVersion     = FamilyTree.Instance.Version;
            DeploymentType = "Mac Website";
            string resolution = UIScreen.MainScreen.Bounds.ToString();
#endif
            Resolution = resolution.Length > 11 ? resolution.Substring(9, resolution.Length - 10) : resolution;
        }
#pragma warning disable RECS0165 // Asynchronous methods should return a Task instead of void
        public override async void ViewDidLoad()
#pragma warning restore RECS0165 // Asynchronous methods should return a Task instead of void
        {
            base.ViewDidLoad();

            var processInfo = new NSProcessInfo();

            if (processInfo.Arguments.Contains(loopbackLaunchProcessArgument))
            {
                OnStartCall(null, "", true);
            }

            await PermisionManager.GetRequiredPermissionAsync();
        }
Ejemplo n.º 7
0
        private static Version GetOperatingSystemVersion()
        {
            using var info = new NSProcessInfo();
            var version = info.OperatingSystemVersion.ToString();

            if (Version.TryParse(version, out var systemVersion))
            {
                return(systemVersion);
            }
            else if (int.TryParse(version, out var major))
            {
                return(new Version(major, 0));
            }
            return(new Version(0, 0));
        }
Ejemplo n.º 8
0
        public AppDelegate()
        {
            var style = NSWindowStyle.Closable | NSWindowStyle.Resizable | NSWindowStyle.Titled;

            var rect = new CoreGraphics.CGRect(200, 1000, 1024, 768);

            _window = new NSWindow(rect, style, NSBackingStore.Buffered, false);

            // Selector setTitleVisibility available on macOS 10.10 and later.
            var osVersion = new NSProcessInfo().OperatingSystemVersion;

            if ((osVersion.Major == 10 && osVersion.Minor > 9) || osVersion.Major > 10)
            {
                _window.TitleVisibility = NSWindowTitleVisibility.Hidden;
            }
        }
Ejemplo n.º 9
0
        private void CreateLaContext()
        {
            var info = new NSProcessInfo();

            if (!UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {
                return;
            }
            // Check LAContext is not available on iOS7 and below, so check LAContext after checking iOS version.
            if (Class.GetHandle(typeof(LAContext)) == IntPtr.Zero)
            {
                return;
            }

            _context = new LAContext();
        }
        /// <summary>
        /// Requests an app review.
        /// </summary>
        public Task RequestReview(bool testMode)
        {
#if __IOS__
            if (IsiOS103)
            {
                SKStoreReviewController.RequestReview();
            }
#elif __MACOS__
            using var info = new NSProcessInfo();
            if (ParseVersion(info.OperatingSystemVersion.ToString()) >= new Version(10, 14))
            {
                SKStoreReviewController.RequestReview();
            }
#endif

            return(Task.CompletedTask);
        }
Ejemplo n.º 11
0
        static Analytics()
        {
            var userDefaults = new NSUserDefaults();

            GUID = userDefaults.StringForKey("AnalyticsKey");
            if (string.IsNullOrEmpty(GUID))
            {
                GUID = Guid.NewGuid().ToString();
                userDefaults.SetString(GUID, "AnalyticsKey");
                userDefaults.Synchronize();
            }
            NSProcessInfo info = new NSProcessInfo();

            OSVersion          = $"MacOSX {info.OperatingSystemVersionString}";
            trackerEnvironment = new SimpleTrackerEnvironment("Mac OSX", info.OperatingSystemVersion.ToString(), OSVersion);
            tracker            = new SimpleTracker("UA-125850339-2", trackerEnvironment);
            var app = (AppDelegate)NSApplication.SharedApplication.Delegate;

            AppVersion = app.Version;
        }
        private void CreateLaContext()
        {
            var info = new NSProcessInfo();

#if __MAC__
            var minVersion = new NSOperatingSystemVersion(10, 12, 0);
            if (!info.IsOperatingSystemAtLeastVersion(minVersion))
            {
                return;
            }
#else
            if (!UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {
                return;
            }
#endif
            // Check LAContext is not available on iOS7 and below, so check LAContext after checking iOS version.
            if (Class.GetHandle(typeof(LAContext)) == IntPtr.Zero)
            {
                return;
            }

            _context = new LAContext();
        }
        public NSScrollView SetupView()
        {
            _printView = new GridTableView("PrintView", Self);
            AddTableColumns(_printView);
            NSProcessInfo info = new NSProcessInfo();

            if (info.IsOperatingSystemAtLeastVersion(new NSOperatingSystemVersion(10, 13, 0)))
            {
                _printView.UsesAutomaticRowHeights = true; // only available in OSX 13 and above.
            }
            var scrollView = new NSScrollView
            {
                DocumentView          = _printView,
                HasVerticalScroller   = false,
                HasHorizontalScroller = false,
                WantsLayer            = true,
                Layer  = NewLayer(),
                Bounds = new CGRect(0, 0, 0, 0)
            };

            scrollView.ContentView.AutoresizingMask    = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable;
            scrollView.ContentView.AutoresizesSubviews = true;
            return(scrollView);
        }
Ejemplo n.º 14
0
        public DeviceInfoService()
        {
#if __MACOS__
            info = new NSProcessInfo();
#endif
        }
Ejemplo n.º 15
0
        public VersionHelper()
        {
            var processInfo = new NSProcessInfo();

            _version = processInfo.OperatingSystemVersion;
        }
        /// <summary>
        /// Default Constructor
        /// </summary>
        public DeviceInfoImplementation()
        {
#if __MACOS__
            info = new NSProcessInfo();
#endif
        }
Ejemplo n.º 17
0
        public static bool IsMojaveOrHigher(this NSProcessInfo info)
        {
            var version = info.OperatingSystemVersion;

            return((version.Major == 10 && version.Minor >= 14) || version.Major > 10);
        }
Ejemplo n.º 18
0
 internal static bool HasOSVersion(int major, int minor)
 {
     using var info = new NSProcessInfo();
     return(info.IsOperatingSystemAtLeastVersion(new NSOperatingSystemVersion(major, minor, 0)));
 }