/// <summary>
        /// Gets the <see cref="DeviceType"/> from the given <see cref="AnalyticsVersionInfo"/>.
        /// </summary>
        /// <param name="versionInfo">
        /// The <see cref="AnalyticsVersionInfo"/>.
        /// </param>
        /// <returns>
        /// Returns the <see cref="DeviceType"/>.
        /// </returns>
        public static DeviceType GetDeviceType(this AnalyticsVersionInfo versionInfo)
        {
            var deviceFamily = versionInfo.DeviceFamily;

            switch (deviceFamily)
            {
            case "Windows.Desktop":
                return(DeviceType.Desktop);

            case "Windows.Mobile":
                return(DeviceType.Mobile);

            case "Windows.Team":
                return(DeviceType.SurfaceHub);

            case "Windows.IoT":
                return(DeviceType.IoT);

            case "Windows.Xbox":
                return(DeviceType.Xbox);

            default:
                return(DeviceType.Unknown);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取系统信息
        /// </summary>
        /// <returns></returns>
        public static string GetSystemDetail()
        {
            StringBuilder sb = new StringBuilder();

            try
            {
                EasClientDeviceInformation eas = new EasClientDeviceInformation();
                sb.Append(eas.SystemManufacturer);
                sb.Append(' ');
                sb.Append(eas.SystemProductName);
                sb.Append(' ');

                AnalyticsVersionInfo analyticsVersion = AnalyticsInfo.VersionInfo;
                sb.Append(analyticsVersion.DeviceFamily);
                sb.Append(' ');

                ulong v = ulong.Parse(AnalyticsInfo.VersionInfo.DeviceFamilyVersion);
                sb.Append((v & 0xFFFF000000000000L) >> 48);
                sb.Append('.');
                sb.Append((v & 0x0000FFFF00000000L) >> 32);
                sb.Append('.');
                sb.Append((v & 0x00000000FFFF0000L) >> 16);
                sb.Append('.');
                sb.Append(v & 0x000000000000FFFFL);
                sb.Append(' ');

                Package package = Package.Current;
                sb.Append(package.Id.Architecture);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            return(sb.ToString());
        }
        static ApplicationData()
        {
            AnalyticsVersionInfo versionInfo = Windows.System.Profile.AnalyticsInfo.VersionInfo;

            SystemFamily = versionInfo.DeviceFamily;
            string deviceFamilyVersion = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;
            ulong  v  = ulong.Parse(deviceFamilyVersion);
            ulong  v1 = (v & 0xFFFF000000000000L) >> 48;
            ulong  v2 = (v & 0x0000FFFF00000000L) >> 32;
            ulong  v3 = (v & 0x00000000FFFF0000L) >> 16;
            ulong  v4 = (v & 0x000000000000FFFFL);

            SystemVersion = $"{v1}.{v2}.{v3}.{v4}";

            Package package = Package.Current;

            SystemArchitecture = package.Id.Architecture.ToString();
            ApplicationName    = package.DisplayName;
            PackageVersion packageVersion = package.Id.Version;

            ApplicationVersion = String.Format("{0}.{1}.{2}.{3}", packageVersion.Major, packageVersion.Minor, packageVersion.Build, packageVersion.Revision);

            EasClientDeviceInformation clientDeviceInformation = new EasClientDeviceInformation();

            DeviceManufacturer = clientDeviceInformation.SystemManufacturer;
            DeviceModel        = clientDeviceInformation.SystemProductName;
            FirmwareVersion    = clientDeviceInformation.SystemFirmwareVersion;
        }
        /// <summary>
        /// Retrieves the current <see cref="DeviceFormFactor"/> for the current device.
        /// </summary>
        /// <param name="versionInfo">Extended class.</param>
        /// <returns><see cref="DeviceFormFactor"/> value representing the current device type.</returns>
        public static DeviceFormFactor GetDeviceFormFactor(this AnalyticsVersionInfo versionInfo)
        {
            // TODO: If we have better ways of detecting specific platforms we should put them in here too,
            // but should still expose on AnalyticsVersionInfo as that's where most people are currently looking for this.
            switch (versionInfo.DeviceFamily)
            {
            case "Windows.Desktop":
                return(UIViewSettings.GetForCurrentView()?.UserInteractionMode == UserInteractionMode.Mouse
                        ? DeviceFormFactor.Desktop
                        : DeviceFormFactor.Tablet);

            case "Windows.Mobile":
                return(DeviceFormFactor.Mobile);

            case "Windows.Xbox":
                return(DeviceFormFactor.Xbox);

            case "Windows.Holographic":
                return(DeviceFormFactor.Holographic);

            case "Windows.Universal":
                return(DeviceFormFactor.IoT);

            case "Windows.Team":
                return(DeviceFormFactor.SurfaceHub);

            default:
                return(DeviceFormFactor.Other);
            }
        }
Exemplo n.º 5
0
        static SystemInfoHelper()
        {
            AnalyticsVersionInfo ai = AnalyticsInfo.VersionInfo;

            SystemFamily = ai.DeviceFamily;

            string sv = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;
            ulong  v  = ulong.Parse(sv);
            ulong  v1 = (v & 0xFFFF000000000000L) >> 48;
            ulong  v2 = (v & 0x0000FFFF00000000L) >> 32;
            ulong  v3 = (v & 0x00000000FFFF0000L) >> 16;
            ulong  v4 = v & 0x000000000000FFFFL;

            SystemVersion = $"{v1}.{v2}.{v3}.{v4}";

            Package package = Package.Current;

            SystemArchitecture = package.Id.Architecture.ToString();
            Assembly sdkAssembly = Assembly.Load(new AssemblyName("SensorbergSDK"));
            var      version     = sdkAssembly.GetName().Version;

            SdkVersion      = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
            ApplicationName = package.DisplayName;
            PackageName     = package.Id.Name;
            PackageVersion pv = package.Id.Version;

            ApplicationVersion = $"{pv.Major}.{pv.Minor}.{pv.Build}.{pv.Revision}";

            EasClientDeviceInformation eas = new EasClientDeviceInformation();

            DeviceManufacturer = eas.SystemManufacturer;
            DeviceModel        = eas.SystemProductName;
            SystemName         = eas.OperatingSystem;
        }
Exemplo n.º 6
0
        private static void DetectDeviceType()
        {
            AnalyticsVersionInfo avi = AnalyticsInfo.VersionInfo;
            // set the device type based on the Windows 10 DeviceFamily property
            string deviceFamily = avi.DeviceFamily;

            switch (deviceFamily)
            {
            case "Windows.Mobile":
                DeviceType = "phone";
                break;

            case "Windows.Desktop":
                DeviceType = "tablet";
                break;

            case "Windows.Xbox":
                DeviceType = "xbox";
                break;

            default:
                // IoT, Surface Hub, HoloLens?
                DeviceType = deviceFamily;
                break;
            }

            // set the full OS version using the DeviceFamilyVersion property
            string sv = avi.DeviceFamilyVersion;

            SetOsVersion(sv);
        }
Exemplo n.º 7
0
            static Info()
            {
                // get the system family name
                AnalyticsVersionInfo ai = AnalyticsInfo.VersionInfo;

                SystemFamily = ai.DeviceFamily;

                // get the system version number
                string sv = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;
                ulong  v  = ulong.Parse(sv);
                ulong  v1 = (v & 0xFFFF000000000000L) >> 48;
                ulong  v2 = (v & 0x0000FFFF00000000L) >> 32;
                ulong  v3 = (v & 0x00000000FFFF0000L) >> 16;
                ulong  v4 = (v & 0x000000000000FFFFL);

                SystemVersion = $"{v1}.{v2}.{v3}.{v4}";

                // get the package architecure
                Package package = Package.Current;

                SystemArchitecture = package.Id.Architecture.ToString();

                // get the app version
                PackageVersion pv = package.Id.Version;

                ApplicationVersion = $"{pv.Major}.{pv.Minor}.{pv.Build}.{pv.Revision}";

                // get the device manufacturer and model name
                EasClientDeviceInformation eas = new EasClientDeviceInformation();

                DeviceManufacturer = eas.SystemManufacturer;
                DeviceModel        = eas.SystemProductName;
            }
        /// <summary>
        /// Get System information by intern class
        /// </summary>
        /// <param name="returnedInfo">returned Dictionnary filled with new info</param>
        /// <returns></returns>
        public override async Task <Dictionary <string, string> > GetInfos(Dictionary <String, String> returnedInfo)
        {
            returnedInfo = await base.GetInfos(returnedInfo);

            returnedInfo.Add("--------- " + LABEL + " ---------", "----------------");

#if WINDOWS_UWP
            AnalyticsVersionInfo ai = AnalyticsInfo.VersionInfo;

            // get the system family information
            returnedInfo.Add("Device Family", ai.DeviceFamily);

            returnedInfo.Add("Device Family Version", ai.DeviceFamilyVersion);

            // get the system version number
            string sv = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;

            returnedInfo.Add("System Version", parseSystemVersion(sv));
            // get the device manufacturer and model name
            EasClientDeviceInformation eas = new EasClientDeviceInformation();
            returnedInfo.Add("Device Manufacturer", eas.SystemManufacturer);
            returnedInfo.Add("Device Model", eas.SystemProductName);

            // get the device manufacturer, model name, OS details etc.
            returnedInfo.Add("Operating System", eas.OperatingSystem);

            returnedInfo.Add("Friendly Name", eas.FriendlyName);
#endif
            return(returnedInfo);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Output UWP info (输出 UWP 信息).
        /// </summary>
        /// <param name="sb">String buffer (字符串缓冲区).</param>
        /// <param name="onproject">On project (所处项目)</param>
        public static void OutputUwp(StringBuilder sb, string onproject)
        {
            // AnalyticsVersionInfo
            sb.AppendLine(LibSharedUtil.GetHeadString("AnalyticsVersionInfo", onproject));
            AnalyticsVersionInfo ai = AnalyticsInfo.VersionInfo;

            sb.AppendLine(string.Format("DeviceFamily:\t{0}", ai.DeviceFamily));
            sb.AppendLine(string.Format("DeviceFamilyVersion:\t{0}", ai.DeviceFamilyVersion));
            sb.AppendLine(string.Format("DeviceFamilyVersion$:\t{0}", LibSharedUtil.VersionFromInt(ulong.Parse(ai.DeviceFamilyVersion))));
            sb.AppendLine();
        }
Exemplo n.º 10
0
        /*
        public void manageProgressBar(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "SHOW")
            {
                showProgressBar();
            }
            else
            {
                hideProgressBar();
            }
        }*/

        public async void showProgressBar()
        {
            AnalyticsVersionInfo ai = AnalyticsInfo.VersionInfo;
            string systemFamily = ai.DeviceFamily;

            if (systemFamily == "Windows.Mobile")
            {
                StatusBar statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
                await statusBar.ProgressIndicator.ShowAsync();
            }
        }
Exemplo n.º 11
0
        private void InitializeStatusBar()
        {
            AnalyticsVersionInfo ai = AnalyticsInfo.VersionInfo;
            string systemFamily = ai.DeviceFamily;

            if (systemFamily == "Windows.Mobile")
            {
                StatusBar statusBar = StatusBar.GetForCurrentView();
                statusBar.BackgroundColor = Colors.Black;
                statusBar.ForegroundColor = Colors.White;
                statusBar.BackgroundOpacity = 100;
            }
        }
Exemplo n.º 12
0
        public bool determin()
        {
            AnalyticsVersionInfo info = AnalyticsInfo.VersionInfo;

            if (info.DeviceFamily == "Windows.IoT")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static DeviceFamilyType GetDeviceFamilyType(this AnalyticsVersionInfo info)
        {
            switch (info.DeviceFamily)
            {
            case "Desktop":
                return(DeviceFamilyType.Desktop);

            case "Mobile":
                return(DeviceFamilyType.Mobile);

            default:
                return(DeviceFamilyType.Unknown);
            }
        }
Exemplo n.º 14
0
        public static string GetDeviceInfo()
        {
            try
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("<--------- Device Information --------->");
                try
                {
                    var deviceInfo = new EasClientDeviceInformation();

                    sb.AppendLine("DeviceName: " + deviceInfo.FriendlyName);
                    sb.AppendLine("OperatingSystem: " + deviceInfo.OperatingSystem);
                }
                catch { }
                // get the system family name
                AnalyticsVersionInfo ai = AnalyticsInfo.VersionInfo;
                sb.AppendLine("SystemFamily: " + ai.DeviceFamily);
                // get the system version number
                string sv = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;
                ulong  v  = ulong.Parse(sv);
                ulong  v1 = (v & 0xFFFF000000000000L) >> 48;
                ulong  v2 = (v & 0x0000FFFF00000000L) >> 32;
                ulong  v3 = (v & 0x00000000FFFF0000L) >> 16;
                ulong  v4 = (v & 0x000000000000FFFFL);
                sb.AppendLine("SystemVersion: " + $"{v1}.{v2}.{v3}.{v4}");

                // get the package architecure
                Package package = Package.Current;
                sb.AppendLine("SystemArchitecture: " + package.Id.Architecture.ToString());

                // get the user friendly app name
                sb.AppendLine("ApplicationName: " + package.DisplayName);

                // get the app version
                PackageVersion pv = package.Id.Version;
                sb.AppendLine("ApplicationVersion: " + $"{pv.Major}.{pv.Minor}.{pv.Build}.{pv.Revision}");

                // get the device manufacturer and model name
                EasClientDeviceInformation eas = new EasClientDeviceInformation();
                sb.AppendLine("DeviceManufacturer: " + eas.SystemManufacturer);
                sb.AppendLine("DeviceModel: " + eas.SystemProductName);
                sb.AppendLine("<--------- Device Information --------->");
                sb.AppendLine();
                sb.AppendLine();

                return(sb.ToString().PrintDebug());
            }
            catch { }
            return(string.Empty);
        }
Exemplo n.º 15
0
        static SystemInfo()
        {
            // get the system family name
            AnalyticsVersionInfo ai = AnalyticsInfo.VersionInfo;

            SystemFamily = ai.DeviceFamily;

            // get the system version number
            string sv = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;
            ulong  v  = ulong.Parse(sv);
            ulong  v1 = (v & 0xFFFF000000000000L) >> 48;
            ulong  v2 = (v & 0x0000FFFF00000000L) >> 32;
            ulong  v3 = (v & 0x00000000FFFF0000L) >> 16;
            ulong  v4 = (v & 0x000000000000FFFFL);

            SystemVersion = $"{v1}.{v2}.{v3}.{v4}";

            // get the package architecure
            Package package = Package.Current;

            SystemArchitecture = package.Id.Architecture.ToString();

            // get the user friendly app name
            ApplicationName = package.DisplayName;

            // get the app version
            PackageVersion pv = package.Id.Version;

            ApplicationVersion = $"{pv.Major}.{pv.Minor}.{pv.Build}.{pv.Revision}";

            // get the device manufacturer and model name
            EasClientDeviceInformation eas = new EasClientDeviceInformation();

            FriendlyDeviceName = eas.FriendlyName;
            //eas.Id;
            OperatingSystem       = eas.OperatingSystem;
            SystemFirmwareVersion = eas.SystemFirmwareVersion;
            SystemHardwareVersion = eas.SystemHardwareVersion;
            DeviceManufacturer    = eas.SystemManufacturer;
            DeviceModel           = eas.SystemProductName;
            SystemSku             = eas.SystemSku;


            DeviceOrientation       = DisplayInformation.GetForCurrentView().CurrentOrientation;
            DisplayResolutionWidth  = Window.Current.Bounds.Width;
            DisplayResolutionHeight = Window.Current.Bounds.Height;
        }
Exemplo n.º 16
0
        static DeviceInfo()
        {
            // get the system family name
            AnalyticsVersionInfo ai = AnalyticsInfo.VersionInfo;

            SystemFamily = ai.DeviceFamily;

            // get the system version number
            string sv = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;
            ulong  v  = ulong.Parse(sv);
            ulong  v1 = (v & 0xFFFF000000000000L) >> 48;
            ulong  v2 = (v & 0x0000FFFF00000000L) >> 32;
            ulong  v3 = (v & 0x00000000FFFF0000L) >> 16;
            ulong  v4 = (v & 0x000000000000FFFFL);

            SystemVersion = new Version($"{v1}.{v2}.{v3}.{v4}");
        }
Exemplo n.º 17
0
        public static string OsVersion()
        {
            AnalyticsVersionInfo ai = AnalyticsInfo.VersionInfo;
            string systemFamily     = ai.DeviceFamily;

            // get the system version number
            string sv            = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;
            ulong  v             = ulong.Parse(sv);
            ulong  v1            = (v & 0xFFFF000000000000L) >> 48;
            ulong  v2            = (v & 0x0000FFFF00000000L) >> 32;
            ulong  v3            = (v & 0x00000000FFFF0000L) >> 16;
            ulong  v4            = (v & 0x000000000000FFFFL);
            string systemVersion = $"{v1}.{v2}.{v3}.{v4}";
            var    ret           = systemFamily + "_" + systemVersion;

            return(ret);
        }
Exemplo n.º 18
0
        static SystemInformation()
        {
            // get the system family name
            AnalyticsVersionInfo ai = AnalyticsInfo.VersionInfo;

            SystemFamily = ai.DeviceFamily;

            // get the system version number
#if WINDOWS_UWP
            string sv = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;
            ulong  v  = ulong.Parse(sv);
            ulong  v1 = (v & 0xFFFF000000000000L) >> 48;
            ulong  v2 = (v & 0x0000FFFF00000000L) >> 32;
            ulong  v3 = (v & 0x00000000FFFF0000L) >> 16;
            ulong  v4 = (v & 0x000000000000FFFFL);
            SystemVersion = $"{v1}.{v2}.{v3}.{v4}";
#else
            // get os version
            SystemVersion = GetWindowsVersion();
#endif
            // get the package architecure
            Package package = Package.Current;
            SystemArchitecture = package.Id.Architecture.ToString();

            // get the user friendly app name
            ApplicationName = package.DisplayName;

            // get the app version
            PackageVersion pv = package.Id.Version;
            ApplicationVersion = $"{pv.Major}.{pv.Minor}.{pv.Build}.{pv.Revision}";

            // get the device manufacturer and model name
            EasClientDeviceInformation eas = new EasClientDeviceInformation();
            DeviceName         = eas.FriendlyName;
            DeviceManufacturer = eas.SystemManufacturer;
            DeviceModel        = eas.SystemProductName;


            // get App Specific Hardware ID
            AppSpecificHardwareID = GetAppSpecificHardwareID();

            // Family Name
            PackageFamilyName = Package.Current.Id.FamilyName;
        }
Exemplo n.º 19
0
        internal bool CheckWindowsBuildVersion()
        {
            // get the system family name
            AnalyticsVersionInfo ai = AnalyticsInfo.VersionInfo;
            string SystemFamily     = ai.DeviceFamily;

            // get the system version number
            string sv            = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;
            ulong  v             = ulong.Parse(sv);
            ulong  v1            = (v & 0xFFFF000000000000L) >> 48;
            ulong  v2            = (v & 0x0000FFFF00000000L) >> 32;
            ulong  v3            = (v & 0x00000000FFFF0000L) >> 16;
            ulong  v4            = (v & 0x000000000000FFFFL);
            string SystemVersion = $"{v1}.{v2}.{v3}.{v4}";

            if (v1 < 10 || (v1 == 10 && v3 < 14393))
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 20
0
        public async void GetClientInfo()
        {
            string SystemFamily       = string.Empty;
            string SystemVersion      = string.Empty;
            string SystemArchitecture = string.Empty;
            string ApplicationName    = string.Empty;
            string ApplicationVersion = string.Empty;
            string DeviceManufacturer = string.Empty;
            string DeviceModel        = string.Empty;

            // get the system family name
            AnalyticsVersionInfo ai = AnalyticsInfo.VersionInfo;

            SystemFamily = ai.DeviceFamily;

            // get the system version number
            string sv = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;
            ulong  v  = ulong.Parse(sv);
            ulong  v1 = (v & 0xFFFF000000000000L) >> 48;
            ulong  v2 = (v & 0x0000FFFF00000000L) >> 32;
            ulong  v3 = (v & 0x00000000FFFF0000L) >> 16;
            ulong  v4 = (v & 0x000000000000FFFFL);

            SystemVersion = $"{v1}.{v2}.{v3}.{v4}";

            // get the package architecure
            Package package = Package.Current;

            SystemArchitecture = package.Id.Architecture.ToString();

            // get the user friendly app name
            ApplicationName = package.DisplayName;

            // get the app version
            PackageVersion pv = package.Id.Version;

            ApplicationVersion = $"{pv.Major}.{pv.Minor}.{pv.Build}.{pv.Revision}";

            // get the device manufacturer and model name
            EasClientDeviceInformation eas = new EasClientDeviceInformation();

            DeviceManufacturer = eas.SystemManufacturer;
            DeviceModel        = eas.SystemProductName;

            Agent      = "mobo";
            Carrier    = GetCarrier();
            OsVersion  = SystemVersion;
            AppVersion = ApplicationVersion;
            Version    = GetAppVersion();
            Jailbreak  = "0";

            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                          () =>
            {
                var bounds      = ApplicationView.GetForCurrentView().VisibleBounds;
                var scaleFactor = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
                var size        = new Size(bounds.Width *scaleFactor, bounds.Height *scaleFactor);

                Width  = (float)size.Width;
                Height = (float)size.Height;
            });

            var location = await GetCurrentLocation();

            if (location != null)
            {
                var coordinate = location.Coordinate;
                if (coordinate != null)
                {
                    Longitude = !coordinate.Point.Position.Longitude.Equals(double.NaN) ? coordinate.Point.Position.Longitude : 106.684735;
                }
                Latitude = !coordinate.Point.Position.Latitude.Equals(double.NaN) ? coordinate.Point.Position.Latitude : 10.785187;
            }
            else
            {
                Longitude = 106.684735;
                Latitude  = 10.785187;
            }
        }