Exemplo n.º 1
0
        static void test()
        {
            MustagramClient client = MustagramClient.GetClient();
            // RunAsync().GetAwaiter().GetResult();
            Func <Task> runAsync = async() =>
            {
                try
                {
                    if (await client.SendLoginInfo("유동관", "1111"))
                    {
                        System.Console.WriteLine("true");
                    }
                    else
                    {
                        System.Console.WriteLine("false");
                    }

                    String result = await client.GetPersonalDescription("유동관");

                    int like = await client.GetPostLike(1);

                    System.Console.WriteLine(result);
                    System.Console.WriteLine(like);

                    if (await client.CreatePost("lsc", "init"))
                    {
                        System.Console.WriteLine("성공");
                    }
                    else
                    {
                        System.Console.WriteLine("실패");
                    }

                    // PostList postList = ;
                }
                catch (Exception e)
                {
                    System.Console.WriteLine(e.Message);
                }
            };

            runAsync().GetAwaiter().GetResult();
        }
Exemplo n.º 2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            bool result = false;

            Func <Task> runAsyn = async() =>
            {
                try
                {
                    if (await client.SendLoginInfo(txtId.Text.ToString(), txtPassword.Text.ToString()).ConfigureAwait(false))
                    {
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
                catch (Exception q)
                {
                    Console.WriteLine(q.Message);
                }
            };

            if (txtId.Text != "" && txtPassword.Text != "" && txtId.Text != "아이디" && txtPassword.Text != "비밀번호")
            {
                runAsyn().GetAwaiter().GetResult();
                if (result)
                {
                    setuser.setUser_id(txtId.Text.ToString());
                    ma = new MainDisplay();
                    ma.Show();
                    //if (ma.IsDisposed) // 컨트롤이 죽었으면
                    //   {

                    //   ma = new MainDisplay(); // 다시 인스턴스생성하고 열어줍니다
                    //  ma.Show();


                    //  }
                    //  else
                    //  {
                    //    ma.Show();

                    //  }
                    // if (ma.IsDisposed) // 컨트롤이 죽었으면
                    //   {
                    //   ma = new MainDisplay(); // 다시 인스턴스생성하고 열어줍니다
                    //  ma.Show();
                    //  }
                }
                else
                {
                    MessageBox.Show("로그인 오류!");
                }

                txtId.Text               = "아이디";
                txtId.ForeColor          = Color.Gray;
                txtPassword.PasswordChar = '\0';
                txtPassword.Text         = "비밀번호";
                txtPassword.ForeColor    = Color.Gray;
            }
            else
            {
                MessageBox.Show("ID, Password Input");
            }
        }