Exemple #1
0
        private void Exitbutton_Click(object sender, RoutedEventArgs e)
        {
            this.UserNametextBox.IsEnabled = true;
            this.passwordBox.IsEnabled     = true;
            this.UserNametextBox.Clear();
            this.passwordBox.Clear();
            this.UserNametextBox.Focus();
            XMLHelper.UsersDeleter("UsersFile");
            bool rejisterflag = GlobalData.Rejisterflag;

            if (rejisterflag)
            {
                CustomProtocol proto = new CustomProtocol();
                proto.AddString("EE1");
                proto.AddString(GlobalData.UserName);
                Connection.Send(proto);
            }
            this.remember_check.IsChecked  = new bool?(false);
            this.remember_check.IsEnabled  = true;
            GlobalData.Rememberflag        = false;
            this.automatic_check.IsChecked = new bool?(false);
            this.automatic_check.IsEnabled = true;
            GlobalData.Automaticflag       = "0";
            GlobalData.Rejisterflag        = false;
            bool flag = RejisterPage.username != null;

            if (flag)
            {
                RejisterPage.username();
            }
        }
Exemple #2
0
        private void SendVerify(object sender, RoutedEventArgs e)
        {
            this.appKey      = "SK5S68F7DZKKWIL3";
            this.appSecret   = "IHL982FMLT1GTJYU5VNDNSS9N7T8EZIA";
            this.phoneNumber = this.PhoneNumbertextBox.Text;
            string serverUrl = "http://client.blackbirdsport.com/api/requestConnectVerifyCode";
            string sign      = RejisterPage.getSignature(new SortedDictionary <string, string>
            {
                {
                    "ak",
                    this.appKey
                },
                {
                    "userId",
                    this.phoneNumber
                }
            }, this.appSecret);

            this.Secret = sign;
            string postData = string.Format("ak={0}&userId={1}&sign={2}", this.appKey, this.phoneNumber, this.Secret);
            string @return  = RejisterPage.HttpGetConnectToServer(serverUrl, postData);
            string flag     = @return.Substring(11, 2);
            bool   flag2    = flag == "ok";

            if (flag2)
            {
                MessageBox.Show("请输入手机验证码");
            }
            else
            {
                string error = @return.Substring(65, 6);
                string a     = error;
                if (!(a == "000001"))
                {
                    if (!(a == "010001"))
                    {
                        if (!(a == "010007"))
                        {
                            if (a == "010010")
                            {
                                MessageBox.Show("用户不存在");
                            }
                        }
                        else
                        {
                            MessageBox.Show("验证码错误");
                        }
                    }
                    else
                    {
                        MessageBox.Show("ak或签名错误");
                    }
                }
                else
                {
                    MessageBox.Show("未知其他错误");
                }
            }
        }
Exemple #3
0
        private void DisLogin()
        {
            base.Dispatcher.Invoke(delegate
            {
                this.UserNametextBox.IsEnabled = true;
            });
            base.Dispatcher.Invoke(delegate
            {
                this.passwordBox.IsEnabled = true;
            });
            base.Dispatcher.Invoke(delegate
            {
                this.UserNametextBox.Clear();
            });
            base.Dispatcher.Invoke(delegate
            {
                this.passwordBox.Clear();
            });
            base.Dispatcher.Invoke(delegate
            {
                this.UserNametextBox.Focus();
            });
            XMLHelper.UsersDeleter("UsersFile");
            base.Dispatcher.Invoke(delegate
            {
                this.remember_check.IsChecked = new bool?(false);
            });
            base.Dispatcher.Invoke(delegate
            {
                this.remember_check.IsEnabled = true;
            });
            Dispatcher arg_D9_0 = base.Dispatcher;
            Action     arg_D9_1;

            if ((arg_D9_1 = RejisterPage.DifficultyControlPropertyChange.difficultyControlChange__26_7) == null)
            {
                arg_D9_1 = (RejisterPage.DifficultyControlPropertyChange.difficultyControlChange__26_7 = new Action(RejisterPage.DifficultyControlPropertyChange.difficultyControlChange.DisLogin));
            }
            arg_D9_0.Invoke(arg_D9_1);
            base.Dispatcher.Invoke(delegate
            {
                this.automatic_check.IsChecked = new bool?(false);
            });
            base.Dispatcher.Invoke(delegate
            {
                this.automatic_check.IsEnabled = true;
            });
            GlobalData.Automaticflag = "0";
            GlobalData.Rejisterflag  = false;
            bool flag = RejisterPage.username != null;

            if (flag)
            {
                RejisterPage.username();
            }
        }
Exemple #4
0
        private void Loginbutton2_Click(object sender, RoutedEventArgs e)
        {
            this.appKey     = "SK5S68F7DZKKWIL3";
            this.appSecret  = "IHL982FMLT1GTJYU5VNDNSS9N7T8EZIA";
            this.verifycode = this.VerifyBox.Text;
            string serverUrl = "http://client.blackbirdsport.com/api/bikeConnect";
            string sign2     = RejisterPage.getSignature(new SortedDictionary <string, string>
            {
                {
                    "ak",
                    this.appKey
                },
                {
                    "userId",
                    this.phoneNumber
                },
                {
                    "verifyCode",
                    this.verifycode
                }
            }, this.appSecret);

            this.Secret = sign2;
            string postData = string.Format("ak={0}&userId={1}&verifyCode={2}&sign={3}", new object[]
            {
                this.appKey,
                this.phoneNumber,
                this.verifycode,
                this.Secret
            });
            string return2 = RejisterPage.HttpGetConnectToServer(serverUrl, postData);
            string flag    = return2.Substring(11, 2);
            bool   flag2   = flag == "ok";

            if (flag2)
            {
                MessageBox.Show("登陆成功!");
                this.PhoneNumbertextBox.IsEnabled = false;
                this.VerifyBox.IsEnabled          = false;
                this.SendVerifyButton.IsEnabled   = false;
                GlobalData.BBRejisterflag         = true;
                GlobalData.phoneNumber            = this.phoneNumber;
                GlobalData.verifycode             = this.verifycode;
                for (int i = 57; i <= 60; i++)
                {
                    bool flag3 = return2.Substring(i, 1) == ",";
                    if (flag3)
                    {
                        GlobalData.weight = return2.Substring(57, i - 57);
                    }
                }
                GlobalData.openId = return2.Substring(return2.Length - 9, 6);
                XMLHelper.BBUsersWriter("BBUsersFile");
            }
            else
            {
                string error = return2.Substring(52, 6);
                string a     = error;
                if (!(a == "000001"))
                {
                    if (!(a == "010001"))
                    {
                        if (!(a == "010007"))
                        {
                            if (a == "010010")
                            {
                                MessageBox.Show("用户不存在");
                            }
                        }
                        else
                        {
                            MessageBox.Show("验证码错误");
                        }
                    }
                    else
                    {
                        MessageBox.Show("ak或签名错误");
                    }
                }
                else
                {
                    MessageBox.Show("未知其他错误");
                }
            }
        }
Exemple #5
0
        public void LoginReturn(ProtocolBase proto)
        {
            CustomProtocol protocol = (CustomProtocol)proto;
            int            start    = 0;
            string         str      = protocol.GetString(start, ref start);
            int            ret      = protocol.GetInt(start, ref start);
            int            num      = ret;

            if (num != 0)
            {
                if (num != 2)
                {
                    MessageBox.Show(MultiLanguage.Warn28, MultiLanguage.Warn_t);
                    base.Dispatcher.Invoke(delegate
                    {
                        this.UserNametextBox.IsEnabled = true;
                    });
                    base.Dispatcher.Invoke(delegate
                    {
                        this.passwordBox.IsEnabled = true;
                    });
                    base.Dispatcher.Invoke(delegate
                    {
                        this.remember_check.IsEnabled = true;
                    });
                    base.Dispatcher.Invoke(delegate
                    {
                        this.automatic_check.IsEnabled = true;
                    });
                    base.Dispatcher.Invoke(delegate
                    {
                        this.UserNametextBox.Clear();
                    });
                    base.Dispatcher.Invoke(delegate
                    {
                        this.passwordBox.Clear();
                    });
                    base.Dispatcher.Invoke(delegate
                    {
                        this.UserNametextBox.Focus();
                    });
                    base.Dispatcher.Invoke(delegate
                    {
                        this.remember_check.IsChecked = new bool?(false);
                    });
                    base.Dispatcher.Invoke(delegate
                    {
                        this.automatic_check.IsChecked = new bool?(false);
                    });
                    GlobalData.Rejisterflag = false;
                }
                else
                {
                    MessageBox.Show(MultiLanguage.Warn29, MultiLanguage.Warn_t);
                    base.Dispatcher.Invoke(delegate
                    {
                        this.UserNametextBox.IsEnabled = true;
                    });
                    base.Dispatcher.Invoke(delegate
                    {
                        this.passwordBox.IsEnabled = true;
                    });
                    base.Dispatcher.Invoke(delegate
                    {
                        this.remember_check.IsEnabled = true;
                    });
                    base.Dispatcher.Invoke(delegate
                    {
                        this.automatic_check.IsEnabled = true;
                    });
                    base.Dispatcher.Invoke(delegate
                    {
                        this.UserNametextBox.Clear();
                    });
                    base.Dispatcher.Invoke(delegate
                    {
                        this.passwordBox.Clear();
                    });
                    base.Dispatcher.Invoke(delegate
                    {
                        this.UserNametextBox.Focus();
                    });
                    base.Dispatcher.Invoke(delegate
                    {
                        this.remember_check.IsChecked = new bool?(false);
                    });
                    base.Dispatcher.Invoke(delegate
                    {
                        this.automatic_check.IsChecked = new bool?(false);
                    });
                    GlobalData.Rejisterflag = false;
                }
            }
            else
            {
                MessageBox.Show(MultiLanguage.Hint22, MultiLanguage.Warn);
                base.Dispatcher.Invoke(delegate
                {
                    this.UserNametextBox.IsEnabled = false;
                });
                base.Dispatcher.Invoke(delegate
                {
                    this.passwordBox.IsEnabled = false;
                });
                base.Dispatcher.Invoke(delegate
                {
                    this.remember_check.IsEnabled = false;
                });
                base.Dispatcher.Invoke(delegate
                {
                    this.automatic_check.IsEnabled = false;
                });
                GlobalData.Rejisterflag = true;
                XMLHelper.UsersWriter("UsersFile");
                bool flag = RejisterPage.username != null;
                if (flag)
                {
                    RejisterPage.username();
                }
            }
        }
Exemple #6
0
        private void save_Click(object sender, RoutedEventArgs e)
        {
            bool flag2 = this.saveName.Text != null;

            if (flag2)
            {
                string name      = this.saveName.Text;
                string num_regex = "^[\\d]";
                string xml_regex = "^[xml]";
                string regex     = "^[\\u4E00-\\u9FA5a-zA-Z0-9_]+$";
                bool   flag3     = string.IsNullOrWhiteSpace(name);
                if (flag3)
                {
                    MessageBox.Show(MultiLanguage.Hint1);
                }
                else
                {
                    bool flag4 = !Regex.IsMatch(name, regex);
                    if (flag4)
                    {
                        MessageBox.Show(MultiLanguage.Hint2);
                    }
                    else
                    {
                        bool flag5 = Regex.IsMatch(name, num_regex);
                        if (flag5)
                        {
                            MessageBox.Show(MultiLanguage.Hint3);
                        }
                        else
                        {
                            bool flag6 = Regex.IsMatch(name.ToLower(), xml_regex);
                            if (flag6)
                            {
                                MessageBox.Show(MultiLanguage.Hint4);
                            }
                            else
                            {
                                int  tim   = Convert.ToInt32(XMLHelper.RecordReader(name, 4));
                                bool flag7 = tim > 0;
                                if (flag7)
                                {
                                    MessageBox.Show(MultiLanguage.Hint5);
                                }
                                else
                                {
                                    XMLHelper.RecordWriter(name);
                                    XMLHelper.CurrentFile(name);
                                    bool uploadingflag = GlobalData.Uploadingflag;
                                    if (uploadingflag)
                                    {
                                        this.appKey    = "SK5S68F7DZKKWIL3";
                                        this.appSecret = "IHL982FMLT1GTJYU5VNDNSS9N7T8EZIA";
                                        string serverUrl = "http://client.blackbirdsport.com/api/uploadUHRecord";
                                        this.openId = GlobalData.openId;
                                        string sign = RejisterPage.getSignature(new SortedDictionary <string, string>
                                        {
                                            {
                                                "ak",
                                                this.appKey
                                            },
                                            {
                                                "openId",
                                                this.openId
                                            },
                                            {
                                                "recordTimeStamp",
                                                GlobalData.StartTime
                                            }
                                        }, this.appSecret);
                                        string postData = string.Format("ak={0}&openId={1}&recordTimeStamp={2}&sign={3}", new object[]
                                        {
                                            this.appKey,
                                            this.openId,
                                            GlobalData.StartTime,
                                            sign
                                        });
                                        string url = serverUrl + "?" + postData;
                                        Dictionary <string, string> postData2 = new Dictionary <string, string>();
                                        string uploadingreturn = SaveWindow.HttpPost(url, postData2, new Dictionary <string, string>
                                        {
                                            {
                                                "uhXML",
                                                Environment.CurrentDirectory + "\\" + GlobalData.StartTime + ".xml"
                                            }
                                        });
                                        string flag  = uploadingreturn.Substring(11, 2);
                                        bool   flag8 = flag == "ok";
                                        if (flag8)
                                        {
                                            MessageBox.Show("训练记录上传成功");
                                        }
                                        else
                                        {
                                            string error = uploadingreturn.Substring(55, 6);
                                            string a     = error;
                                            if (!(a == "000001"))
                                            {
                                                if (!(a == "010001"))
                                                {
                                                    if (!(a == "010007"))
                                                    {
                                                        if (a == "010010")
                                                        {
                                                            MessageBox.Show("用户不存在");
                                                        }
                                                    }
                                                    else
                                                    {
                                                        MessageBox.Show("验证码错误");
                                                    }
                                                }
                                                else
                                                {
                                                    MessageBox.Show("没有登陆,训练记录上传失败");
                                                }
                                            }
                                            else
                                            {
                                                MessageBox.Show("未知其他错误");
                                            }
                                        }
                                    }
                                    GlobalData.Time = 0L;
                                    base.Close();
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Please input the name!");
            }
        }