Browse Source

轻会员逻辑bug和部分ui bug修复

lvle 2 years ago
parent
commit
92a3e98de3
23 changed files with 842 additions and 282 deletions
  1. 209 139
      PDF Office/Helper/ServiceHelper.cs
  2. 1 1
      PDF Office/ViewModels/Dialog/ServiceDialog/CodeRegionViewModel.cs
  3. 42 4
      PDF Office/ViewModels/Dialog/ServiceDialog/LoginPasswordRegionViewModel.cs
  4. 26 9
      PDF Office/ViewModels/Dialog/ServiceDialog/LoginRegionViewModel.cs
  5. 75 3
      PDF Office/ViewModels/Dialog/ServiceDialog/PasswordUpdataRegionVIewModel.cs
  6. 1 3
      PDF Office/ViewModels/Dialog/ServiceDialog/RegisterOKRegionViewModel.cs
  7. 102 9
      PDF Office/ViewModels/Dialog/ServiceDialog/RegisterRegionViewModel.cs
  8. 10 4
      PDF Office/ViewModels/MainWindowViewModel.cs
  9. 8 2
      PDF Office/Views/Dialog/ServiceDialog/CodeRegion.xaml
  10. 117 40
      PDF Office/Views/Dialog/ServiceDialog/CodeRegion.xaml.cs
  11. 1 0
      PDF Office/Views/Dialog/ServiceDialog/LoginDialog.xaml
  12. 10 2
      PDF Office/Views/Dialog/ServiceDialog/LoginPasswordRegion.xaml
  13. 8 0
      PDF Office/Views/Dialog/ServiceDialog/LoginPasswordRegion.xaml.cs
  14. 2 1
      PDF Office/Views/Dialog/ServiceDialog/LoginRegion.xaml
  15. 9 0
      PDF Office/Views/Dialog/ServiceDialog/LoginRegion.xaml.cs
  16. 28 3
      PDF Office/Views/Dialog/ServiceDialog/PasswordUpdataRegion.xaml
  17. 9 0
      PDF Office/Views/Dialog/ServiceDialog/PasswordUpdataRegion.xaml.cs
  18. 1 0
      PDF Office/Views/Dialog/ServiceDialog/RegisterDialog.xaml
  19. 49 22
      PDF Office/Views/Dialog/ServiceDialog/RegisterRegion.xaml
  20. 10 0
      PDF Office/Views/Dialog/ServiceDialog/RegisterRegion.xaml.cs
  21. 1 0
      PDF Office/Views/Dialog/ServiceDialog/UserDialog.xaml
  22. 7 1
      PDF Office/Views/Dialog/ServiceDialog/UserOutCodeRegion.xaml
  23. 116 39
      PDF Office/Views/Dialog/ServiceDialog/UserOutCodeRegion.xaml.cs

+ 209 - 139
PDF Office/Helper/ServiceHelper.cs

@@ -73,7 +73,7 @@ namespace PDF_Office.Helper
             request.ContentType = "text/html;charset=UTF-8";
             //request.Accept = "application/vnd.api+json;version=1";
             request.UserAgent = "Apifox/1.0.0 (https://www.apifox.cn)";
-            request.Timeout = 10000;
+            request.Timeout = 20000;
             request.ServicePoint.Expect100Continue = false;
             try
             {
@@ -97,7 +97,7 @@ namespace PDF_Office.Helper
         }
             catch
             {
-                return "";
+                return "网络不稳定请重试";
             }
            
                
@@ -116,7 +116,7 @@ namespace PDF_Office.Helper
             request.ContentType = "application/json";
             //request.Accept = "application/vnd.api+json;version=1";
             request.UserAgent = "Apifox/1.0.0 (https://www.apifox.cn)";
-            request.Timeout = 10000;
+            request.Timeout = 20000;
             request.ServicePoint.Expect100Continue = false;
             StringWriter sw = new StringWriter();
             using (JsonWriter writer = new JsonTextWriter(sw))
@@ -138,29 +138,37 @@ namespace PDF_Office.Helper
                 writer.Write(postBody);
                 writer.Close();
             }
-
-            response = (HttpWebResponse)request.GetResponse();
-            using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+            try
             {
-                string responseData = reader.ReadToEnd();
-                Console.WriteLine(responseData);
-                reader.Close();
-                JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                //outemail = jobject["msg"].ToObject<string>().ToLower();
-                if (response != null)
-                {
-                    response.Close();
-                }
-                if (request != null)
+                response = (HttpWebResponse)request.GetResponse();
+                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                 {
-                    request.Abort();
+                    string responseData = reader.ReadToEnd();
+                    Console.WriteLine(responseData);
+                    reader.Close();
+                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                    //outemail = jobject["msg"].ToObject<string>().ToLower();
+                    if (response != null)
+                    {
+                        response.Close();
+                    }
+                    if (request != null)
+                    {
+                        request.Abort();
+                    }
+                    return jobject["msg"].ToObject<string>().ToLower();
+
+
                 }
-                return jobject["msg"].ToObject<string>().ToLower();
-               
-                
             }
+            catch
+            {
+                return "网络不稳定请重试";
+            }
+           
         }
 
+        //⑤报错
         public static void Get_code(string action, string email)
         {
             string post = $"?action={action}&appId=16&receiver={email}&type=0";
@@ -172,26 +180,36 @@ namespace PDF_Office.Helper
             request.ContentType = "text/html;charset=UTF-8";
             //request.Accept = "application/vnd.api+json;version=1";
             request.UserAgent = "Apifox/1.0.0 (https://www.apifox.cn)";
-            request.Timeout = 10000;
+            request.Timeout = 20000;
             request.ServicePoint.Expect100Continue = false;
-            response = (HttpWebResponse)request.GetResponse();
-            using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+            try
             {
-                string responseData = reader.ReadToEnd();
-                Console.WriteLine(responseData);
-                reader.Close();
-                JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                if (response != null)
-                {
-                    response.Close();
-                }
-                if (request != null)
+                response = (HttpWebResponse)request.GetResponse();
+                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                 {
-                    request.Abort();
+                    string responseData = reader.ReadToEnd();
+                    Console.WriteLine(responseData);
+                    reader.Close();
+                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                    if (response != null)
+                    {
+                        response.Close();
+                    }
+                    if (request != null)
+                    {
+                        request.Abort();
+                    }
+
+
                 }
-               
+            }
+            catch
+            {
                 
             }
+
+
+            
         }
         public static String Ok_code(string email, string code, string type)
         {
@@ -205,26 +223,34 @@ namespace PDF_Office.Helper
             request.ContentType = "text/html;charset=UTF-8";
             //request.Accept = "application/vnd.api+json;version=1";
             request.UserAgent = "Apifox/1.0.0 (https://www.apifox.cn)";
-            request.Timeout = 10000;
+            request.Timeout = 20000;
             request.ServicePoint.Expect100Continue = false;
-            response = (HttpWebResponse)request.GetResponse();
-            using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+            try
             {
-                string responseData = reader.ReadToEnd();
-                Console.WriteLine(responseData);
-                reader.Close();
-                JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                if (response != null)
-                {
-                    response.Close();
-                }
-                if (request != null)
+                response = (HttpWebResponse)request.GetResponse();
+                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                 {
-                    request.Abort();
+                    string responseData = reader.ReadToEnd();
+                    Console.WriteLine(responseData);
+                    reader.Close();
+                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                    if (response != null)
+                    {
+                        response.Close();
+                    }
+                    if (request != null)
+                    {
+                        request.Abort();
+                    }
+                    return jobject["msg"].ToObject<string>().ToLower();
+
                 }
-               return jobject["msg"].ToObject<string>().ToLower();
-                
             }
+            catch
+            {
+                return "网络不稳定请重试";
+            }
+           
         }
         public static String Register_email(string intemail, string intpassword, string intcode, string uuid)
         {
@@ -236,7 +262,7 @@ namespace PDF_Office.Helper
             request.ContentType = "application/json";
             //request.Accept = "application/vnd.api+json;version=1";
             request.UserAgent = "Apifox/1.0.0 (https://www.apifox.cn)";
-            request.Timeout = 10000;
+            request.Timeout = 20000;
             request.ServicePoint.Expect100Continue = false;
             StringWriter sw = new StringWriter();
             using (JsonWriter writer = new JsonTextWriter(sw))
@@ -263,26 +289,39 @@ namespace PDF_Office.Helper
                 writer.Write(postBody);
                 writer.Close();
             }
-
-            response = (HttpWebResponse)request.GetResponse();
-            using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+            try
             {
-                string responseData = reader.ReadToEnd();
-                Console.WriteLine(responseData);
-                reader.Close();
-                JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                if (response != null)
-                {
-                    response.Close();
-                }
-                if (request != null)
+                response = (HttpWebResponse)request.GetResponse();
+                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                 {
-                    request.Abort();
-                }
-               
-                return jobject["msg"].ToObject<string>().ToLower();
+                    string responseData = reader.ReadToEnd();
+                    Console.WriteLine(responseData);
+                    reader.Close();
+                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                    if (response != null)
+                    {
+                        response.Close();
+                    }
+                    if (request != null)
+                    {
+                        request.Abort();
+                    }
 
+                    if (jobject["msg"].ToObject<string>().ToLower() == "success")
+                    {
+                        access_token = jobject["result"]["access_token"].ToObject<string>().ToLower();
+                        Settings.Default.AppProperties.LoginToken = jobject["result"]["access_token"].ToObject<string>().ToLower();
+                        Settings.Default.Save();
+                    }
+                    return jobject["msg"].ToObject<string>().ToLower();
+
+                }
             }
+            catch
+            {
+                return "网络不稳定请重试";
+            }
+          
         }
         public static String Login(string intemail, string intpassword, string uuid)
         {
@@ -295,37 +334,45 @@ namespace PDF_Office.Helper
             request.ContentType = "application/x-www-form-urlencoded";
             //request.Accept = "application/vnd.api+json;version=1";
             request.UserAgent = "Apifox/1.0.0 (https://www.apifox.cn)";
-            request.Timeout = 10000;
+            request.Timeout = 20000;
             request.ServicePoint.Expect100Continue = false;
-
-            response = (HttpWebResponse)request.GetResponse();
-            using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+            try
             {
-                string responseData = reader.ReadToEnd();
-                Console.WriteLine(responseData);
-                reader.Close();
-                JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                outlogin = jobject["msg"].ToObject<string>().ToLower();
-
-                if (response != null)
-                {
-                    response.Close();
-                }
-                if (request != null)
-                {
-                    request.Abort();
-                }
-                if (jobject["msg"].ToObject<string>().ToLower() == "success")
+                response = (HttpWebResponse)request.GetResponse();
+                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                 {
-                    access_token = jobject["result"]["access_token"].ToObject<string>().ToLower();
-                    Settings.Default.AppProperties.LoginToken= jobject["result"]["access_token"].ToObject<string>().ToLower();
-                    Settings.Default.Save();
-                }
-                return jobject["msg"].ToObject<string>().ToLower();
+                    string responseData = reader.ReadToEnd();
+                    Console.WriteLine(responseData);
+                    reader.Close();
+                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                    outlogin = jobject["msg"].ToObject<string>().ToLower();
+
+                    if (response != null)
+                    {
+                        response.Close();
+                    }
+                    if (request != null)
+                    {
+                        request.Abort();
+                    }
+                    if (jobject["msg"].ToObject<string>().ToLower() == "success")
+                    {
+                        access_token = jobject["result"]["access_token"].ToObject<string>().ToLower();
+                        Settings.Default.AppProperties.LoginToken = jobject["result"]["access_token"].ToObject<string>().ToLower();
+                        Settings.Default.Save();
+                    }
+                    return jobject["msg"].ToObject<string>().ToLower();
 
+                }
+            }
+            catch
+            {
+                return "网络不稳定请重试";
             }
+           
         }
 
+        //⑤报错
         public static void Logout(string uuid)
         {
             
@@ -338,26 +385,33 @@ namespace PDF_Office.Helper
             request.ContentType = "application/x-www-form-urlencoded";
             //request.Accept = "application/vnd.api+json;version=1";
             request.UserAgent = "Apifox/1.0.0 (https://www.apifox.cn)";
-            request.Timeout = 10000;
+            request.Timeout = 20000;
             request.ServicePoint.Expect100Continue = false;
-
-            response = (HttpWebResponse)request.GetResponse();
-            using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+            try
             {
-                string responseData = reader.ReadToEnd();
-                Console.WriteLine(responseData);
-                reader.Close();
-                JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                if (response != null)
-                {
-                    response.Close();
-                }
-                if (request != null)
+                response = (HttpWebResponse)request.GetResponse();
+                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                 {
-                    request.Abort();
+                    string responseData = reader.ReadToEnd();
+                    Console.WriteLine(responseData);
+                    reader.Close();
+                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                    if (response != null)
+                    {
+                        response.Close();
+                    }
+                    if (request != null)
+                    {
+                        request.Abort();
+                    }
+
                 }
-              
             }
+            catch
+            {
+               
+            }
+           
         }
         public static String Usergout(string code)
         {
@@ -371,30 +425,37 @@ namespace PDF_Office.Helper
             request.ContentType = "application/x-www-form-urlencoded";
             //request.Accept = "application/vnd.api+json;version=1";
             request.UserAgent = "Apifox/1.0.0 (https://www.apifox.cn)";
-            request.Timeout = 10000;
+            request.Timeout = 20000;
             request.ServicePoint.Expect100Continue = false;
-
-            response = (HttpWebResponse)request.GetResponse();
-            using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+            try
             {
-                string responseData = reader.ReadToEnd();
-                Console.WriteLine(responseData);
-                reader.Close();
-                JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                if (response != null)
-                {
-                    response.Close();
-                }
-                if (request != null)
+                response = (HttpWebResponse)request.GetResponse();
+                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                 {
-                    request.Abort();
-                }
-      
-                return jobject["msg"].ToObject<string>().ToLower();
+                    string responseData = reader.ReadToEnd();
+                    Console.WriteLine(responseData);
+                    reader.Close();
+                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                    if (response != null)
+                    {
+                        response.Close();
+                    }
+                    if (request != null)
+                    {
+                        request.Abort();
+                    }
 
+                    return jobject["msg"].ToObject<string>().ToLower();
 
-               
+
+
+                }
+            }
+            catch
+            {
+                return "网络不稳定请重试";
             }
+           
         }
 
         public static String Rebirth(string intemail, string firstpassword, string secondPassword, string intcode)
@@ -408,7 +469,7 @@ namespace PDF_Office.Helper
             request.ContentType = "application/json";
             //request.Accept = "application/vnd.api+json;version=1";
             request.UserAgent = "Apifox/1.0.0 (https://www.apifox.cn)";
-            request.Timeout = 10000;
+            request.Timeout = 20000;
             request.ServicePoint.Expect100Continue = false;
             StringWriter sw = new StringWriter();
             using (JsonWriter writer = new JsonTextWriter(sw))
@@ -435,27 +496,36 @@ namespace PDF_Office.Helper
                 writer.Write(postBody);
                 writer.Close();
             }
-
-            response = (HttpWebResponse)request.GetResponse();
-            using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+            try
             {
-                string responseData = reader.ReadToEnd();
-                Console.WriteLine(responseData);
-                reader.Close();
-                JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                if (response != null)
-                {
-                    response.Close();
-                }
-                if (request != null)
+                response = (HttpWebResponse)request.GetResponse();
+                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                 {
-                    request.Abort();
+                    string responseData = reader.ReadToEnd();
+                    Console.WriteLine(responseData);
+                    reader.Close();
+                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                    if (response != null)
+                    {
+                        response.Close();
+                    }
+                    if (request != null)
+                    {
+                        request.Abort();
+                    }
+                    return jobject["msg"].ToObject<string>().ToLower();
+
+
                 }
-               return jobject["msg"].ToObject<string>().ToLower();
 
-               
             }
+            catch
+            {
+                return "网络不稳定请重试";
+            }
+           
         }
+         
     }
 }
 

+ 1 - 1
PDF Office/ViewModels/Dialog/ServiceDialog/CodeRegionViewModel.cs

@@ -267,7 +267,7 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
 
         private void Code6Changed()
         {
-            if(Code6.Length==1)
+           if(Code6.Length==1)
             {
                 Codesum = Code1 + Code2 + Code3 + Code4 + Code5 + Code6;
                 if (Codesum.Length == 6)

+ 42 - 4
PDF Office/ViewModels/Dialog/ServiceDialog/LoginPasswordRegionViewModel.cs

@@ -79,6 +79,15 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
             set
             {
                 SetProperty(ref _LoginPassword, value);
+                LoginPasswordlookVis = Visibility.Collapsed;
+                if (string.IsNullOrEmpty(LoginPassword))
+                {
+                    ChkVis = Visibility.Collapsed;
+                }
+                else
+                {
+                    ChkVis = Visibility.Visible;
+                }
                 CheckEnableNextStepEncrypt();
             }
 
@@ -123,6 +132,13 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
                 SetProperty(ref _LoginPasswordVisibility, value);
             }
         }
+        private Visibility _ChkVis = Visibility.Collapsed;
+        public Visibility ChkVis
+        {
+            get { return _ChkVis; }
+            set { SetProperty(ref _ChkVis, value); }
+        }
+
 
         private Visibility _LoginTextVisibility = Visibility.Collapsed;
         public Visibility LoginTextVisibility
@@ -144,6 +160,7 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
         public DelegateCommand GoCodeUpdataCommand { get; set; }
         public DelegateCommand LoginCommand { get; set; }
         public DelegateCommand LinkLicenseCommand { get; set; }
+        public DelegateCommand LoginPasswordChangedCommand { get; set; }
         LoginPasswordRegionViewModel(IRegionManager regionManager, IDialogService dialogService)
         {
             dialogs = dialogService;
@@ -152,8 +169,28 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
             LoginCommand = new DelegateCommand(Login);
             ChangeEmailCommand = new DelegateCommand(ChangeEmail);
             GoCodeUpdataCommand = new DelegateCommand(GoCodeUpdata);
+            LoginPasswordChangedCommand = new DelegateCommand(LoginPasswordChanged);
+        }
+        private void LoginPasswordChanged()
+        {
+
+            if (LoginPassword.Length < 6)
+            {
+                LoginPasswordlook = "At least 6 characters";
+            }
+            else if (LoginPassword.Length > 24)
+            {
+                LoginPasswordlook = "Up to 24 characters";
+            }
+            else
+            {
+                LoginPasswordlook = "";
+            }
+
         }
 
+
+
         private void GoCodeUpdata()
         {
             ServiceHelper.Get_code("user_reset_password", LoginEmail);
@@ -203,10 +240,11 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
         {
             EnableNextStep = true;
 
-            if (string.IsNullOrEmpty(LoginPassword))
-            {
-                EnableNextStep = false;
-            }
+            if (LoginPassword.Length < 6 || LoginPassword.Length > 24 )
+                {
+                    EnableNextStep = false;
+                }
+
         }
 
         public void DisplayPassword(object e)

+ 26 - 9
PDF Office/ViewModels/Dialog/ServiceDialog/LoginRegionViewModel.cs

@@ -9,6 +9,7 @@ using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
 using System.Text;
+using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Controls;
@@ -52,7 +53,7 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
         public string LoginEmaillook
         {
             get { return _LoginEmaillook; }
-            set { SetProperty(ref _LoginEmaillook, value); }
+            set { SetProperty(ref _LoginEmaillook, value);}
         }
 
 
@@ -75,6 +76,15 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
             set
             {
                 SetProperty(ref _LoginEmail, value);
+
+                if (LoginEmail == "")
+                {
+                    LoginEmaillook = "";
+                }
+                else
+                {
+                    CheckMail(LoginEmail);
+                }
                 CheckEnableNextStepEncrypt();
             }
         }
@@ -123,19 +133,26 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
         }
 
 
+        private void CheckMail(string mail)
+        {
+            string str = "^([a-z0-9_\\.-]+)@([\\da-z\\.-]+)\\.([a-z\\.]{2,6})$";
+            Regex mReg = new Regex(str);
 
+            if (mReg.IsMatch(mail))
+            {
+                LoginEmaillook = "";
+            }
+            else
+            {
+                LoginEmaillook = "请输入正确的邮箱格式";
+            }
+        }
         private void GoLogin()
         {
 
 
             LoginDialogViewModel.Close();
-
-            dialogs.ShowDialog(DialogNames.RegisterDialog, new DialogParameters(""), r =>
-            {
-
-
-            });
-
+            App.mainWindowViewModel.OpenRegister();
 
         }
 
@@ -143,7 +160,7 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
         {
             EnableNextStep = true;
 
-            if (string.IsNullOrEmpty(LoginEmail))
+            if (string.IsNullOrEmpty(LoginEmail)||LoginEmaillook!="")
             {
                 EnableNextStep = false;
             }

+ 75 - 3
PDF Office/ViewModels/Dialog/ServiceDialog/PasswordUpdataRegionVIewModel.cs

@@ -70,7 +70,12 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
             set { SetProperty(ref _LoginPasswordlook, value); }
         }
 
-
+        private string _LoginPasswordlook2;
+        public string LoginPasswordlook2
+        {
+            get { return _LoginPasswordlook2; }
+            set { SetProperty(ref _LoginPasswordlook2, value); }
+        }
 
 
         private string _LoginPassword = "";
@@ -80,6 +85,14 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
             set
             {
                 SetProperty(ref _LoginPassword, value);
+                if (string.IsNullOrEmpty(LoginPassword))
+                {
+                    ChkVis = Visibility.Collapsed;
+                }
+                else
+                {
+                    ChkVis = Visibility.Visible;
+                }
                 CheckEnableNextStepEncrypt();
             }
 
@@ -95,7 +108,19 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
             }
         }
 
+        private Visibility _ChkVis = Visibility.Collapsed;
+        public Visibility ChkVis
+        {
+            get { return _ChkVis; }
+            set { SetProperty(ref _ChkVis, value); }
+        }
 
+        private Visibility _ChkVis2 = Visibility.Collapsed;
+        public Visibility ChkVis2
+        {
+            get { return _ChkVis2; }
+            set { SetProperty(ref _ChkVis2, value); }
+        }
         private Visibility _LoginPasswordVisibility = Visibility.Visible;
         public Visibility LoginPasswordVisibility
         {
@@ -131,6 +156,14 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
             set
             {
                 SetProperty(ref _LoginPassword2, value);
+                if (string.IsNullOrEmpty(LoginPassword2))
+                {
+                    ChkVis2 = Visibility.Collapsed;
+                }
+                else
+                {
+                    ChkVis2 = Visibility.Visible;
+                }
                 CheckEnableNextStepEncrypt();
             }
 
@@ -197,21 +230,60 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
 
 
         public DelegateCommand<object> DisplayPasswordCommand { get; set; }
+        public DelegateCommand<object> DisplayPasswordCommand2 { get; set; }
 
         public DelegateCommand ChangeEmailCommand { get; set; }
         public DelegateCommand GoCodeUpdataCommand { get; set; }
         public DelegateCommand PasswordUpdataCommand { get; set; }
         public DelegateCommand LinkLicenseCommand { get; set; }
+
+        public DelegateCommand LoginPasswordChangedCommand { get; set; }
+        public DelegateCommand LoginPasswordChanged2Command { get; set; }
         PasswordUpdataRegionViewModel(IRegionManager regionManager, IDialogService dialogService)
         {
             dialogs = dialogService;
 
             DisplayPasswordCommand = new DelegateCommand<object>(DisplayPassword);
-            DisplayPasswordCommand = new DelegateCommand<object>(DisplayPassword2);
+            DisplayPasswordCommand2 = new DelegateCommand<object>(DisplayPassword2);
             PasswordUpdataCommand = new DelegateCommand(PasswordUpdata);
+            LoginPasswordChangedCommand = new DelegateCommand(LoginPasswordChanged);
+            LoginPasswordChanged2Command = new DelegateCommand(LoginPasswordChanged2);
         }
 
+        private void LoginPasswordChanged()
+        {
 
+            if (LoginPassword.Length < 6)
+            {
+                LoginPasswordlook = "At least 6 characters";
+            }
+            else if (LoginPassword.Length > 24)
+            {
+                LoginPasswordlook = "Up to 24 characters";
+            }
+            else
+            {
+                LoginPasswordlook = "";
+            }
+
+        }
+        private void LoginPasswordChanged2()
+        {
+
+            if (LoginPassword2.Length < 6)
+            {
+                LoginPasswordlook2 = "At least 6 characters";
+            }
+            else if (LoginPassword2.Length > 24)
+            {
+                LoginPasswordlook2 = "Up to 24 characters";
+            }
+            else
+            {
+                LoginPasswordlook2 = "";
+            }
+
+        }
 
         private void PasswordUpdata()
         {
@@ -233,7 +305,7 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
         {
             EnableNextStep = true;
 
-            if (string.IsNullOrEmpty(LoginPassword)|| string.IsNullOrEmpty(LoginPassword2))
+            if (LoginPassword.Length < 6 || LoginPassword.Length > 24 || LoginPassword2.Length < 6 || LoginPassword2.Length > 24)
             {
                 EnableNextStep = false;
             }

+ 1 - 3
PDF Office/ViewModels/Dialog/ServiceDialog/RegisterOKRegionViewModel.cs

@@ -58,9 +58,7 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
         {
 
             RegisterDialogViewModel.Close();
-            App.mainWindowViewModel.UserVis = Visibility.Collapsed;
-            App.mainWindowViewModel.RegisterVis = Visibility.Collapsed;
-            App.mainWindowViewModel.LoginVis = Visibility.Visible;
+            
 
         }
     }

+ 102 - 9
PDF Office/ViewModels/Dialog/ServiceDialog/RegisterRegionViewModel.cs

@@ -9,6 +9,7 @@ using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
 using System.Text;
+using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Controls;
@@ -86,6 +87,14 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
             }
         }
 
+        private bool _isRegisterPasswordDisplayed = false;
+        public bool IsRegisterPasswordDisplayed
+        {
+            get { return _isRegisterPasswordDisplayed; }
+            set { SetProperty(ref _isRegisterPasswordDisplayed, value); }
+        }
+
+
         private string _registerText1 = "Already have an account?";
         public string Registertext1
         {
@@ -116,7 +125,16 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
             get { return _registerPassword; }
             set
             {
+                
                 SetProperty(ref _registerPassword, value);
+                if (string.IsNullOrEmpty(RegisterPassword))
+                {
+                    ChkVis = Visibility.Collapsed;
+                }
+                else
+                {
+                    ChkVis = Visibility.Visible;
+                }
                 CheckEnableNextStepEncrypt();
             }
 
@@ -129,6 +147,16 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
             set
             {
                 SetProperty(ref _registerEmail, value);
+
+                if(RegisterEmail=="")
+                {
+                    RegisterEmaillook = "";
+                }
+                else
+                {
+                    CheckMail(RegisterEmail);
+                }
+               
                 CheckEnableNextStepEncrypt();
             }
         }
@@ -152,7 +180,7 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
                 SetProperty(ref _registerPasswordMsg, value);
             }
         }
-
+        
         private Visibility _registerPasswordVisibility = Visibility.Visible;
         public Visibility RegisterPasswordVisibility
         {
@@ -170,6 +198,13 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
                 SetProperty(ref _registerPasswordVisibility, value);
             }
         }
+        private Visibility _ChkVis = Visibility.Collapsed;
+        public Visibility ChkVis
+        {
+            get { return _ChkVis; }
+            set { SetProperty(ref _ChkVis, value); }
+        }
+        
         private Visibility _registerTextVisibility = Visibility.Collapsed;
         public Visibility RegisterTextVisibility
         {
@@ -183,11 +218,14 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
             get { return _isPermissionsPasswordDisplayed; }
             set { SetProperty(ref _isPermissionsPasswordDisplayed, value); }
         }
-
+        
         public DelegateCommand<object> DisplayPasswordCommand { get; set; }
         public DelegateCommand LinkPolicyCommand { get; set; }
+        public DelegateCommand CloseDialogCommand { get; set; }
         public DelegateCommand RegisterNextCommand { get; set; }
         public DelegateCommand GoLoginCommand { get; set; }
+        public DelegateCommand RegisterPasswordChangedCommand { get; set; }
+        
         public DelegateCommand LinkLicenseCommand { get; set; }
         RegisterRegionViewModel(IRegionManager regionManager, IDialogService dialogService)
         {
@@ -197,6 +235,52 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
             LinkLicenseCommand = new DelegateCommand(LinkLicense);
             GoLoginCommand = new DelegateCommand(GoLogin);
             RegisterNextCommand = new DelegateCommand(RegisterNext);
+            CloseDialogCommand = new DelegateCommand(CloseDialog);
+            RegisterPasswordChangedCommand = new DelegateCommand(RegisterPasswordChanged);
+            
+        }
+
+
+        private void RegisterPasswordChanged()
+        {
+
+           if(RegisterPassword.Length<6)
+            {
+                RegisterePasswordlook = "At least 6 characters";
+            }
+           else if(RegisterPassword.Length>24)
+            {
+                RegisterePasswordlook = "Up to 24 characters";
+            }
+           else
+            {
+                RegisterePasswordlook = "";
+            }
+
+        }
+
+
+
+        private void CheckMail(string mail)
+        {
+            string str = "^([a-z0-9_\\.-]+)@([\\da-z\\.-]+)\\.([a-z\\.]{2,6})$";
+            Regex mReg = new Regex(str);
+
+            if (mReg.IsMatch(mail))
+            {
+                RegisterEmaillook = "";
+            }
+            else
+            {
+                RegisterEmaillook = "请输入正确的邮箱格式";
+            }
+        }
+
+        private void CloseDialog()
+        {
+
+            RegisterDialogViewModel.Close();
+         
         }
 
 
@@ -210,6 +294,9 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
                 RegisterDialogViewModel.RegisterPassword = RegisterPassword;
                 ServiceHelper.Get_code("user_register", RegisterEmail);
                 RegisterDialogViewModel.RegionMan( "CodeRegion");
+                App.mainWindowViewModel.UserVis = Visibility.Visible;
+                App.mainWindowViewModel.RegisterVis = Visibility.Collapsed;
+                App.mainWindowViewModel.LoginVis = Visibility.Collapsed;
             }
             else 
             {
@@ -217,7 +304,16 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
             }
         }
 
-
+        public void SetOpenPassword(object e)
+        {
+            var chk = e as CheckBox;
+            if (chk != null)
+            {
+                IsRegisterPasswordDisplayed = false;
+                RegisterPasswordVisibility = Visibility.Visible;
+            }
+            CheckEnableNextStepEncrypt();
+        }
 
         private void GoLogin()
         {
@@ -225,11 +321,8 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
 
             RegisterDialogViewModel.Close();
 
-            dialogs.ShowDialog(DialogNames.LoginDialog, new DialogParameters(""), r =>
-            {
-               
-
-            });
+            App.mainWindowViewModel.OpenLogin();
+    
 
 
         }
@@ -255,7 +348,7 @@ namespace PDF_Office.ViewModels.Dialog.ServiceDialog
         {
             EnableNextStep = true;
            
-            if (string.IsNullOrEmpty(RegisterPassword) || string.IsNullOrEmpty(RegisterEmail))
+            if (RegisterPassword.Length<6|| RegisterPassword.Length >24 || string.IsNullOrEmpty(RegisterEmail)|| RegisterEmaillook!="")
             {
                 EnableNextStep = false;
             }

+ 10 - 4
PDF Office/ViewModels/MainWindowViewModel.cs

@@ -221,10 +221,14 @@ namespace PDF_Office.ViewModels
                 System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
                 {
                     region.RequestNavigate(RegionNames.MainRegion, "MainContent");
+                    if (App.IsShowRegist)
+                    {
+                        OpenRegister();
+                    }
+
                 }
                 ));
                 App.IsFirstOpen = false;
-
                 if (Settings.Default.AppProperties.LoginToken != "")
                 {
                     UserVis = Visibility.Visible;
@@ -233,11 +237,13 @@ namespace PDF_Office.ViewModels
                 {
                     RegisterVis = Visibility.Visible;
                 }
+               
             }
+            
         }
 
         //打开注册弹窗
-        private void OpenRegister()
+        public void OpenRegister()
         {
             dialogs.ShowDialog(DialogNames.RegisterDialog, new DialogParameters(), r =>
             {
@@ -245,7 +251,7 @@ namespace PDF_Office.ViewModels
         }
 
         //打开登录弹窗
-        private void OpenLogin()
+        public void OpenLogin()
         {
             dialogs.ShowDialog(DialogNames.LoginDialog, new DialogParameters(""), r =>
             {
@@ -253,7 +259,7 @@ namespace PDF_Office.ViewModels
         }
 
         //打开用户弹窗
-        private void OpenUser()
+        public void OpenUser()
         {
             dialogs.ShowDialog(DialogNames.UserDialog, new DialogParameters(""), r =>
             {

+ 8 - 2
PDF Office/Views/Dialog/ServiceDialog/CodeRegion.xaml

@@ -45,6 +45,7 @@
             FontFamily="Segoe UI"
             FontSize="12"
             FontStyle="Normal"
+            KeyUp="text_Code1_KeyUp"
             Text="{Binding Code1, Mode=TwoWay}"
             TextChanged="Code_TextChanged" />
         <TextBox
@@ -56,6 +57,7 @@
             HorizontalAlignment="Left"
             VerticalAlignment="Top"
             FontFamily="Segoe UI"
+             KeyUp="text_Code2_KeyUp"
             FontSize="12"
             FontStyle="Normal"
             Text="{Binding Code2, Mode=TwoWay}"
@@ -64,6 +66,7 @@
             x:Name="text_Code3"
             Width="36"
             Height="42"
+             KeyUp="text_Code3_KeyUp"
             Margin="120,138,0,0"
             Padding="10"
             HorizontalAlignment="Left"
@@ -79,6 +82,7 @@
             Height="42"
             Margin="164,138,0,0"
             Padding="10"
+             KeyUp="text_Code4_KeyUp"
             HorizontalAlignment="Left"
             VerticalAlignment="Top"
             FontFamily="Segoe UI"
@@ -91,6 +95,7 @@
             x:Name="text_Code5"
             Width="36"
             Height="42"
+             KeyUp="text_Code5_KeyUp"
             Margin="208,138,0,0"
             Padding="10"
             HorizontalAlignment="Left"
@@ -106,15 +111,16 @@
             Height="42"
             Margin="252,138,0,0"
             Padding="10"
+             KeyUp="text_Code6_KeyUp"
             HorizontalAlignment="Left"
             VerticalAlignment="Top"
             FontFamily="Segoe UI"
             FontSize="12"
             FontStyle="Normal"
-            Text="{Binding Code6, Mode=TwoWay}"
+            Text="{Binding Code6, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
             TextChanged="text_Code6_TextChanged">
             <i:Interaction.Triggers>
-                <i:EventTrigger EventName="Code6Changed">
+                <i:EventTrigger EventName="TextChanged">
                     <i:InvokeCommandAction Command="{Binding Code6ChangedCommand}" />
                 </i:EventTrigger>
             </i:Interaction.Triggers>

+ 117 - 40
PDF Office/Views/Dialog/ServiceDialog/CodeRegion.xaml.cs

@@ -36,69 +36,88 @@ namespace PDF_Office.Views.Dialog.ServiceDialog
         }
         private void Code_TextChanged(object sender, TextChangedEventArgs e)
         {
-            if (text_Code1.Text.Length >= 1)
+            if (text_Code1.Text.Length == 1)
             {
                 text_Code2.Focus();
             }
-            else if(text_Code1.Text.Length == 0)
-            {
-                text_Code1.Focus();
-            }
+
             else if (text_Code1.Text.Length > 1)
             {
-                text_Code1.Text = text_Code1.Text.Substring(0, 1);
-                text_Code1.Focus();
+                string str = text_Code1.Text;
+               
+                 text_Code1.Text = str.Substring(0, 1);
+                str = str.Remove(0, 1);
+                if(str.Length>0)
+                {
+                    text_Code2.Text = str;
+                   
+                }
+               
+                
+                
             }
         }
 
         private void text_Code2_TextChanged(object sender, TextChangedEventArgs e)
         {
-            if (text_Code2.Text.Length >= 1)
+            if (text_Code2.Text.Length == 1)
             {
                 text_Code3.Focus();
             }
-            else if (text_Code2.Text.Length == 0)
-            {
-                text_Code1.Focus();
-            }
+
             else if (text_Code2.Text.Length > 1)
             {
-                text_Code2.Text = text_Code2.Text.Substring(0, 1);
-                text_Code2.Focus();
+                string str = text_Code2.Text;
+
+                text_Code2.Text = str.Substring(0, 1);
+                str = str.Remove(0, 1);
+                if (str.Length > 0)
+                {
+                    text_Code3.Text = str;
+                }
+                
             }
         }
 
         private void text_Code3_TextChanged(object sender, TextChangedEventArgs e)
         {
-            if (text_Code3.Text.Length >= 1)
+            if (text_Code3.Text.Length == 1)
             {
                 text_Code4.Focus();
             }
-            else if (text_Code3.Text.Length == 0)
-            {
-                text_Code2.Focus();
-            }
+
             else if (text_Code3.Text.Length > 1)
             {
-                text_Code3.Text = text_Code3.Text.Substring(0, 1);
-                text_Code3.Focus();
+                string str = text_Code3.Text;
+
+                text_Code3.Text = str.Substring(0, 1);
+                str = str.Remove(0, 1);
+                if (str.Length > 0)
+                {
+                    text_Code4.Text = str;
+                }
+                
             }
         }
 
         private void text_Code4_TextChanged(object sender, TextChangedEventArgs e)
         {
-            if (this.text_Code4.Text.Length >= 1)
+            if (this.text_Code4.Text.Length == 1)
             {
                 this.text_Code5.Focus();
             }
-            else if (text_Code4.Text.Length == 0)
-            {
-                text_Code3.Focus();
-            }
+
             else if (text_Code4.Text.Length > 1)
             {
-                text_Code4.Text = text_Code4.Text.Substring(0, 1);
-                text_Code4.Focus();
+                string str = text_Code4.Text;
+
+                text_Code4.Text = str.Substring(0, 1);
+                str = str.Remove(0, 1);
+                if (str.Length > 0)
+                {
+                    text_Code5.Text = str;
+                }
+               
             }
         }
 
@@ -108,14 +127,18 @@ namespace PDF_Office.Views.Dialog.ServiceDialog
             {
                 this.text_Code6.Focus();
             }
-            else if (text_Code5.Text.Length == 0)
-            {
-                text_Code4.Focus();
-            }
+
             else if (text_Code5.Text.Length > 1)
             {
-                text_Code5.Text = text_Code5.Text.Substring(0, 1);
-                text_Code5.Focus();
+                string str = text_Code5.Text;
+
+                text_Code5.Text = str.Substring(0, 1);
+                str = str.Remove(0, 1);
+                if (str.Length > 0)
+                {
+                    text_Code6.Text = str;
+                }
+                
             }
         }
 
@@ -125,18 +148,72 @@ namespace PDF_Office.Views.Dialog.ServiceDialog
             {
                 text_Code6.Focus();
             }
-            else if (text_Code6.Text.Length == 0)
+
+            else 
+            if(text_Code6.Text.Length >1)
             {
-                text_Code5.Focus();
+                string str = text_Code6.Text;
+                text_Code6.Focus();
+                text_Code6.Text = str.Substring(0, 1);
+                
+
+            }
+
+        }
+
+        private void text_Code1_KeyUp(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Back)
+            {
+                text_Code1.Text = "";
+                text_Code1.Focus();
             }
-            else if(text_Code6.Text.Length >1)
+        }
+
+        private void text_Code2_KeyUp(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Back)
             {
-                text_Code6.Text = text_Code6.Text.Substring(0,1);
-                text_Code6.Focus();
+                text_Code2.Text = "";
+                text_Code1.Focus();
+            }
+        }
+
+        private void text_Code3_KeyUp(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Back )
+            {
+                text_Code3.Text = "";
+                text_Code2.Focus();
             }
 
         }
 
-      
+        private void text_Code4_KeyUp(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Back )
+            {
+                text_Code4.Text = "";
+                text_Code3.Focus();
+            }
+        }
+
+        private void text_Code5_KeyUp(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Back )
+            {
+                text_Code5.Text = "";
+                text_Code4.Focus();
+            }
+        }
+
+        private void text_Code6_KeyUp(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Back )
+            {
+                text_Code6.Text = "";
+                text_Code5.Focus();
+            }
+        }
     }
 }

+ 1 - 0
PDF Office/Views/Dialog/ServiceDialog/LoginDialog.xaml

@@ -8,6 +8,7 @@
     xmlns:prism="http://prismlibrary.com/"
     prism:ViewModelLocator.AutoWireViewModel="True" 
     Width="586"
+     prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
     Height="420"
     mc:Ignorable="d">
     <Grid Background="White">

+ 10 - 2
PDF Office/Views/Dialog/ServiceDialog/LoginPasswordRegion.xaml

@@ -6,7 +6,7 @@
     xmlns:help="clr-namespace:PDF_Office.Helper"
     xmlns:local="clr-namespace:PDF_Office.Views.Dialog.ServiceDialog"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-    xmlns:prism="http://prismlibrary.com/"
+    xmlns:prism="http://prismlibrary.com/" xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
     Width="326"
     Height="420"
     prism:ViewModelLocator.AutoWireViewModel="True"
@@ -344,16 +344,24 @@
                 Style="{StaticResource LoginPasswordBoxStyle}"
                 Visibility="{Binding LoginPasswordVisibility, Mode=TwoWay}" />
                 <TextBox
+                    x:Name="Text_Password"
                 Grid.ColumnSpan="2"
                 help:PasswordBoxHelper.DisplayText="{Binding LoginPasswordMsg, Mode=TwoWay}"
                 Style="{StaticResource LoginPasswordTextBoxStyle}"
                 Text="{Binding LoginPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
-                Visibility="{Binding LoginTextVisibility, Mode=TwoWay}" />
+                Visibility="{Binding LoginTextVisibility, Mode=TwoWay}" HorizontalAlignment="Left" Width="262" >
+                    <i:Interaction.Triggers>
+                        <i:EventTrigger EventName="TextChanged">
+                            <i:InvokeCommandAction Command="{Binding LoginPasswordChangedCommand}" />
+                        </i:EventTrigger>
+                    </i:Interaction.Triggers>
+                </TextBox>
                 <CheckBox
                 x:Name="DisplayLoginPasswordChk"
                 Grid.Column="1"
                 Height="16"
                 HorizontalAlignment="Left"
+                Visibility="{Binding ChkVis}"
                 Panel.ZIndex="1"
                 Command="{Binding DisplayPasswordCommand}"
                 CommandParameter="{Binding RelativeSource={RelativeSource Self}}"

+ 8 - 0
PDF Office/Views/Dialog/ServiceDialog/LoginPasswordRegion.xaml.cs

@@ -23,6 +23,14 @@ namespace PDF_Office.Views.Dialog.ServiceDialog
         public LoginPasswordRegion()
         {
             InitializeComponent();
+            Loaded += Focus_Loaded;
+
+
+        }
+
+        private void Focus_Loaded(object sender, RoutedEventArgs e)
+        {
+            Text_Password.Focus();
         }
     }
 }

+ 2 - 1
PDF Office/Views/Dialog/ServiceDialog/LoginRegion.xaml

@@ -304,11 +304,12 @@
                 VerticalAlignment="Top">
 
                 <TextBox
+                    x:Name="Text_Email"
                     Grid.ColumnSpan="2"
                     help:PasswordBoxHelper.DisplayText="{Binding LoginEmailMsg, Mode=TwoWay}"
                     Style="{StaticResource LoginEmailTextBoxStyle}"
                     Text="{Binding LoginEmail, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
-                    Visibility="{Binding EmailTextVisibility, Mode=TwoWay}" />
+                     />
             </Grid>
             <TextBlock
                 Width="262"

+ 9 - 0
PDF Office/Views/Dialog/ServiceDialog/LoginRegion.xaml.cs

@@ -23,6 +23,15 @@ namespace PDF_Office.Views.Dialog.ServiceDialog
         public LoginRegion()
         {
             InitializeComponent();
+            Loaded += Focus_Loaded;
+
+
+        }
+
+        private void Focus_Loaded(object sender, RoutedEventArgs e)
+        {
+            Text_Email.Focus();
         }
+    
     }
 }

+ 28 - 3
PDF Office/Views/Dialog/ServiceDialog/PasswordUpdataRegion.xaml

@@ -6,7 +6,7 @@
     xmlns:help="clr-namespace:PDF_Office.Helper"
     xmlns:local="clr-namespace:PDF_Office.Views.Dialog.ServiceDialog"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-    xmlns:prism="http://prismlibrary.com/"
+    xmlns:prism="http://prismlibrary.com/" xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
     Width="326"
     Height="420"
     prism:ViewModelLocator.AutoWireViewModel="True"
@@ -417,22 +417,40 @@
                 Style="{StaticResource LoginPasswordBoxStyle2}"
                 Visibility="{Binding LoginPasswordVisibility2, Mode=TwoWay}" />
                 <TextBox
+                 x:Name="Text_RePassword2"
                 Grid.ColumnSpan="2"
                 help:PasswordBoxHelper.DisplayText="{Binding LoginPasswordMsg2, Mode=TwoWay}"
                 Style="{StaticResource LoginPasswordTextBoxStyle2}"
                 Text="{Binding LoginPassword2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
-                Visibility="{Binding LoginTextVisibility2, Mode=TwoWay}" />
+                Visibility="{Binding LoginTextVisibility2, Mode=TwoWay}" >
+                    <i:Interaction.Triggers>
+                        <i:EventTrigger EventName="TextChanged">
+                            <i:InvokeCommandAction Command="{Binding LoginPasswordChanged2Command}" />
+                        </i:EventTrigger>
+                    </i:Interaction.Triggers>
+                </TextBox>
+
                 <CheckBox
                 x:Name="DisplayLoginPasswordChk2"
                 Grid.Column="1"
                 Height="16"
                 HorizontalAlignment="Left"
                 Panel.ZIndex="1"
+                     Visibility="{Binding ChkVis2}"
                 Command="{Binding DisplayPasswordCommand2}"
                 CommandParameter="{Binding RelativeSource={RelativeSource Self}}"
                 IsChecked="{Binding IsLoginPasswordDisplayed2, Mode=TwoWay}"
                 Style="{StaticResource EyeCheckbox}" />
+               
             </Grid>
+            <TextBlock
+                Width="262"
+                Height="20"
+                Margin="32,142,0,0"
+                Foreground="#F3465B"
+                HorizontalAlignment="Left"
+                VerticalAlignment="Top"
+                Text="{Binding LoginPasswordlook2, Mode=TwoWay}" Grid.ColumnSpan="2" />
             <Grid
             Width="262"
             Height="32"
@@ -455,13 +473,20 @@
                 help:PasswordBoxHelper.DisplayText="{Binding LoginPasswordMsg, Mode=TwoWay}"
                 Style="{StaticResource LoginPasswordTextBoxStyle}"
                 Text="{Binding LoginPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
-                Visibility="{Binding LoginTextVisibility, Mode=TwoWay}" />
+                Visibility="{Binding LoginTextVisibility, Mode=TwoWay}" >
+                    <i:Interaction.Triggers>
+                        <i:EventTrigger EventName="TextChanged">
+                            <i:InvokeCommandAction Command="{Binding LoginPasswordChangedCommand}" />
+                        </i:EventTrigger>
+                    </i:Interaction.Triggers>
+                </TextBox>
                 <CheckBox
                 x:Name="DisplayLoginPasswordChk"
                 Grid.Column="1"
                 Height="16"
                 HorizontalAlignment="Left"
                 Panel.ZIndex="1"
+                     Visibility="{Binding ChkVis}"
                 Command="{Binding DisplayPasswordCommand}"
                 CommandParameter="{Binding RelativeSource={RelativeSource Self}}"
                 IsChecked="{Binding IsLoginPasswordDisplayed, Mode=TwoWay}"

+ 9 - 0
PDF Office/Views/Dialog/ServiceDialog/PasswordUpdataRegion.xaml.cs

@@ -24,7 +24,16 @@ namespace PDF_Office.Views.Dialog.ServiceDialog
     {
         public PasswordUpdataRegion()
         {
+
             InitializeComponent();
+            Loaded += Focus_Loaded;
+
+
+        }
+
+        private void Focus_Loaded(object sender, RoutedEventArgs e)
+        {
+            Text_RePassword2.Focus();
         }
     }
 }

+ 1 - 0
PDF Office/Views/Dialog/ServiceDialog/RegisterDialog.xaml

@@ -7,6 +7,7 @@
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
     prism:ViewModelLocator.AutoWireViewModel="True" 
+    prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
     Width="586"
     Height="420"
     mc:Ignorable="d">

+ 49 - 22
PDF Office/Views/Dialog/ServiceDialog/RegisterRegion.xaml

@@ -6,11 +6,10 @@
     xmlns:help="clr-namespace:PDF_Office.Helper"
     xmlns:local="clr-namespace:PDF_Office.Views.Dialog.ServiceDialog"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-    xmlns:prism="http://prismlibrary.com/"
-    Height="420"
+    xmlns:prism="http://prismlibrary.com/" xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
     Width="326"
+    Height="420"
     prism:ViewModelLocator.AutoWireViewModel="True"
-    
     mc:Ignorable="d">
     <UserControl.Resources>
         <Style x:Key="EyeCheckbox" TargetType="CheckBox">
@@ -276,6 +275,18 @@
     </UserControl.Resources>
 
     <Grid Background="White">
+        <Button
+            Width="16"
+            Height="16" 
+            WindowChrome.IsHitTestVisibleInChrome="True"
+            Margin="287,17,0,0"
+            HorizontalAlignment="Left"
+            Background="Transparent"  
+            BorderThickness="0"
+            VerticalAlignment="Top"
+            Command="{Binding CloseDialogCommand}">
+            <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="11.2919922 12 12 11.2919922 6.70800781 6 12 0.708007813 11.2919922 0 6 5.29199219 0.708007812 9.76996262e-15 -2.27456942e-13 0.708007813 5.29199219 6 0 11.2919922 0.708007812 12 6 6.70800781" />
+        </Button>
         <TextBlock
             Width="72"
             Height="28"
@@ -294,21 +305,20 @@
             HorizontalAlignment="Left"
             VerticalAlignment="Top">
             <TextBox
-                
+                Name="Text_Email"
                 Grid.ColumnSpan="2"
                 help:PasswordBoxHelper.DisplayText="{Binding RegisterEmailMsg, Mode=TwoWay}"
                 Style="{StaticResource RegisterEmailTextBoxStyle}"
-                Text="{Binding RegisterEmail, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
-                Visibility="{Binding EmailTextVisibility, Mode=TwoWay}"  />
+                Text="{Binding RegisterEmail, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
         </Grid>
         <TextBlock
             Width="262"
             Height="20"
             Margin="32,144,0,0"
-            Foreground="#F3465B"
             HorizontalAlignment="Left"
-            Text="{Binding RegisterEmaillook,Mode=TwoWay}"
-            VerticalAlignment="Top"/>
+            VerticalAlignment="Top"
+            Foreground="#F3465B"
+            Text="{Binding RegisterEmaillook, Mode=TwoWay}" />
 
         <Grid
             Width="262"
@@ -316,7 +326,7 @@
             Margin="32,170,0,0"
             HorizontalAlignment="Left"
             VerticalAlignment="Top"
-            IsEnabled="{Binding ElementName=PermissionsPasswordChk, Path=IsChecked}">
+            >
             <Grid.ColumnDefinitions>
                 <ColumnDefinition />
                 <ColumnDefinition Width="24" />
@@ -332,7 +342,14 @@
                 help:PasswordBoxHelper.DisplayText="{Binding RegisterPasswordMsg, Mode=TwoWay}"
                 Style="{StaticResource RegisterPasswordTextBoxStyle}"
                 Text="{Binding RegisterPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
-                Visibility="{Binding RegisterTextVisibility, Mode=TwoWay}" />
+                Visibility="{Binding RegisterTextVisibility, Mode=TwoWay}" >
+                <i:Interaction.Triggers>
+                    <i:EventTrigger EventName="TextChanged">
+                        <i:InvokeCommandAction Command="{Binding RegisterPasswordChangedCommand}" />
+                    </i:EventTrigger>
+                </i:Interaction.Triggers>
+            </TextBox>
+            
             <CheckBox
                 x:Name="DisplayRegisterPasswordChk"
                 Grid.Column="1"
@@ -340,6 +357,7 @@
                 HorizontalAlignment="Left"
                 Panel.ZIndex="1"
                 Command="{Binding DisplayPasswordCommand}"
+                Visibility="{Binding ChkVis}"
                 CommandParameter="{Binding RelativeSource={RelativeSource Self}}"
                 IsChecked="{Binding IsRegisterPasswordDisplayed, Mode=TwoWay}"
                 Style="{StaticResource EyeCheckbox}" />
@@ -349,9 +367,9 @@
             Height="20"
             Margin="32,204,0,0"
             HorizontalAlignment="Left"
+            VerticalAlignment="Top"
             Foreground="#F3465B"
-            Text="{Binding RegisterePasswordlook,Mode=TwoWay}"
-            VerticalAlignment="Top"/>
+            Text="{Binding RegisterePasswordlook, Mode=TwoWay}" />
         <Button
             Width="262"
             Height="32"
@@ -383,9 +401,8 @@
             FontSize="12"
             FontWeight="Normal"
             Foreground="#1770F4"
-            LineHeight="20"
-            Text="{Binding GoLogin}" >
-            <Hyperlink    Command="{Binding GoLoginCommand}">Sign in </Hyperlink>
+            LineHeight="20">
+            <Hyperlink Command="{Binding GoLoginCommand}">Sign in</Hyperlink>
         </TextBlock>
         <TextBlock
             Width="262"
@@ -397,12 +414,22 @@
             FontSize="11"
             FontWeight="Normal"
             Foreground="#616469"
-            TextWrapping = "Wrap"
-            LineHeight="18">
-            <Run Text="By registering, you agree to the" />   
-           <Hyperlink NavigateUri="{Binding UriPolivy}" TextDecorations="Underline"  Command="{Binding LinkPolicyCommand}">privary policy </Hyperlink>
-           <Run Text="and"/>
-           <Hyperlink NavigateUri="{Binding UriLicense}" TextDecorations="Underline" Command="{Binding LinkLicenseCommand}">License Agreement </Hyperlink>
+            LineHeight="18"
+            TextWrapping="Wrap">
+            <Run Text="By registering, you agree to the" />
+            <Hyperlink
+                Command="{Binding LinkPolicyCommand}"
+                NavigateUri="{Binding UriPolivy}"
+                TextDecorations="Underline">
+                privary policy
+            </Hyperlink>
+            <Run Text="and" />
+            <Hyperlink
+                Command="{Binding LinkLicenseCommand}"
+                NavigateUri="{Binding UriLicense}"
+                TextDecorations="Underline">
+                License Agreement
+            </Hyperlink>
         </TextBlock>
     </Grid>
 </UserControl>

+ 10 - 0
PDF Office/Views/Dialog/ServiceDialog/RegisterRegion.xaml.cs

@@ -25,6 +25,16 @@ namespace PDF_Office.Views.Dialog.ServiceDialog
         public RegisterRegion()
         {
             InitializeComponent();
+            Loaded += Focus_Loaded;
+
+
+        }
+
+        private void Focus_Loaded(object sender, RoutedEventArgs e)
+        {
+            Text_Email.Focus();
         }
+    
+
     }
 }

+ 1 - 0
PDF Office/Views/Dialog/ServiceDialog/UserDialog.xaml

@@ -8,6 +8,7 @@
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
     Width="310"
+   prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
     Height="348"
     prism:ViewModelLocator.AutoWireViewModel="True"
     mc:Ignorable="d">

+ 7 - 1
PDF Office/Views/Dialog/ServiceDialog/UserOutCodeRegion.xaml

@@ -39,6 +39,7 @@
             x:Name="text_Code1"
             Width="36"
             Height="42"
+            KeyUp="text_Code1_KeyUp"
             Margin="24,130,0,0"
             Padding="10"
             HorizontalAlignment="Left"
@@ -51,6 +52,7 @@
         <TextBox
             x:Name="text_Code2"
             Width="36"
+            KeyUp="text_Code2_KeyUp"
             Height="42"
             Margin="69,130,0,0"
             Padding="10"
@@ -67,6 +69,7 @@
             Height="42"
             Margin="114,130,0,0"
             Padding="10"
+            KeyUp="text_Code3_KeyUp"
             HorizontalAlignment="Left"
             VerticalAlignment="Top"
             FontFamily="Segoe UI"
@@ -78,6 +81,7 @@
             x:Name="text_Code4"
             Width="36"
             Height="42"
+            KeyUp="text_Code4_KeyUp"
             Margin="159,130,0,0"
             Padding="10"
             HorizontalAlignment="Left"
@@ -92,6 +96,7 @@
             x:Name="text_Code5"
             Width="36"
             Height="42"
+            KeyUp="text_Code5_KeyUp"
             Margin="204,130,0,0"
             Padding="10"
             HorizontalAlignment="Left"
@@ -104,6 +109,7 @@
         <TextBox
             x:Name="text_Code6"
             Width="36"
+            KeyUp="text_Code6_KeyUp"
             Height="42"
             Margin="249,130,0,0"
             Padding="10"
@@ -112,7 +118,7 @@
             FontFamily="Segoe UI"
             FontSize="12"
             FontStyle="Normal"
-            Text="{Binding Code6, Mode=TwoWay}"
+            Text="{Binding Code6, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
             TextChanged="text_Code6_TextChanged">
             <i:Interaction.Triggers>
                 <i:EventTrigger EventName="Code6Changed">

+ 116 - 39
PDF Office/Views/Dialog/ServiceDialog/UserOutCodeRegion.xaml.cs

@@ -38,69 +38,88 @@ namespace PDF_Office.Views.Dialog.ServiceDialog
 
         private void Code_TextChanged(object sender, TextChangedEventArgs e)
         {
-            if (text_Code1.Text.Length >= 1)
+            if (text_Code1.Text.Length == 1)
             {
                 text_Code2.Focus();
             }
-            else if (text_Code1.Text.Length == 0)
-            {
-                text_Code1.Focus();
-            }
+
             else if (text_Code1.Text.Length > 1)
             {
-                text_Code1.Text = text_Code1.Text.Substring(0, 1);
-                text_Code1.Focus();
+                string str = text_Code1.Text;
+
+                text_Code1.Text = str.Substring(0, 1);
+                str = str.Remove(0, 1);
+                if (str.Length > 0)
+                {
+                    text_Code2.Text = str;
+
+                }
+
+
+
             }
         }
 
         private void text_Code2_TextChanged(object sender, TextChangedEventArgs e)
         {
-            if (text_Code2.Text.Length >= 1)
+            if (text_Code2.Text.Length == 1)
             {
                 text_Code3.Focus();
             }
-            else if (text_Code2.Text.Length == 0)
-            {
-                text_Code1.Focus();
-            }
+
             else if (text_Code2.Text.Length > 1)
             {
-                text_Code2.Text = text_Code2.Text.Substring(0, 1);
-                text_Code2.Focus();
+                string str = text_Code2.Text;
+
+                text_Code2.Text = str.Substring(0, 1);
+                str = str.Remove(0, 1);
+                if (str.Length > 0)
+                {
+                    text_Code3.Text = str;
+                }
+
             }
         }
 
         private void text_Code3_TextChanged(object sender, TextChangedEventArgs e)
         {
-            if (text_Code3.Text.Length >= 1)
+            if (text_Code3.Text.Length == 1)
             {
                 text_Code4.Focus();
             }
-            else if (text_Code3.Text.Length == 0)
-            {
-                text_Code2.Focus();
-            }
+
             else if (text_Code3.Text.Length > 1)
             {
-                text_Code3.Text = text_Code3.Text.Substring(0, 1);
-                text_Code3.Focus();
+                string str = text_Code3.Text;
+
+                text_Code3.Text = str.Substring(0, 1);
+                str = str.Remove(0, 1);
+                if (str.Length > 0)
+                {
+                    text_Code4.Text = str;
+                }
+
             }
         }
 
         private void text_Code4_TextChanged(object sender, TextChangedEventArgs e)
         {
-            if (this.text_Code4.Text.Length >= 1)
+            if (this.text_Code4.Text.Length == 1)
             {
                 this.text_Code5.Focus();
             }
-            else if (text_Code4.Text.Length == 0)
-            {
-                text_Code3.Focus();
-            }
+
             else if (text_Code4.Text.Length > 1)
             {
-                text_Code4.Text = text_Code4.Text.Substring(0, 1);
-                text_Code4.Focus();
+                string str = text_Code4.Text;
+
+                text_Code4.Text = str.Substring(0, 1);
+                str = str.Remove(0, 1);
+                if (str.Length > 0)
+                {
+                    text_Code5.Text = str;
+                }
+
             }
         }
 
@@ -110,14 +129,18 @@ namespace PDF_Office.Views.Dialog.ServiceDialog
             {
                 this.text_Code6.Focus();
             }
-            else if (text_Code5.Text.Length == 0)
-            {
-                text_Code4.Focus();
-            }
+
             else if (text_Code5.Text.Length > 1)
             {
-                text_Code5.Text = text_Code5.Text.Substring(0, 1);
-                text_Code5.Focus();
+                string str = text_Code5.Text;
+
+                text_Code5.Text = str.Substring(0, 1);
+                str = str.Remove(0, 1);
+                if (str.Length > 0)
+                {
+                    text_Code6.Text = str;
+                }
+
             }
         }
 
@@ -127,18 +150,72 @@ namespace PDF_Office.Views.Dialog.ServiceDialog
             {
                 text_Code6.Focus();
             }
-            else if (text_Code6.Text.Length == 0)
-            {
-                text_Code5.Focus();
-            }
+
             else if (text_Code6.Text.Length > 1)
             {
-                text_Code6.Text = text_Code6.Text.Substring(0, 1);
+                string str = text_Code6.Text;
                 text_Code6.Focus();
+                text_Code6.Text = str.Substring(0, 1);
+
+
+            }
+
+        }
+
+        private void text_Code1_KeyUp(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Back)
+            {
+                text_Code1.Text = "";
+                text_Code1.Focus();
+            }
+        }
+
+        private void text_Code2_KeyUp(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Back)
+            {
+                text_Code2.Text = "";
+                text_Code1.Focus();
+            }
+        }
+
+        private void text_Code3_KeyUp(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Back)
+            {
+                text_Code3.Text = "";
+                text_Code2.Focus();
+            }
+
+        }
+
+        private void text_Code4_KeyUp(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Back)
+            {
+                text_Code4.Text = "";
+                text_Code3.Focus();
             }
+        }
 
+        private void text_Code5_KeyUp(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Back)
+            {
+                text_Code5.Text = "";
+                text_Code4.Focus();
+            }
         }
 
+        private void text_Code6_KeyUp(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Back)
+            {
+                text_Code6.Text = "";
+                text_Code5.Focus();
+            }
+        }
 
     }
 }