コード例 #1
0
 public PostResult(TResult result = default, PostError error = default)
     : base(error)
 {
     Result = result;
 }
コード例 #2
0
        private void Postchecker_DoWork(object sender, DoWorkEventArgs e)
        {
            // change any link to a mobile link
            string url = Post.Text;
            string reg = @"facebook.+";
            Regex  re  = new Regex(reg);
            var    res = re.Match(url);

            url = "https://m." + res.Value;
            // store the new link in the textbox to use as public variable
            Post.Invoke((MethodInvoker) delegate
            {
                Post.Text = url;
            });
            driver.Navigate().GoToUrl(Post.Text);
            try
            {
                //comment place
                var na = driver.FindElement(By.TagName("input"));
                // enable the next options
                if (na != null)
                {
                    PostError.Invoke((MethodInvoker) delegate
                    {
                        PostError.Visible = false;
                    });
                    Post.Invoke((MethodInvoker) delegate
                    {
                        Post.Enabled = false;
                    });
                    TestPost.Invoke((MethodInvoker) delegate
                    {
                        TestPost.Enabled = false;
                    });
                    Comments.Invoke((MethodInvoker) delegate
                    {
                        Comments.Enabled = true;
                    });
                    RandomTime.Invoke((MethodInvoker) delegate
                    {
                        RandomTime.Enabled = true;
                    });
                    Generate.Invoke((MethodInvoker) delegate
                    {
                        Generate.Enabled = true;
                    });
                    NoComments.Invoke((MethodInvoker) delegate
                    {
                        NoComments.Enabled = true;
                    });
                }
                else
                {
                    PostError.Invoke((MethodInvoker) delegate
                    {
                        PostError.Visible = true;
                    });
                }
            }
            catch (Exception ex)
            {
                PostError.Invoke((MethodInvoker) delegate
                {
                    PostError.Visible = true;
                    PostError.Text    = ex.Message;
                });
            }
        }
コード例 #3
0
 protected IActionResult AlgoError(PostError error, int statusCode) => HandleResult(new PostResult {
     Error = error
 }, statusCode);
コード例 #4
0
 public PostException(PostError error) : base(error.ToString())
 {
 }