コード例 #1
0
 public static LogResponse LogLocalError(SDError e)
 {
     try
     {
         return(ErrorLogger.LogError(e));
     }
     catch (Exception ex)
     {
         return(new LogResponse {
             LogMessage = ex.Message
         });
     }
 }
コード例 #2
0
        private async void 更新_Click(object sender, RoutedEventArgs e)
        {
            SDError.ClearValue(TextBlock.TextProperty);
            if (string.IsNullOrEmpty(设定1.Text))
            {
                设定1.Text = "0";
            }
            if (string.IsNullOrEmpty(设定2.Text))
            {
                设定2.Text = "0";
            }

            try
            {
                int sd1 = Convert.ToInt16(设定1.Text);
                int sd2 = Convert.ToInt16(设定2.Text);

                var aaa = from bbb in qxCount where sd1 == bbb select bbb;
                if (aaa.ToList().Count == 0)
                {
                    SDError.Text += "设定的阅读权限值不正确";
                    return;
                }
                if (sd2 < 0 || sd2 > 4)
                {
                    SDError.Text += "单个附件最多只能售价4PB";
                    return;
                }

                var abcde = (SCFJList.SelectedItem as ThrFiles).FilesID;
                var sent1 = string.Format(@"document.getElementsByName('attachnew[{0}][readperm]')[0].value='{1}';", abcde, 设定1.Text);
                await MainPage.CurrentPage.WebView1.InvokeScriptAsync("eval", new string[] { sent1 });

                var sent2 = string.Format(@"document.getElementsByName('attachnew[{0}][price]')[0].value='{1}';", abcde, 设定2.Text);
                await MainPage.CurrentPage.WebView1.InvokeScriptAsync("eval", new string[] { sent2 });
            }
            catch (Exception)
            {
            }

            SCFJList.Items.Clear();

            string getCount = string.Format(@"document.querySelectorAll('#attachlist tbody').length.toString();");
            string result   = await MainPage.CurrentPage.WebView1.InvokeScriptAsync("eval", new string[] { getCount });

            int count = Convert.ToInt32(result);

            for (int i = 0; i < count; i++)
            {
                var    getAttID = string.Format(@"document.querySelectorAll('#attachlist tbody')[{0}].id.replace('attach_','');", i);
                string attID    = await MainPage.CurrentPage.WebView1.InvokeScriptAsync("eval", new string[] { getAttID });

                var    getAttTitle = string.Format(@"document.querySelector('#attachname{0}').innerText", attID);
                string FJTitle     = await MainPage.CurrentPage.WebView1.InvokeScriptAsync("eval", new string[] { getAttTitle });

                var    getReadAcc = string.Format(@"document.querySelectorAll('#attachlist tbody #readperm')[{0}].value;", i);
                string FJRead     = "权限:" + await MainPage.CurrentPage.WebView1.InvokeScriptAsync("eval", new string[] { getReadAcc });

                if (FJRead == "权限:")
                {
                    FJRead += "0";
                }

                var    getPrice = string.Format(@"document.querySelectorAll('#attachlist tbody .attpr .px')[{0}].value;", i);
                string FJPrice  = "售价:" + await MainPage.CurrentPage.WebView1.InvokeScriptAsync("eval", new string[] { getPrice });

                if (FJPrice == "售价:")
                {
                    FJPrice += "0";
                }

                string FJIns    = "[attach]" + attID + "[/attach]";
                string FJRemove = "delAttach(" + attID + ")";

                SCFJList.Items.Add(new ThrFiles {
                    FileName = FJTitle, ViewLVL = FJRead, Price = FJPrice, Insert = FJIns, Delete = FJRemove, FilesID = attID
                });
            }

            UploadFileCount.Text = "已成功更新";
        }