/// <summary>
        /// Starts observing capabilities information for changes.
        /// </summary>
        /// <remarks>
        /// Capabilities' events will be never invoked before calling this method.
        /// </remarks>
        public void StartListening()
        {
            try
            {
                SystemSettings.Data3GNetworkSettingChanged +=
                    (s, e) => { Network3GChanged?.Invoke(s, new CapabilityChangedEventArgs(e.Value)); };
            }
            catch (NotSupportedException e)
            {
                Log.Warn("SystemInfo", e.Message);
            }

            try
            {
                if (SystemInformation.TryGetValue <bool>(NetworkWifiFeatureKey, out bool isSupported) && isSupported)
                {
                    SystemSettings.NetworkWifiNotificationSettingChanged +=
                        (s, e) => { WifiNotificationChanged?.Invoke(s, new CapabilityChangedEventArgs(e.Value)); };
                }
            }
            catch (NotSupportedException e)
            {
                Log.Warn("SystemInfo", e.Message);
            }

            try
            {
                SystemSettings.NetworkFlightModeSettingChanged +=
                    (s, e) => { FlightModeChanged?.Invoke(s, new CapabilityChangedEventArgs(e.Value)); };
            }
            catch (NotSupportedException e)
            {
                Log.Warn("SystemInfo", e.Message);
            }
        }
        public static void Init(string resourcePath, InitializationOptions option = null)
        {
            if (!IsInitialized)
            {
                string fileName = "elmsharp-theme-material.edj";
                switch (Profile)
                {
                case TargetProfile.TV:
                    fileName = "elmsharp-theme-material-tv.edj";
                    break;

                case TargetProfile.Wearable:
                    fileName = "elmsharp-theme-material-wearable.edj";
                    break;

                case TargetProfile.Mobile:
                    TSystemInfo.TryGetValue("http://tizen.org/system/device_type", out string deviceType);
                    if (deviceType.Contains("Refrigerator"))
                    {
                        fileName = "elmsharp-theme-material-fhub.edj";
                    }
                    break;
                }
                Elementary.AddThemeOverlay(Path.Combine(resourcePath, fileName));

                AppResourcePath = resourcePath;
                InitOptions     = option;
                IsInitialized   = true;
            }
        }
Esempio n. 3
0
        public static int GetScreeenWidth()
        {
            int width;

            TSystemInfo.TryGetValue <int>("http://tizen.org/feature/screen.width", out width);
            return(width);
        }
Esempio n. 4
0
        public static int GetScreenHeight()
        {
            int height;

            TSystemInfo.TryGetValue <int>("http://tizen.org/feature/screen.height", out height);
            return(height);
        }
        public static void Preload()
        {
            Elementary.Initialize();
            Elementary.ThemeOverlay();
            var window = new PreloadedWindow();

            TSystemInfo.TryGetValue("http://tizen.org/feature/screen.width", out int width);
            TSystemInfo.TryGetValue("http://tizen.org/feature/screen.height", out int height);
        }
        static DeviceOrientation GetDeviceOrientation()
        {
            int width  = 0;
            int height = 0;

            TSystemInfo.TryGetValue <int>("http://tizen.org/feature/screen.width", out width);
            TSystemInfo.TryGetValue <int>("http://tizen.org/feature/screen.height", out height);

            if (height >= width)
            {
                return(DeviceOrientation.Portrait);
            }
            else
            {
                return(DeviceOrientation.Landscape);
            }
        }
            public TizenDeviceInfo()
            {
                int width  = 0;
                int height = 0;

                TSystemInfo.TryGetValue("http://tizen.org/feature/screen.width", out width);
                TSystemInfo.TryGetValue("http://tizen.org/feature/screen.height", out height);

                scalingFactor = 1.0;                  // scaling is disabled, we're using pixels as Xamarin's geometry units
                if (s_useDeviceIndependentPixel)
                {
                    scalingFactor = s_dpi.Value / 160.0;
                }

                pixelScreenSize  = new Size(width, height);
                scaledScreenSize = new Size(width / scalingFactor, height / scalingFactor);
                profile          = s_profile.Value;
            }
 /// <summary>
 /// Tries to get DateTime value of the feature.
 /// </summary>
 /// <param name="key">Name of the feature.</param>
 /// <returns>The value of given feature.</returns>
 public DateTime TryGetValueToDateTime(string key)
 {
     Information.TryGetValue(key, out DateTime value);
     return(value);
 }
 /// <summary>
 /// Tries to get string value of the feature.
 /// </summary>
 /// <param name="key">Name of the feature.</param>
 /// <returns>The value of given feature.</returns>
 public string TryGetValueToString(string key)
 {
     Information.TryGetValue(key, out string value);
     return(value);
 }
 /// <summary>
 /// Tries to get double value of the feature.
 /// </summary>
 /// <param name="key">Name of the feature.</param>
 /// <returns>The value of given feature.</returns>
 public double TryGetValueToDouble(string key)
 {
     Information.TryGetValue(key, out double value);
     return(value);
 }
 /// <summary>
 /// Tries to get int value of the feature.
 /// </summary>
 /// <param name="key">Name of the feature.</param>
 /// <returns>The value of given feature.</returns>
 public int TryGetValueToInt(string key)
 {
     Information.TryGetValue(key, out int value);
     return(value);
 }
 /// <summary>
 /// Tries to get bool value of the feature.
 /// </summary>
 /// <param name="key">Name of the feature.</param>
 /// <returns>The value of given feature.</returns>
 public bool TryGetValueToBool(string key)
 {
     Information.TryGetValue(key, out bool value);
     return(value);
 }