コード例 #1
0
        public static int ValueToInt(TJSONValue Value)
        {
            int result;

            //@ Undeclared identifier(3): 'TJSONString'
            //@ Unsupported property or method(D): 'Value'
            //@ Unsupported function or procedure: 'TryStrToInt'
            if (!TryStrToInt(TJSONString(Value).Value, result))
            {
                throw new Exception("不是數值");
            }
            return(result);
        }
コード例 #2
0
        public static DateTime ValueToDateTime(TJSONValue Value)
        {
            DateTime result;

            //@ Undeclared identifier(3): 'TJSONString'
            //@ Unsupported property or method(D): 'Value'
            //@ Unsupported function or procedure: 'TryStrToDateTime'
            if (!TryStrToDateTime(TJSONString(Value).Value, result))
            {
                throw new Exception("不是日期時間");
            }
            return(result);
        }
コード例 #3
0
        // 值的轉換
        public static string ValueToString(TJSONValue Value)
        {
            string result;

            try {
                //@ Undeclared identifier(3): 'TJSONString'
                //@ Unsupported property or method(D): 'Value'
                result = TJSONString(Value).Value;
            }
            catch {
                throw new Exception("不是字串");
            }
            return(result);
        }
コード例 #4
0
ファイル: CTCallback.cs プロジェクト: moto4321/Master201907
        public override TJSONValue Execute(TJSONValue value, int JSONType)
        {
            TJSONObject obj = TJSONObject.Parse(value.ToString());

            Context.Send(new SendOrPostCallback(x =>
            {
                PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
                PhoneApplicationPage mp     = frame.Content as PhoneApplicationPage;
                if (mp is MainTweetPage)
                {
                    ((MainTweetPage)mp).listBox1.Items.Add(obj.getString("username") + ": " + obj.getString("message"));
                    SoundEffect.MasterVolume        = 1.0f;
                    SoundEffect sfx                 = SoundEffect.FromStream(TitleContainer.OpenStream("tweet.wav"));
                    SoundEffectInstance sfxInstance = sfx.CreateInstance();
                    sfxInstance.Play();
                }
            }), null);
            return(null);
        }
コード例 #5
0
        public static bool ValueToBoolean(TJSONValue Value)
        {
            bool result;

            //@ Undeclared identifier(3): 'TJSONFalse'
            if (Value is TJSONFalse)
            {
                result = false;
            }
            //@ Undeclared identifier(3): 'TJSONTrue'
            else if (Value is TJSONTrue)
            {
                result = true;
            }
            else
            {
                throw new Exception("不是布林");
            }
            return(result);
        }
コード例 #6
0
ファイル: DBXCallback.cs プロジェクト: pnwdelphi/December2012
 /**
  * override this method to implement callbacks actions
  * @param pars
  */
 public abstract TJSONValue Execute(TJSONValue value, int JSONType);
コード例 #7
0
 public static void SetVariantToJSONValue(TJSONValue xObject, object Value)
 {
     SetValueToJSONValue(xObject, VariantToValue(Value));
 }
コード例 #8
0
 public static void SetValueToJSONValue(TJSONValue xObject, DateTime Value)
 {
     SetValueToJSONValue(xObject, DateTimeToValue(Value));
 }
コード例 #9
0
 public static void SetValueToJSONValue(TJSONValue xObject, bool Value)
 {
     SetValueToJSONValue(xObject, BooleanToValue(Value));
 }
コード例 #10
0
 public static void SetValueToJSONValue(TJSONValue xObject, double Value)
 {
     SetValueToJSONValue(xObject, DoubleToValue(Value));
 }
コード例 #11
0
 public static void SetValueToJSONValue(TJSONValue xObject, int Value)
 {
     SetValueToJSONValue(xObject, IntToValue(Value));
 }
コード例 #12
0
 public static void SetValueToJSONValue(TJSONValue xObject, string Value)
 {
     SetValueToJSONValue(xObject, StringToValue(Value));
 }
コード例 #13
0
        // 以序列的方式操作JSON物件(支援多型)
        public static void SetStratumValue(TJSONObject Owner, string[] Stratum, TJSONValue Value)
        {
            int         i;
            int         index;
            int         max;
            TJSONObject mObj;
            TJSONObject mObj1;
            TJSONPair   mPar;

            if (Stratum.Length == 0)
            {
                return;
            }
            mObj = Owner;
            max  = Stratum.GetUpperBound(0);
            for (i = 0; i < max; i++)
            {
                // 只作到倒數第2個
                index = IndexOfName(mObj, Stratum[i]);
                if (index == -1)
                {
                    mObj1 = new TJSONObject();
                    //@ Unsupported property or method(A): 'AddPair'
                    mObj.AddPair(Stratum[i], mObj1);
                    mObj = mObj1;
                    // 現在的兒子是下一次的爸爸
                }
                else
                {
                    //@ Unsupported property or method(A): 'get'
                    mPar = mObj.get(index);
                    //@ Unsupported property or method(C): 'JsonValue'
                    //@ Undeclared identifier(3): 'TJSONObject'
                    if (mPar.JsonValue is TJSONObject)
                    {
                        //@ Unsupported property or method(C): 'JsonValue'
                        //@ Undeclared identifier(3): 'TJSONObject'
                        mObj = TJSONObject(mPar.JsonValue);
                    }
                    else
                    {
                        // 兒子不是TJSONObject就砍掉重建
                        //@ Unsupported property or method(C): 'JsonValue'
                        //@ Unsupported property or method(D): 'Free'
                        mPar.JsonValue.Free;
                        mObj1 = new TJSONObject();
                        //@ Unsupported property or method(C): 'JsonValue'
                        mPar.JsonValue = mObj1;
                        mObj           = mObj1;
                        // 現在的兒子是下一次的爸爸
                    }
                }
            }
            // 做最後一個
            index = IndexOfName(mObj, Stratum[max]);
            if (index == -1)
            {
                //@ Unsupported property or method(A): 'AddPair'
                mObj.AddPair(Stratum[max], Value);
            }
            else
            {
                //@ Unsupported property or method(A): 'Get'
                //@ Unsupported property or method(D): 'JsonValue'
                //@ Unsupported property or method(D): 'Free'
                mObj.Get(index).JsonValue.Free;
                //@ Unsupported property or method(A): 'Get'
                //@ Unsupported property or method(D): 'JsonValue'
                mObj.Get(index).JsonValue = Value;
            }
        }
コード例 #14
0
ファイル: DBXCallback.cs プロジェクト: moto4321/Master201907
 /**
  * override this method to implement callbacks actions
  * @param pars
  */
 public abstract TJSONValue Execute(TJSONValue value, int JSONType);
コード例 #15
0
        public object AnsiStrToVar2_GetValue(TJSONValue xValue)
        {
            object result;

            return(result);
        }
コード例 #16
0
        public string AnsiStrToVar2_ChkValue(TJSONValue xValue)
        {
            string result;

            return(result);
        }
コード例 #17
0
        public static TJSONValue GetPub_J(TDataPoolNode xNode, string[] xStratum)
        {
            TJSONValue result = null;

            return(result);
        }
コード例 #18
0
 public static void SetPubValue(TDataPoolNode xNode, string[] xStratum, TJSONValue xValue)
 {
 }
コード例 #19
0
ファイル: CTCallback.cs プロジェクト: zwssunny/PMXE7
        public override TJSONValue Execute(TJSONValue value, int JSONType)
        {
            TJSONObject obj = TJSONObject.Parse(value.ToString());

            Context.Send(new SendOrPostCallback(x =>
            {
                string notificationtype = obj.getString("notificationType");
                if (notificationtype == "message")
                {
                    PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
                    PhoneApplicationPage mp     = frame.Content as PhoneApplicationPage;
                    if (mp is MainTweetPage)
                    {
                        System.Windows.Controls.ListBox listbox = ((MainTweetPage)mp).listBox1;
                        listbox.Items.Add(obj.getString("fromusrname") + " " + obj.getString("datetime"));
                        string msgText = obj.getString("message");
                        int txtPos     = 0;
                        int txtLen     = 22;
                        while (txtPos < msgText.Length)
                        {
                            string dipTxt = msgText.Substring(txtPos, txtLen);
                            listbox.Items.Add(dipTxt);
                            txtPos = txtPos + txtLen;
                            if (txtPos + txtLen > msgText.Length)
                            {
                                txtLen = msgText.Length - txtPos;
                            }
                        }
                        SoundEffect.MasterVolume        = 1.0f;
                        SoundEffect sfx                 = SoundEffect.FromStream(TitleContainer.OpenStream("tweet.wav"));
                        SoundEffectInstance sfxInstance = sfx.CreateInstance();
                        sfxInstance.Play();
                    }
                }
                else if (notificationtype == "cmd")
                {
                    if (obj.getString("cmd") == "vibrate")
                    {
                        /* SoundEffect.MasterVolume = 1.0f;
                         * SoundEffect sfx = SoundEffect.FromStream(TitleContainer.OpenStream("cmd.wav"));
                         * SoundEffectInstance sfxInstance = sfx.CreateInstance();
                         * sfxInstance.Play();*/

                        Microsoft.Devices.VibrateController.Default.Start(TimeSpan.FromMilliseconds(50));
                        System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
                        timer.Interval = new TimeSpan(0, 0, 0, 0, 200);
                        timer.Tick    += (tsender, tevt) =>
                        {
                            var t = tsender as System.Windows.Threading.DispatcherTimer;
                            t.Stop();
                            Microsoft.Devices.VibrateController.Default.Stop();
                        };
                        timer.Start();
                    }
                    if (obj.getString("cmd") == "ring")
                    {
                        SoundEffect.MasterVolume        = 1.0f;
                        SoundEffect sfx                 = SoundEffect.FromStream(TitleContainer.OpenStream("cmd.wav"));
                        SoundEffectInstance sfxInstance = sfx.CreateInstance();
                        sfxInstance.Play();
                    }
                }
            }), null);
            return(null);
        }