public void OnExpiredPayment(Date date, string referenceNumber, string dailyTransactionID,
                              string name, string phoneNumber, string email,
                              Java.Lang.Double total, Java.Lang.Double tax, Java.Lang.Double subtotal, Java.Lang.Double fee, Java.Lang.Double netAmount,
                              String metadata1, String metadata2, IList <Items> items)
 {
     tvTransactionStatus.Text = "ATHM_EXPIRED_STATUS";
 }
 public double GetAsDouble(string key)
 {
     if (id_getAsDouble_Ljava_lang_String_ == IntPtr.Zero)
         id_getAsDouble_Ljava_lang_String_ = JNIEnv.GetMethodID (class_ref, "getAsDouble", "(Ljava/lang/String;)Ljava/lang/Double;");
     IntPtr jkey = JNIEnv.NewString (key);
     try {
         using (var ret = new Java.Lang.Double (JNIEnv.CallObjectMethod (Handle, id_getAsDouble_Ljava_lang_String_, new JValue (jkey)),
                 JniHandleOwnership.TransferLocalRef | JniHandleOwnership.DoNotRegister))
             return (double) ret;
     } finally {
         JNIEnv.DeleteLocalRef (jkey);
     }
 }
        public bool TryGetValue(string key, Type settingType, out object value)
        {
            ISharedPreferences           preferences = GetPreferences();
            IDictionary <string, object> all         = preferences.All;
            var hasValue = all.TryGetValue(key, out value);

            if (hasValue && settingType == typeof(double) && value is long)
            {
                value = Double.LongBitsToDouble((long)value);
            }

            return(hasValue);
        }
        public void Put(string key, double value)
        {
            if (id_put_Ljava_lang_String_Ljava_lang_Double_ == IntPtr.Zero)
            {
                id_put_Ljava_lang_String_Ljava_lang_Double_ = JNIEnv.GetMethodID(class_ref, "put", "(Ljava/lang/String;Ljava/lang/Double;)V");
            }
            IntPtr jkey = JNIEnv.NewString(key);

            try {
                using (var val = new Java.Lang.Double(value))
                    JNIEnv.CallVoidMethod(Handle, id_put_Ljava_lang_String_Ljava_lang_Double_, new JValue(jkey), new JValue(val));
            } finally {
                JNIEnv.DeleteLocalRef(jkey);
            }
        }
        public double GetAsDouble(string key)
        {
            if (id_getAsDouble_Ljava_lang_String_ == IntPtr.Zero)
            {
                id_getAsDouble_Ljava_lang_String_ = JNIEnv.GetMethodID(class_ref, "getAsDouble", "(Ljava/lang/String;)Ljava/lang/Double;");
            }
            IntPtr jkey = JNIEnv.NewString(key);

            try {
                using (var ret = new Java.Lang.Double(JNIEnv.CallObjectMethod(Handle, id_getAsDouble_Ljava_lang_String_, new JValue(jkey)),
                                                      JniHandleOwnership.TransferLocalRef | JniHandleOwnership.DoNotRegister))
                    return((double)ret);
            } finally {
                JNIEnv.DeleteLocalRef(jkey);
            }
        }
Beispiel #6
0
        public static Dictionary <string, Java.Lang.Object> Convert(this IIdentifiable item)
        {
            var dict = new Dictionary <string, Java.Lang.Object>();

            var jsonStr      = Newtonsoft.Json.JsonConvert.SerializeObject(item);
            var propertyDict = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, object> >(jsonStr);

            foreach (var key in propertyDict.Keys)
            {
                if (key.Equals("Id"))
                {
                    continue;
                }
                var val = propertyDict[key];
                Java.Lang.Object javaVal = null;
                if (val is string str)
                {
                    javaVal = new Java.Lang.String(str);
                }
                else if (val is double dbl)
                {
                    javaVal = new Java.Lang.Double(dbl);
                }
                else if (val is int intVal)
                {
                    javaVal = new Java.Lang.Integer(intVal);
                }
                else if (val is DateTime dt)
                {
                    javaVal = dt.ToString();
                }
                else if (val is bool boolVal)
                {
                    javaVal = new Java.Lang.Boolean(boolVal);
                }

                if (javaVal != null)
                {
                    dict.Add(key, javaVal);
                }
            }

            return(dict);
        }
 void StoreSetting(ISharedPreferencesEditor editor, string key, object value)
 {
     if (value == null)
     {
         editor.Remove(key);
     }
     else if (value is int)
     {
         editor.PutInt(key, (int)value);
     }
     else if (value is long)
     {
         editor.PutLong(key, (long)value);
     }
     else if (value is float)
     {
         editor.PutFloat(key, (float)value);
     }
     else if (value is bool)
     {
         editor.PutBoolean(key, (bool)value);
     }
     else if (value is byte[])
     {
         string base64 = SerializationContants.Base64EncodingPrefix + Convert.ToBase64String((byte[])value);
         editor.PutString(key, base64);
     }
     else if (value is double)
     {
         long longValue = Double.DoubleToLongBits((double)value);
         editor.PutLong(key, longValue);
     }
     else
     {
         editor.PutString(key, value.ToString());
     }
 }
 public void Put(string key, double value)
 {
     if (id_put_Ljava_lang_String_Ljava_lang_Double_ == IntPtr.Zero)
         id_put_Ljava_lang_String_Ljava_lang_Double_ = JNIEnv.GetMethodID (class_ref, "put", "(Ljava/lang/String;Ljava/lang/Double;)V");
     IntPtr jkey = JNIEnv.NewString (key);
     try {
         using (var val = new Java.Lang.Double (value))
             JNIEnv.CallVoidMethod (Handle, id_put_Ljava_lang_String_Ljava_lang_Double_, new JValue (jkey), new JValue (val));
     } finally {
         JNIEnv.DeleteLocalRef (jkey);
     }
 }
 public Java.Lang.Object Apply(Java.Lang.Object arg)
 {
     Java.Lang.Double value = (Java.Lang.Double)arg;
     return(string.Format("{0:C}", value.DoubleValue()));
 }
Beispiel #10
0
        //Dictionary<string, Java.Lang.Object>
        public static Java.Util.HashMap Convert(this IIdentifiable item)
        {
            var dict = new Dictionary <string, Java.Lang.Object>();

            //var dict = new Java.Util.HashMap(dictionary);

            System.Diagnostics.Debug.WriteLine("\n\nConverting item\n\n"); //МУСОР

            var jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(item);

            System.Diagnostics.Debug.WriteLine("\n\nNewtonsoft.SerializeObject result -> " + jsonStr + "\n\n"); //МУСОР

            var propertyDict = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, object> >(jsonStr);

            System.Diagnostics.Debug.WriteLine("\n\nNewtonsoft.DeserializeObject result -> " + propertyDict + "\n\n"); //МУСОР



            foreach (var key in propertyDict.Keys)
            {
                System.Diagnostics.Debug.WriteLine("\n\nKey value -> " + key); //МУСОР

                if (key.Equals("Id"))
                {
                    continue;
                }
                var val = propertyDict[key];
                Java.Lang.Object javaVal = null;
                if (val is string str)
                {
                    javaVal = new Java.Lang.String(str);
                }
                else if (val is double dbl)
                {
                    javaVal = new Java.Lang.Double(dbl);
                }
                else if (val is int intVal)
                {
                    javaVal = new Java.Lang.Integer(intVal);
                }
                else if (val is DateTime dt)
                {
                    javaVal = dt.ToString();
                }
                else if (val is bool boolVal)
                {
                    javaVal = new Java.Lang.Boolean(boolVal);
                }
                else if (val is Stream stream)
                {
                    continue;
                }

                if (javaVal != null)
                {
                    System.Diagnostics.Debug.WriteLine("Java object value -> " + javaVal); //МУСОР
                    dict.Add(key, javaVal);
                    //dict.Put(key, javaVal);
                }
            }

            var javaDict = new Java.Util.HashMap(dict);

            return(javaDict);
        }