|
@@ -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("软件启动信息上传成功");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|