Explorar el Código

Merge branch 'dev' of git.kdan.cc:Windows/PDFOffice_Windows_exe into dev

ZhouJieSheng hace 1 año
padre
commit
b392809a1d

+ 212 - 303
PDF Office/Helper/ServiceHelper.cs

@@ -377,7 +377,6 @@ namespace PDF_Master.Helper
             }
 
 
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
 
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + GetUserUrl + "");
@@ -390,88 +389,81 @@ namespace PDF_Master.Helper
             request.ServicePoint.Expect100Continue = false;
             try
             {
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    if (response != null)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        response.Close();
-                    }
-                    if (request != null)
-                    {
-                        request.Abort();
-                    };
-                    JToken jToken;
-                    if (jobject.TryGetValue("msg", out jToken) == false)
-                    {
-                        //ListenerSubscription();
-                        App.IsLogin = true;
-                        Settings.Default.UserDate.Email= jobject["email"].ToObject<string>().ToLower();
-                        Settings.Default.UserDate.id= jobject["id"].ToObject<string>().ToLower();
-                        JArray subscriptionInfoList = (JArray)jobject["subscriptionInfoList"];
-                        foreach (JToken info in subscriptionInfoList)
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        JToken jToken;
+                        if (jobject.TryGetValue("msg", out jToken) == false)
                         {
-                            if ((int)info["platform"] == 2)
+                            //ListenerSubscription();
+                            App.IsLogin = true;
+                            Settings.Default.UserDate.Email = jobject["email"].ToObject<string>().ToLower();
+                            Settings.Default.UserDate.id = jobject["id"].ToObject<string>().ToLower();
+                            JArray subscriptionInfoList = (JArray)jobject["subscriptionInfoList"];
+                            foreach (JToken info in subscriptionInfoList)
                             {
-                                Settings.Default.UserDate.subscribeid = (string)info["id"];
-                                Settings.Default.UserDate.subscribeuserid = (string)info["userId"];
-                                Settings.Default.UserDate.subscribeplatform = (int)info["platform"];
-                                Settings.Default.UserDate.subscribestatus = (int)info["status"];
-                                if (Settings.Default.UserDate.subscribestatus > 0)
+                                if ((int)info["platform"] == 2)
                                 {
-                                    Settings.Default.UserDate.subscribeendDate = (string)info["endDate"];
-                                    Settings.Default.UserDate.subscribepayType = (int)info["payType"];
-                                }
-                              
+                                    Settings.Default.UserDate.subscribeid = (string)info["id"];
+                                    Settings.Default.UserDate.subscribeuserid = (string)info["userId"];
+                                    Settings.Default.UserDate.subscribeplatform = (int)info["platform"];
+                                    Settings.Default.UserDate.subscribestatus = (int)info["status"];
+                                    if (Settings.Default.UserDate.subscribestatus > 0)
+                                    {
+                                        Settings.Default.UserDate.subscribeendDate = (string)info["endDate"];
+                                        Settings.Default.UserDate.subscribepayType = (int)info["payType"];
+                                    }
+
 
+                                }
                             }
-                        }
-                       
-                        //此处为主页UPgread按钮的Visible
-                        if (Settings.Default.UserDate.subscribestatus == 1)
-                        {
-                            for (int i = 0; i < App.Current.Windows.Count; i++)
+
+                            //此处为主页UPgread按钮的Visible
+                            if (Settings.Default.UserDate.subscribestatus == 1)
                             {
-                                MainWindow win = App.Current.Windows[i] as MainWindow;
-                                if (win != null&& win.DataContext!=null)
+                                for (int i = 0; i < App.Current.Windows.Count; i++)
                                 {
-                                    (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Collapsed;
-                                    (win.DataContext as MainWindowViewModel).Useremailchar = Settings.Default.UserDate.Email.Substring(0, 1);
+                                    MainWindow win = App.Current.Windows[i] as MainWindow;
+                                    if (win != null && win.DataContext != null)
+                                    {
+                                        (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Collapsed;
+                                        (win.DataContext as MainWindowViewModel).Useremailchar = Settings.Default.UserDate.Email.Substring(0, 1);
+                                    }
                                 }
                             }
-                        }
-                        else
-                        {
-                            for (int i = 0; i < App.Current.Windows.Count; i++)
+                            else
                             {
-                                MainWindow win = App.Current.Windows[i] as MainWindow;
-                                if (win != null&& win.DataContext!=null)
+                                for (int i = 0; i < App.Current.Windows.Count; i++)
                                 {
-                                    (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Visible;
-                                    (win.DataContext as MainWindowViewModel).Useremailchar = Settings.Default.UserDate.Email.Substring(0, 1);
+                                    MainWindow win = App.Current.Windows[i] as MainWindow;
+                                    if (win != null && win.DataContext != null)
+                                    {
+                                        (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Visible;
+                                        (win.DataContext as MainWindowViewModel).Useremailchar = Settings.Default.UserDate.Email.Substring(0, 1);
+                                    }
                                 }
                             }
+                            #region 试用策略
+                            //Settings.Default.UserDate.isInFreeUseTime= jobject["isInFreeUseTime"].ToObject<bool>();
+                            //Settings.Default.UserDate.freeDate= jobject["freeDate"].ToObject<string>().ToLower();
+                            //if(DateTime.Parse(Settings.Default.UserDate.freeDate)<=DateTime.Now)
+                            //{
+                            //    Settings.Default.UserDate.isInFreeUseTime = false;
+                            //}
+                            #endregion
+                            App.mainWindowViewModel.Useremailchar = Settings.Default.UserDate.Email.Substring(0, 1);
+                            Settings.Default.Save();
+                            return "ture";
                         }
-                        #region 试用策略
-                        //Settings.Default.UserDate.isInFreeUseTime= jobject["isInFreeUseTime"].ToObject<bool>();
-                        //Settings.Default.UserDate.freeDate= jobject["freeDate"].ToObject<string>().ToLower();
-                        //if(DateTime.Parse(Settings.Default.UserDate.freeDate)<=DateTime.Now)
-                        //{
-                        //    Settings.Default.UserDate.isInFreeUseTime = false;
-                        //}
-                        #endregion
-                        App.mainWindowViewModel.Useremailchar = Settings.Default.UserDate.Email.Substring(0, 1);
-                        Settings.Default.Save();
-                        return "ture";
-                    }
-                    else
-                    {
+                        else
+                        {
 
-                        return "false";
+                            return "false";
+                        }
                     }
                 }
             }
@@ -533,7 +525,6 @@ namespace PDF_Master.Helper
         public static String Ok_email(string intemail, string validType)
         {
 
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + OKemailUrl);
             request.Method = "Post";
@@ -565,25 +556,18 @@ namespace PDF_Master.Helper
                     writer.Close();
                 }
 
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    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)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        request.Abort();
-                    }
-                    return jobject["code"].ToObject<string>().ToLower();
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        //outemail = jobject["msg"].ToObject<string>().ToLower();
+                        return jobject["code"].ToObject<string>().ToLower();
 
 
+                    }
                 }
             }
             catch (Exception ex)
@@ -604,7 +588,6 @@ namespace PDF_Master.Helper
         public static string Get_code(string action, string email)
         {
             string post = $"?action={action}&appId=16&receiver={email}&type=0";
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
 
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + GetcodeUrl + post);
@@ -616,23 +599,16 @@ namespace PDF_Master.Helper
             request.ServicePoint.Expect100Continue = false;
             try
             {
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    if (response != null)
-                    {
-                        response.Close();
-                    }
-                    if (request != null)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        request.Abort();
-                    }
-                    return jobject["code"].ToObject<string>().ToLower();
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        return jobject["code"].ToObject<string>().ToLower();
 
+                    }
                 }
             }
             catch
@@ -656,7 +632,6 @@ namespace PDF_Master.Helper
         {
 
             string post = $"?account={email}&code={code}&type={type}&appId=16";
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
 
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + OKcodeUrl + post);
@@ -668,23 +643,16 @@ namespace PDF_Master.Helper
             request.ServicePoint.Expect100Continue = false;
             try
             {
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    if (response != null)
-                    {
-                        response.Close();
-                    }
-                    if (request != null)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        request.Abort();
-                    }
-                    return jobject["code"].ToObject<string>().ToLower();
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        return jobject["code"].ToObject<string>().ToLower();
 
+                    }
                 }
             }
             catch
@@ -706,7 +674,6 @@ namespace PDF_Master.Helper
         public static String Register_email(string intemail, string intpassword, string intcode, string uuid)
         {
 
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + registerUrl);
             request.Method = "Post";
@@ -745,47 +712,40 @@ namespace PDF_Master.Helper
                     writer.Close();
                 }
 
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    if (response != null)
-                    {
-                        response.Close();
-                    }
-                    if (request != null)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        request.Abort();
-                    }
-
-                    if (jobject["code"].ToObject<string>().ToLower() == "200")
-                    {
-                        App.IsLogin =true;
-                        for (int i = 0; i < App.Current.Windows.Count; i++)
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        if (jobject["code"].ToObject<string>().ToLower() == "200")
                         {
-                            MainWindow win = App.Current.Windows[i] as MainWindow;
-                            if (win != null && win.DataContext != null)
+                            App.IsLogin = true;
+                            for (int i = 0; i < App.Current.Windows.Count; i++)
                             {
-                                (win.DataContext as MainWindowViewModel).UserVis = Visibility.Visible;
-                                (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Collapsed;
-                                (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                                MainWindow win = App.Current.Windows[i] as MainWindow;
+                                if (win != null && win.DataContext != null)
+                                {
+                                    (win.DataContext as MainWindowViewModel).UserVis = Visibility.Visible;
+                                    (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Collapsed;
+                                    (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                                }
                             }
+                            Settings.Default.UserDate.Email = intemail;
+                            Settings.Default.UserDate.IsLoginoff = false;
+                            access_token = jobject["result"]["access_token"].ToObject<string>().ToLower();
+                            Settings.Default.AppProperties.LoginToken = jobject["result"]["access_token"].ToObject<string>().ToLower();
+                            Settings.Default.Save();
+
+                            GetUser();
                         }
-                        Settings.Default.UserDate.Email = intemail;
-                        Settings.Default.UserDate.IsLoginoff = false;
-                        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["code"].ToObject<string>().ToLower();
 
-                        GetUser();
+                        return "200";
                     }
-                    //return jobject["code"].ToObject<string>().ToLower();
-
-                    return "200";
                 }
+
             }
             catch
             {
@@ -806,7 +766,6 @@ namespace PDF_Master.Helper
         {
 
             string postBody = $"?appId=16&deviceSign={uuid}&email={intemail}&password={intpassword}&platformType=0&model=windows";
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + LoginUrl + postBody);
             request.Method = "Post";
@@ -817,45 +776,38 @@ namespace PDF_Master.Helper
             request.ServicePoint.Expect100Continue = false;
             try
             {
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    if (response != null)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        response.Close();
-                    }
-                    if (request != null)
-                    {
-                        request.Abort();
-                    }
-                    if (jobject["code"].ToObject<string>().ToLower() == "200")
-                    {
-                        //ListenerSubscription();
-                        for (int i = 0; i < App.Current.Windows.Count; i++)
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        if (jobject["code"].ToObject<string>().ToLower() == "200")
                         {
-                            MainWindow win = App.Current.Windows[i] as MainWindow;
-                            if (win != null && win.DataContext != null)
+                            //ListenerSubscription();
+                            for (int i = 0; i < App.Current.Windows.Count; i++)
                             {
-                                (win.DataContext as MainWindowViewModel).UserVis = Visibility.Visible;
-                                (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Collapsed;
-                                (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                                MainWindow win = App.Current.Windows[i] as MainWindow;
+                                if (win != null && win.DataContext != null)
+                                {
+                                    (win.DataContext as MainWindowViewModel).UserVis = Visibility.Visible;
+                                    (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Collapsed;
+                                    (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                                }
                             }
+                            App.IsLogin = true;
+                            Settings.Default.UserDate.Email = intemail;
+                            Settings.Default.UserDate.IsLoginoff = false;
+                            access_token = jobject["result"]["access_token"].ToObject<string>().ToLower();
+                            Settings.Default.AppProperties.LoginToken = jobject["result"]["access_token"].ToObject<string>().ToLower();
+                            Settings.Default.Save();
+                            GetUser();
+
                         }
-                        App.IsLogin = true;
-                        Settings.Default.UserDate.Email = intemail;
-                        Settings.Default.UserDate.IsLoginoff = false;
-                        access_token = jobject["result"]["access_token"].ToObject<string>().ToLower();
-                        Settings.Default.AppProperties.LoginToken = jobject["result"]["access_token"].ToObject<string>().ToLower();
-                        Settings.Default.Save();
-                        GetUser();
+                        return jobject["code"].ToObject<string>().ToLower();
 
                     }
-                    return jobject["code"].ToObject<string>().ToLower();
-
                 }
             }
             catch
@@ -874,7 +826,6 @@ namespace PDF_Master.Helper
         {
 
             string postBody = $"?deviceSign={uuid}&appId=16";
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + LogoutUrl + postBody);
             request.Method = "Post";
@@ -886,37 +837,30 @@ namespace PDF_Master.Helper
             request.ServicePoint.Expect100Continue = false;
             try
             {
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    App.IsLogin = false;
-                    Settings.Default.UserDate.subscribestatus = -1;
-                    Settings.Default.UserDate.subscribepayType = 0;
-                    App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
-                    for (int i = 0; i < App.Current.Windows.Count; i++)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        MainWindow win = App.Current.Windows[i] as MainWindow;
-                        if (win != null && win.DataContext != null)
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        App.IsLogin = false;
+                        Settings.Default.UserDate.subscribestatus = -1;
+                        Settings.Default.UserDate.subscribepayType = 0;
+                        App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
+                        for (int i = 0; i < App.Current.Windows.Count; i++)
                         {
-                            (win.DataContext as MainWindowViewModel).UserVis = Visibility.Collapsed;
-                            (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Visible;
-                            (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
-                            (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Visible;
+                            MainWindow win = App.Current.Windows[i] as MainWindow;
+                            if (win != null && win.DataContext != null)
+                            {
+                                (win.DataContext as MainWindowViewModel).UserVis = Visibility.Collapsed;
+                                (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Visible;
+                                (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                                (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Visible;
+                            }
                         }
-                    }
-                    if (response != null)
-                    {
-                        response.Close();
-                    }
-                    if (request != null)
-                    {
-                        request.Abort();
-                    }
 
+                    }
                 }
             }
             catch
@@ -936,7 +880,6 @@ namespace PDF_Master.Helper
         {
 
             string postBody = $"?code={code}&appId=16";
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + UseroutUrl + postBody);
             request.Method = "Post";
@@ -948,41 +891,33 @@ namespace PDF_Master.Helper
             request.ServicePoint.Expect100Continue = false;
             try
             {
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    App.IsLogin = false;
-                    Settings.Default.UserDate.subscribestatus = -1;
-                    Settings.Default.UserDate.subscribepayType = 0;
-                    for (int i = 0; i < App.Current.Windows.Count; i++)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        MainWindow win = App.Current.Windows[i] as MainWindow;
-                        if (win != null && win.DataContext != null)
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        App.IsLogin = false;
+                        Settings.Default.UserDate.subscribestatus = -1;
+                        Settings.Default.UserDate.subscribepayType = 0;
+                        for (int i = 0; i < App.Current.Windows.Count; i++)
                         {
-                            (win.DataContext as MainWindowViewModel).UserVis = Visibility.Collapsed;
-                            (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Visible;
-                            (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
-                            (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Visible;
+                            MainWindow win = App.Current.Windows[i] as MainWindow;
+                            if (win != null && win.DataContext != null)
+                            {
+                                (win.DataContext as MainWindowViewModel).UserVis = Visibility.Collapsed;
+                                (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Visible;
+                                (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                                (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Visible;
+                            }
                         }
-                    }
-                    App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
-                    if (response != null)
-                    {
-                        response.Close();
-                    }
-                    if (request != null)
-                    {
-                        request.Abort();
-                    }
-
-                    return jobject["code"].ToObject<string>().ToLower();
+                        App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
 
+                        return jobject["code"].ToObject<string>().ToLower();
 
 
+                    }
                 }
             }
             catch
@@ -1004,7 +939,6 @@ namespace PDF_Master.Helper
         {
 
 
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + RebirthUrl);
             request.Method = "Post";
@@ -1041,33 +975,25 @@ namespace PDF_Master.Helper
                     writer.Close();
                 }
 
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    if (response != null)
-                    {
-                        response.Close();
-                    }
-                    if (request != null)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        request.Abort();
-                    }
-                    for (int i = 0; i < App.Current.Windows.Count; i++)
-                    {
-                        MainWindow win = App.Current.Windows[i] as MainWindow;
-                        if (win != null)
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        for (int i = 0; i < App.Current.Windows.Count; i++)
                         {
-                            (win.DataContext as MainWindowViewModel).UserVis = Visibility.Collapsed;
-                            (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Visible;
-                            (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                            MainWindow win = App.Current.Windows[i] as MainWindow;
+                            if (win != null)
+                            {
+                                (win.DataContext as MainWindowViewModel).UserVis = Visibility.Collapsed;
+                                (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Visible;
+                                (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                            }
                         }
+                        return jobject["code"].ToObject<string>().ToLower();
                     }
-                    return jobject["code"].ToObject<string>().ToLower();
-
 
                 }
 
@@ -1086,7 +1012,6 @@ namespace PDF_Master.Helper
         {
 
             string postBody = $"?appId=16&deviceSign={GetDeviceSerialNumber()}";
-            HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + CheckDeviceStatusUrl + postBody);
             request.Method = "Post";
@@ -1097,41 +1022,35 @@ namespace PDF_Master.Helper
             request.ServicePoint.Expect100Continue = false;
             try
             {
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    string responseData = reader.ReadToEnd();
-                    Console.WriteLine(responseData);
-                    reader.Close();
-                    JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
-                    App.IsLogin = false;
-                    Settings.Default.UserDate.subscribestatus = -1;
-                    Settings.Default.UserDate.subscribepayType = 0;
-                    App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
-                    if(App.Current.Windows!=null&&App.Current.Windows.Count!=0)
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        for (int i = 0; i < App.Current.Windows.Count; i++)
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        reader.Close();
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        App.IsLogin = false;
+                        Settings.Default.UserDate.subscribestatus = -1;
+                        Settings.Default.UserDate.subscribepayType = 0;
+                        App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
+                        if (App.Current.Windows != null && App.Current.Windows.Count != 0)
                         {
-                            MainWindow win = App.Current.Windows[i] as MainWindow;
-                            if (win != null&& win.DataContext!=null)
+                            for (int i = 0; i < App.Current.Windows.Count; i++)
                             {
-                                (win.DataContext as MainWindowViewModel).UserVis = Visibility.Collapsed;
-                                (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Visible;
-                                (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
-                                (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Visible;
+                                MainWindow win = App.Current.Windows[i] as MainWindow;
+                                if (win != null && win.DataContext != null)
+                                {
+                                    (win.DataContext as MainWindowViewModel).UserVis = Visibility.Collapsed;
+                                    (win.DataContext as MainWindowViewModel).LoginVis = Visibility.Visible;
+                                    (win.DataContext as MainWindowViewModel).RegisterVis = Visibility.Collapsed;
+                                    (win.DataContext as MainWindowViewModel).UpgradeVis = Visibility.Visible;
+                                }
                             }
                         }
-                    }
 
-                    if (response != null)
-                    {
-                        response.Close();
-                    }
-                    if (request != null)
-                    {
-                        request.Abort();
+                        return jobject["code"].ToObject<string>().ToLower();
                     }
-                    return jobject["code"].ToObject<string>().ToLower();
                 }
             }
             catch 
@@ -1149,7 +1068,6 @@ namespace PDF_Master.Helper
             string url = RequestHost + DeviceLogUrl;
             try
             {
-                HttpWebResponse response = null;
                 ServicePointManager.DefaultConnectionLimit = 200;
                 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + DeviceLogUrl);
                 request.Method = "Post";
@@ -1194,26 +1112,17 @@ namespace PDF_Master.Helper
                     writer.Write(postBody);
                     writer.Close();
                 }
-
-                response = (HttpWebResponse)request.GetResponse();
-                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                 {
-                    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["code"].ToObject<string>().ToLower() == "200")
+                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                     {
-                        Console.WriteLine("软件启动信息上传成功");
+                        string responseData = reader.ReadToEnd();
+                        Console.WriteLine(responseData);
+                        JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
+                        if (jobject["code"].ToObject<string>().ToLower() == "200")
+                        {
+                            Console.WriteLine("软件启动信息上传成功");
+                        }
                     }
                 }
             }

+ 2 - 1
PDF Office/ViewModels/BOTA/AnnotationContentViewModel.cs

@@ -1471,8 +1471,9 @@ namespace PDF_Master.ViewModels.BOTA
                 iCollectionView.SortDescriptions.Add(new SortDescription(nameof(AnnotationHandlerEventArgs.PageIndex), ListSortDirection.Ascending));
                 iCollectionView.SortDescriptions.Add(new SortDescription(nameof(AnnotationHandlerEventArgs.AnnotIndex), ListSortDirection.Ascending));
 
+                //Load会触发 重复触发,暂时注释
                 //按照PageIndex,分组 排序
-                SetGroupHeader(listBox);
+                //SetGroupHeader(listBox);
                 Screen = Visibility.Collapsed;
                 colors.Clear();
                 authors.Clear();

+ 16 - 0
PDF Office/ViewModels/BOTA/BOTAContentViewModel.cs

@@ -15,6 +15,9 @@ using PDF_Master.Views.PageEdit;
 using PDF_Master.Properties;
 using PDF_Master.Helper;
 using PDFReader_WPF.Helper;
+using System.Drawing;
+using PDF_Master.Views.BOTA;
+using ImTools;
 
 namespace PDF_Master.ViewModels.BOTA
 {
@@ -138,6 +141,7 @@ namespace PDF_Master.ViewModels.BOTA
                 }
             }
         }
+
         /// <summary>
         /// 侧边按钮埋点
         /// </summary>
@@ -153,17 +157,21 @@ namespace PDF_Master.ViewModels.BOTA
                 case "TabItemThumbnail":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.LeftSideBar, "LeftSideBar_Btn", "Btn_LeftSideBar_Thumbnail");
                     break;
+
                 case "TabItemBookMark":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.LeftSideBar, "LeftSideBar_Btn", "Btn_LeftSideBar_BookMark");
                     break;
+
                 case "TabItemAnnotation":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.LeftSideBar, "LeftSideBar_Btn", "Btn_LeftSideBar_Annotation");
                     break;
+
                 case "TabItemSearch":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.LeftSideBar, "LeftSideBar_Btn", "Btn_LeftSideBar_Search");
                     break;
             }
         }
+
         private void InitString()
         {
             Tip_Annote = App.MainPageLoader.GetString("ViewTopToolbar_Annotation");
@@ -208,6 +216,13 @@ namespace PDF_Master.ViewModels.BOTA
                 if (viewNameByTabItem.ContainsKey(currentBar))
                 {
                     regions.RequestNavigate(BOTAContentRegionName, viewNameByTabItem[currentBar], param);
+
+                    var views = regions.Regions[BOTAContentRegionName].Views;
+                    var search = views.FindFirst(x => x is SearchContent);
+                    if (search is SearchContent searchContent)
+                    {
+                        viewContentViewModel.SearchTextFocus(searchContent);
+                    }
                 }
 
                 //增加判空逻辑
@@ -249,6 +264,7 @@ namespace PDF_Master.ViewModels.BOTA
         }
 
         #region Navigate
+
         public bool IsNavigationTarget(NavigationContext navigationContext)
         {
             return true;

+ 2 - 1
PDF Office/ViewModels/BOTA/SearchContentViewModel.cs

@@ -313,9 +313,10 @@ namespace PDF_Master.ViewModels.BOTA
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
             //切换到缩略图等模块时,需要清空搜索结果显示
-            if (SearchItemList.Count>0)
+            if (SearchItemList.Count > 0)
             {
                 PDFViewer.ClearPageSelectText();
+                SearchItemList.Clear();
             }
             return;
         }

+ 3 - 2
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -1030,11 +1030,12 @@ namespace PDF_Master.ViewModels.Tools
             //    viewModel.ScrollToAnnot(pageindex[0], annoteindex, annotation.AnnotationList);
             //}
             #endregion v1.3.0 第一版
-
-            if (PDFViewer.GetSelectAnnotCount() > 0 && ViewContentViewModel.mainViewModel.AnnotMouseLeftButtonDown == false)
+            //形状、图章、签名等是添加后选中,如果注释列表数据量过大,会卡顿,影响用户体验
+            if (PDFViewer.GetSelectAnnotCount() > 0 && ViewContentViewModel.mainViewModel.AnnotMouseLeftButtonDown == false && string.IsNullOrEmpty(StrAnnotToolChecked))
             {
                 List<AnnotHandlerEventArgs> annotationHandlers = PDFViewer.GetSelectionAnnots();
                 bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemAnnotation");
+
                 if (ViewContentViewModel.OpenBOTA == false)
                 {
                     bOTAContentViewModel.OpenBOTA();

+ 85 - 18
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -226,6 +226,11 @@ namespace PDF_Master.ViewModels
 
         #region 属性、变量
 
+        /// <summary>
+        /// 用于退出页面编辑 设置bota搜索框
+        /// </summary>
+        private SearchContent searchContent = null;
+
         /// <summary>
         /// 显示 隐藏注释
         /// </summary>
@@ -703,6 +708,7 @@ namespace PDF_Master.ViewModels
                 //关闭BOTA的逻辑在xaml.cs代码里控制,无法绑定后台
             }
         }
+
         /// <summary>
         /// 防止自动保存异步导致弹窗出现两次
         /// </summary>
@@ -1714,11 +1720,11 @@ namespace PDF_Master.ViewModels
 
         private async void share()
         {
-            if (IsPopupInProgress) 
+            if (IsPopupInProgress)
             {
                 return;
             }
-            IsPopupInProgress=true;
+            IsPopupInProgress = true;
             try
             {
                 DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_Share");
@@ -1956,7 +1962,7 @@ namespace PDF_Master.ViewModels
         }
 
         public void ShowPrintDialog()
-        { 
+        {
             //保存并继续,使用了高级功能则弹窗权益弹窗
             if (!saveFile(true))
             {
@@ -2188,28 +2194,87 @@ namespace PDF_Master.ViewModels
                 var item = args.AddedItems[0] as TabItem;
                 CurrentBar = item.Name;
                 TabControlSelectonDataTracking(item.Name);
+
                 if (previousBar != CurrentBar)
                 {
                     if (CurrentBar == "TabItemPageEdit")//如果是页面编辑则进入页面编辑模式
                     {
                         EnterPageEdit();
+                        searchContent = CleanSearch();
                     }
                     else//其余情况直接导航至对应的工具栏即可,不需要清空之前的content,region里是单例模式
                     {
                         EnterSelectedBar(CurrentBar);
                         isInPageEdit = false;
+                        SearchTextFocus(searchContent);
                     }
                     previousBar = CurrentBar;
                 }
             }
         }
+
+        public void SearchTextFocus(SearchContent searchContent)
+        {
+            if (string.IsNullOrEmpty(searchContent.SearchText.Text) == false)
+            {
+                searchContent.SearchText.Dispatcher.BeginInvoke(new Action(() =>
+                {
+                    searchContent.SearchText.Focus();
+                    searchContent.SearchText.SelectAll();
+                }));
+            }
+        }
+
+        private SearchContent CleanSearch()
+        {
+            SearchContent searchContent = null;
+            if (this.OpenBOTA)
+            {
+                bool isTabItemSearch = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemSearch");
+                if (bOTAContent.TabItemSearch.IsSelected)
+                {
+                    SearchContentViewModel viewModel = GetSearchContentVM(bOTAContentViewModel, out searchContent);
+                    if (viewModel.SearchItemList.Count > 0)
+                    {
+                        PDFViewer.ClearPageSelectText();
+                        viewModel.SearchItemList.Clear();
+                    }
+                }
+            }
+            return searchContent;
+        }
+
+        private SearchContentViewModel GetSearchContentVM(BOTAContentViewModel bOTAContentViewModel, out SearchContent searchContent)
+        {
+            SearchContentViewModel viewModel = null;
+            searchContent = null;
+            if (bOTAContentViewModel != null)
+            {
+                if (region.Regions.ContainsRegionWithName(bOTAContentViewModel.BOTAContentRegionName))
+                {
+                    var views = region.Regions[bOTAContentViewModel.BOTAContentRegionName].Views;
+                    foreach (var item in views)
+                    {
+                        if (item is SearchContent search)
+                        {
+                            searchContent = search;
+                            viewModel = search.DataContext as SearchContentViewModel;
+                            break;
+                        }
+                    }
+                }
+            }
+            return viewModel;
+        }
+
         /// <summary>
         /// 选项卡切换事件埋点
         /// </summary>
         /// <param name="e"></param>
         private void TabControlSelectonDataTracking(string currentBar)
         {
-            switch (currentBar) {
+            switch (currentBar)
+            {
                 case "TabItemAnnotation":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_Annotation");
                     break;
@@ -2217,24 +2282,26 @@ namespace PDF_Master.ViewModels
                 case "TabItemEdit":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_EditPDF");
                     break;
+
                 case "TabItemPageEdit":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_PageEdit");
                     break;
+
                 case "TabItemConvert":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_Converter");
                     break;
+
                 case "TabItemTool":
                     DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_Tools");
                     break;
             }
-        
         }
 
-            /// <summary>
-            /// 进入页面编辑模式
-            /// </summary>
-            //工具栏添加功能应注意自处
-            public void EnterPageEdit()
+        /// <summary>
+        /// 进入页面编辑模式
+        /// </summary>
+        //工具栏添加功能应注意自处
+        public void EnterPageEdit()
         {
             if (TabSelectedIndex != 2)
             {
@@ -2602,6 +2669,7 @@ namespace PDF_Master.ViewModels
                 events.GetEvent<PageEditNotifyEvent>().Publish(new PageEditNotifyEventArgs(unicode));
             }
         }
+
         private void Redo()
         {
             PDFViewer.UndoManager.Redo();
@@ -2826,9 +2894,9 @@ namespace PDF_Master.ViewModels
                 //是否取消了水印保存步骤
                 bool flg = false;
                 //删掉Settings.Default.UserDate.isInFreeUseTime == false,没有试用期策略了
-                if ((!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1) && ((App.mainWindowViewModel.SelectedItem.DataContext as MainContentViewModel).IsUsedVIP == true||PDFViewer.UndoManager.PDFEditChanged==true))
+                if ((!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1) && ((App.mainWindowViewModel.SelectedItem.DataContext as MainContentViewModel).IsUsedVIP == true || PDFViewer.UndoManager.PDFEditChanged == true))
                 {
-                       DialogParameters value = new DialogParameters();
+                    DialogParameters value = new DialogParameters();
                     value.Add(ParameterNames.ViewContentViewModel, this);
                     if (autosave)
                     {
@@ -3189,7 +3257,7 @@ namespace PDF_Master.ViewModels
                             DoAfterSaveAs(dlg.FileName);
                         }
                         else
-                        {   //提示文件被其他软件占用 无法保存          
+                        {   //提示文件被其他软件占用 无法保存
                             AlertsMessage alertsMessage = new AlertsMessage();
                             alertsMessage.ShowDialog(App.MainPageLoader.GetString("Main_SaveFailed"), App.MainPageLoader.GetString("Main_TheFileOccupiedWarning"), App.ServiceLoader.GetString("Text_cancel"), App.ServiceLoader.GetString("Text_ok"));
                         }
@@ -3334,15 +3402,14 @@ namespace PDF_Master.ViewModels
         /// <summary>
         /// 转档、压缩、合并、分享前自动保存
         /// </summary>
-        public async Task<bool> SaveBeforeOption(bool NoIAP=false)
+        public async Task<bool> SaveBeforeOption(bool NoIAP = false)
         {
-            if(NoIAP == false)
+            if (NoIAP == false)
             {            //添加付费拦截锁
                 if (!ServiceHelper.IAPBeforeFunction())
                 {
                     return false;
                 }
-
             }
             bool result = true;
             //因配合权益弹窗弹出,暂时移除可保存条件判断
@@ -3391,7 +3458,7 @@ namespace PDF_Master.ViewModels
 
                 if (flg == false)
                 {
-                    return ;
+                    return;
                 }
             }
             var dlg = new SaveFileDialog();
@@ -3563,7 +3630,6 @@ namespace PDF_Master.ViewModels
 
         private void EnterSelectedBar(string currentBar)
         {
-
             NavigationParameters param = new NavigationParameters();
             param.Add(ParameterNames.PDFViewer, PDFViewer);
             param.Add(ParameterNames.ViewContentViewModel, this);
@@ -3596,6 +3662,7 @@ namespace PDF_Master.ViewModels
         {
             ServiceHelper.GetUser();
         }
+
         #endregion 方法
 
         #region Navigate

+ 6 - 3
PDF Office/Views/BOTA/AnnotationContent.xaml.cs

@@ -71,7 +71,7 @@ namespace PDF_Master.Views.BOTA
             else
             {
                 //需要时间加载完 listbox所有的控件模板
-                await Task.Delay(500);
+                await Task.Delay(200);
                 ExpandOneGroupHeader(obj);
             }
         }
@@ -90,10 +90,13 @@ namespace PDF_Master.Views.BOTA
                         {
                             if (group.Items.Contains(item))
                             {
-                                await Task.Delay(5);
                                 var scroller = GetScrollHost(AnnotationList);
                                 var stackpanel = CommonHelper.FindVisualChild<StackPanel>(scroller);
-                                if (stackpanel != null)
+                                if (stackpanel == null)
+                                {
+                                    await Task.Delay(1);
+                                }
+                                else
                                 {
                                     GroupItemExpanded(stackpanel, i);
                                 }

+ 11 - 11
PDF Office/Views/Dialog/ServiceDialog/UserOutCodeRegion.xaml

@@ -7,8 +7,8 @@
     xmlns:local="clr-namespace:PDF_Master.Views.Dialog.ServiceDialog"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
-    Width="310"
-    Height="368"
+    Width="440"
+    Height="486"
     prism:ViewModelLocator.AutoWireViewModel="True"
     mc:Ignorable="d">
     <Grid Background="White">
@@ -29,7 +29,7 @@
                 Fill="Black" />
         </Button>
         <Grid
-            Margin="0,40,0,0"
+            Margin="0,60,0,0"
             HorizontalAlignment="Center"
             VerticalAlignment="Top">
             <StackPanel>
@@ -48,8 +48,8 @@
                     FontStyle="Normal"
                     LineHeight="22"
                     Text="{Binding Text_vcode}" />
-                <WrapPanel Margin="0,8,0,0" HorizontalAlignment="Left">
-                    <Grid>
+                <WrapPanel Margin="0,18,0,0" HorizontalAlignment="Center">
+                    <Grid >
                         <TextBox
                             x:Name="text_Code1"
                             Width="36"
@@ -201,7 +201,7 @@
                     </Grid>
 
                 </WrapPanel>
-                <WrapPanel Margin="0,10,0,0">
+                <WrapPanel Margin="0,10,0,0" HorizontalAlignment="Center">
                     <TextBlock
                         Width="190"
                         Height="20"
@@ -236,9 +236,9 @@
                 </WrapPanel>
                 <Button
                     x:Name="Btn_RegisterNext"
-                    Width="200"
+                    Width="304"
                     Height="32"
-                    Margin="0,34,0,0"
+                    Margin="0,60,0,0"
                     HorizontalAlignment="Center"
                     VerticalAlignment="Top"
                     Command="{Binding UserOutCommand}"
@@ -247,9 +247,9 @@
                     IsEnabled="{Binding EnableNextStep, Mode=TwoWay}"
                       Style="{StaticResource Btn.cta}" />
                 <Button
-                    Width="200"
+                    Width="304"
                     Height="32"
-                    Margin="0,8,0,0"
+                    Margin="0,20,0,0"
                     HorizontalAlignment="Center"
                     VerticalAlignment="Top"
                     Content="{Binding BtText_cancel}"
@@ -266,7 +266,7 @@
 
         <Grid
             x:Name="Grid_UserCodemsgVis"
-            Width="310"
+            Width="440"
             Height="48"
             HorizontalAlignment="Center"
             VerticalAlignment="Bottom"