[#] 包裹一些错误不再向外抛出

This commit is contained in:
huiyadanli 2019-10-06 19:13:00 +08:00
parent bb9a82a657
commit 62248f12e6
2 changed files with 24 additions and 16 deletions

View File

@ -259,7 +259,7 @@ namespace RevokeMsgPatcher
private void radioButtons_CheckedChanged(object sender, EventArgs e)
{
ga.RequestPageView(GetCheckedRadioButtonNameEn() + "_switch");
ga.RequestPageView(GetCheckedRadioButtonNameEn() + "/switch", "切换标签页");
EnableAllButton(false);
RadioButton radioButton = sender as RadioButton;
// 切换使用不同的防撤回对象

View File

@ -39,24 +39,32 @@ namespace RevokeMsgPatcher.Utils
public async Task RequestPageViewAsync(string page, string title = null)
{
if (!page.StartsWith("/"))
try
{
page = "/" + page;
if (!page.StartsWith("/"))
{
page = "/" + page;
}
// 请求参数
var values = new Dictionary<string, string>
{
{ "v", "1" }, // 当前必填1
{ "tid", tid },
{ "cid", cid },
{ "ua", UserAgent },
{ "t", "pageview" },
{ "sr", sr },
{ "dp", page },
{ "dt", title },
};
var content = new FormUrlEncodedContent(values);
var response = await client.PostAsync(GAUrl, content);
}
// 请求参数
var values = new Dictionary<string, string>
catch (Exception ex)
{
{ "v", "1" }, // 当前必填1
{ "tid", tid },
{ "cid", cid },
{ "ua", UserAgent },
{ "t", "pageview" },
{ "sr", sr },
{ "dp", page },
{ "dt", title },
};
var content = new FormUrlEncodedContent(values);
var response = await client.PostAsync(GAUrl, content);
Console.WriteLine("GAHelper:" + ex.Message);
}
}
public void RequestPageView(string page, string title = null)