Exemplo n.º 1
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value is string remarkname)
     {
         if (!string.IsNullOrWhiteSpace(remarkname))
         {
             return(remarkname);
         }
         else
         {
             if (parameter is string para)
             {
                 string nickname = Applicate.GetNicknameByJid(para);
                 return(nickname);
             }
             else
             {
                 return("未命名");
             }
         }
     }
     else
     {
         return("未命名");
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 初始化注册属性
 /// </summary>
 public void InitialRegisterProperties()
 {
     this.GotoRegisterBtnEnabled = true;
     this.BornDate                = DateTime.Now;
     this.EnabledLogin            = true;
     this.EnableRegisterPasswords = true;
     this.LoginBtnEnabled         = true;
     this.LoginPwdEnabled         = true;
     this.RNickname               = "";
     this.LoginPageIndex          = 0;
     this.PhoneNumber             = "";
     this.GotoRegisterBtnEnabled  = true;
     AvatorUploadPage             = 0;                //
     UploadedAvator               = new ImageBrush(); //清空头像
     if (IsVisitorLogin != true)
     {
         var pass = Applicate.GetWindow <Login>();
         App.Current.Dispatcher.Invoke(() =>
         {
             pass.FirstRegisterPassword.Password = "";
             pass.RegisterPasswordBox.Password   = "";
             //pass.FinalRegisterSecurePassword = new SecureString(tm, 0);
         });
     }
     //this.
 }
Exemplo n.º 3
0
        private void InitialAccount()
        {
            var recentUser = new LocalUser().GetLastUserByTime();

            if (recentUser != null)
            {
                UserId = recentUser.Telephone;//如果最近登录账号为当前输入账号
                var login = Applicate.GetWindow <IHavePassword>();
                login.LoginSecurePassword = new SecureString();
                int    length  = Convert.ToInt32(recentUser.PasswordLength);        //获取上次登录成功后的密码长度
                string fakePwd = Guid.NewGuid().ToString("N").Substring(0, length); //随机生成假的密码
                login.LoginSecurePassword  = fakePwd.ToSecureString();              //设置显示密码为假密码
                TruePasswordWhenRemembered = recentUser.Password;                   //设置真实密码
                if (!string.IsNullOrWhiteSpace(recentUser.Password))
                {
                    IsRememberPwd = true;
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 群成员预览模板项选择器
        /// </summary>
        /// <param name="item"></param>
        /// <param name="container"></param>
        /// <returns></returns>
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            DataTemplate template = null;

            if (item is DataofMember)//如果项是Member对象才使用
            {
                var member      = (DataofMember)item;
                var groupwindow = Applicate.GetWindow <GroupChatDetial>();//获取窗口
                switch (member.role)
                {
                case MemberRole.Owner:
                    template = groupwindow.FindResource("NormalMemberTemplate") as DataTemplate;
                    break;

                case MemberRole.Admin:
                    template = groupwindow.FindResource("NormalMemberTemplate") as DataTemplate;
                    break;

                case MemberRole.Member:
                    template = groupwindow.FindResource("NormalMemberTemplate") as DataTemplate;
                    break;

                case MemberRole.PlusIcon:
                    template = groupwindow.FindResource("PlusItemTemplate") as DataTemplate;
                    break;

                case MemberRole.KickIcon:
                    template = groupwindow.FindResource("MinusItemTemplate") as DataTemplate;
                    break;

                default:
                    template = groupwindow.FindResource("NormalMemberTemplate") as DataTemplate;
                    break;
                }
                return(template);
            }
            return(template);
        }
Exemplo n.º 5
0
        private void UserLogin(IHavePassword parameter)
        {
            Task.Run(() =>
            {
                if (IsVisitorLogin == true)//游客登录
                {
                    Applicate.URLDATA.data.apiUrl = ConfigurationUtil.GetValue("InitialServer") + "/";
                    VisitorKey = ConfigurationUtil.GetValue("InitialServer_key");

                    int index  = VisitorKey.LastIndexOf("?");
                    VisitorKey = VisitorKey.Substring(index + 1);

                    int index2 = VisitorKey.LastIndexOf("=");
                    VisitorKey = VisitorKey.Substring(index2 + 1);
                    VisitorLogin();
                    return;
                }

                //接收用户名和密码
                string password;
                if (IsRememberPwd &&
                    TruePasswordWhenRemembered != null &&
                    !IsCancelRememberPwdAndTextNewPwd)     //如果当前处于记住有效密码 且 不为加载密码后重新输入的密码
                {
                    password = TruePasswordWhenRemembered; //使用数据库密码
                    //parameter.LoginSecurePassword = TruePasswordWhenRemembered.ToSecureString();
                }
                else//没记住密码 或
                {
                    password = parameter.LoginSecurePassword.UnSecure();//使用文本框内密码
                }
                EnabledLogin = false;//暂时禁用登录
                //获取经纬度
                string Longitude = "0";
                string Latitude  = "0";
                if (Location.IsUnknown != true)
                {
                    Longitude = Location.Longitude.ToString();
                    Latitude  = Location.Latitude.ToString();
                }
                try
                {
                    var client = ShiKuManager.ShiKuLogin(UserId, password, Latitude, Longitude, GobalAreaList[SelectedCountryCode].prefix.ToString());
                    client.UploadDataCompleted += LoginComplete;
                }
                catch (Exception ex)
                {
                    SnackBar.Enqueue("登录失败:" + ex.Message, "重试", () => { LoginCommand.Execute(Applicate.GetWindow <IHavePassword>()); });
                    Console.WriteLine("登录失败:" + ex.Message);
                    EnabledLogin = true;//启用登录
                }
            });
        }
Exemplo n.º 6
0
        /// <summary>
        /// 游客登录
        /// </summary>
        private void VisitorLogin()
        {
            //获取经纬度
            string Longitude = "0";
            string Latitude  = "0";

            if (Location.IsUnknown != true)
            {
                Longitude = Location.Longitude.ToString();
                Latitude  = Location.Latitude.ToString();
            }
            try
            {
                var client = ShiKuManager.ShiKuVisitorLogin(VisitorKey, Latitude, Longitude);
                client.UploadDataCompleted += VisitorLoginComplete;
            }
            catch (Exception ex)
            {
                SnackBar.Enqueue("登录失败:" + ex.Message, "重试", () => { LoginCommand.Execute(Applicate.GetWindow <IHavePassword>()); });
                Console.WriteLine("登录失败:" + ex.Message);
                EnabledLogin = true;//启用登录
            }
        }