コード例 #1
0
        /// <summary> 解锁类型:设置 手势路径的处理
        /// </summary>
        /// <param name="gesture">手势密码</param>
        /// <param name="length">手势长度</param>
        public void GestureEndByTypeSettingWithGesture(string gesture, nfloat length)
        {
            var myCircleViewDelegate = Delegate as MyCircleViewDelegate;

            // 连接少于最少个数 (<4个)
            if (length < PCCircleViewConst.CircleSetCountLeast)
            {
                // 1.通知代理
                if (myCircleViewDelegate != null)
                {
                    myCircleViewDelegate.CircleViewConnectCirclesLessThanNeedWithGesture(this, Type, gesture);
                }
                // 2.改变状态为error
                ChangeCircleInCircleSetWithState(CircleState.CircleStateError);
            }
            else// 连接多于最少个数 (>=4个)
            {
                string gestureOne = PCCircleViewConst.GetGesturePassWord();
                // 接收并存储第一个密码
                if (gestureOne.Length < PCCircleViewConst.CircleSetCountLeast)
                {
                    // 记录第一次密码
                    PCCircleViewConst.SaveGesturePassWord(gesture);
                    // 通知代理
                    if (myCircleViewDelegate != null)
                    {
                        myCircleViewDelegate.CircleViewDidCompleteSetFirstGesture(this, Type, gesture);
                    }
                }
                else
                {
                    // 接受第二个密码并与第一个密码匹配,一致后存储起来  // 匹配两次手势
                    bool equal = gesture.Equals(PCCircleViewConst.GetGesturePassWord());
                    // 通知代理
                    // 通知代理
                    if (myCircleViewDelegate != null)
                    {
                        myCircleViewDelegate.CircleViewDidCompleteSetSecondGesture(this, Type, gesture, equal);
                    }

                    if (equal)
                    {
                        // 一致,存储密码
                        PCCircleViewConst.SaveGesturePassWord(gesture);
                    }
                    else
                    {
                        // 不一致,重绘回显
                        ChangeCircleInCircleSetWithState(CircleState.CircleStateError);
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>解锁类型:登陆 手势路径的处理
        /// </summary>
        /// <param name="gesture"></param>
        /// <param name="length"></param>
        public void GestureEndByTypeLoginWithGesture(string gesture, nfloat length)
        {
            string password = PCCircleViewConst.GetGesturePassWord();
            bool   equal    = gesture.Equals(password);
            // 通知代理
            var myCircleViewDelegate = Delegate as MyCircleViewDelegate;

            if (myCircleViewDelegate != null)
            {
                myCircleViewDelegate.CircleViewDidCompleteLoginGesture(this, Type, gesture, equal);
            }

            if (!equal)
            {
                // 不一致,重绘回显
                ChangeCircleInCircleSetWithState(CircleState.CircleStateError);
            }
        }