Ejemplo n.º 1
0
        public void FetchNews_async()
        {
            var ctx = new CIAPI.Rpc.Client(RPC_URI);
            var gate = new AutoResetEvent(false);
            ctx.BeginLogIn(USERNAME, PASSWORD, a =>
            {
                ctx.EndLogIn(a);

                ctx.News.BeginListNewsHeadlinesWithSource("dj", "UK", 10, newsResult =>
                {

                    ListNewsHeadlinesResponseDTO news = ctx.News.EndListNewsHeadlinesWithSource(newsResult);

                    //do something with the news

                    ctx.BeginLogOut(result=>
                        {
                            gate.Set();
                        
                        }, null);
                }, null);
            }, null);

            gate.WaitOne();
        }
Ejemplo n.º 2
0
 private void LogOutButtonClick(object sender, EventArgs e)
 {
     DisableUi();
     _ctx.BeginLogOut(result =>
     {
         try
         {
             _ctx.EndLogOut(result);
             Invoke(() =>
             {
                 MainTabControl.Enabled = false;
                 LogOutButton.Enabled   = false;
                 LoginButton.Enabled    = true;
                 Application.DoEvents();
             });
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
         finally
         {
             Cursor = Cursors.Default;
         }
     }, null);
 }
Ejemplo n.º 3
0
        public void FetchNews_async()
        {
            var ctx  = new CIAPI.Rpc.Client(RPC_URI, STREAMING_URI, AppKey);
            var gate = new AutoResetEvent(false);

            ctx.BeginLogIn(USERNAME, PASSWORD, a =>
            {
                ctx.EndLogIn(a);

                ctx.News.BeginListNewsHeadlinesWithSource("dj", "UK", 10, newsResult =>
                {
                    ListNewsHeadlinesResponseDTO news = ctx.News.EndListNewsHeadlinesWithSource(newsResult);

                    //do something with the news

                    ctx.BeginLogOut(result =>
                    {
                        gate.Set();
                    }, null);
                }, null);
            }, null);

            gate.WaitOne();
        }
Ejemplo n.º 4
0
 static void BeginLogOut()
 {
     _ctx.BeginLogOut(EndLoggedOut, null);
 }