当前位置: 首页>>代码示例>>C#>>正文


C# Common.makeStreamReaderFromResult方法代码示例

本文整理汇总了C#中Common.makeStreamReaderFromResult方法的典型用法代码示例。如果您正苦于以下问题:C# Common.makeStreamReaderFromResult方法的具体用法?C# Common.makeStreamReaderFromResult怎么用?C# Common.makeStreamReaderFromResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Common的用法示例。


在下文中一共展示了Common.makeStreamReaderFromResult方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleNewsResult

        private void HandleNewsResult(IAsyncResult result)
        {
            try
            {
                var common = new Common();
                var binding = (result.AsyncState as AsyncState).binding as News;

                News rv; //Our return value.

                /*
                 *  StreamReaders implement the IDisposable interface, so the best practice is to
                 *  wrap them in using statements so the object's is disposed once the scope passes.
                 *  
                 *  Only classes with expensive resources (data connections, large buffers, network handles, etc...) implement
                 *  IDisposable - in this case StreamReader just uses a buffer and it's probably not that large in this case,
                 *  but it's still a good practice. -Aaron
                 */
                using (var txt = common.makeStreamReaderFromResult(result))
                {
                    rv = common.deserializeStreamReader<News>(txt);
                }


                this.Dispatcher.BeginInvoke(
                () =>
                {
                    binding.nextId = rv.nextId;
                    binding.version = rv.version;
                    binding.items = rv.items;
                    // FIXME: Shouldn't I be able to do this instead?
                    //binding = processJsonString(txt);
                    SetProgressBar(false);
                }
                );
            }
            catch (WebException e)
            {
                this.Dispatcher.BeginInvoke(
                    () =>
                    {
                        //errorLine.Text = e.Message;
                        //errorLine.Visibility = Visibility.Visible;
                        SetProgressBar(false);
                    }
                );
            }
        }
开发者ID:Aaronontheweb,项目名称:hacker-news-wp7,代码行数:47,代码来源:MainPage.xaml.cs

示例2: HandleCommentResult

        private void HandleCommentResult(IAsyncResult result)
        {
            try
            {
                Common common = new Common();
                var binding = (result.AsyncState as AsyncState).binding as FlatComments;
                StreamReader txt = common.makeStreamReaderFromResult(result);

                Comments comments = common.deserializeStreamReader<Comments>(txt);
                this.Dispatcher.BeginInvoke(
                    () =>
                    {
                        textTextBlock.Text = stripHtml(comments.text);
                        binding.comments = flattenComments(comments.comments);
                        setProgressBar(false);
                    }
                );
            }
            catch (WebException e)
            {
                this.Dispatcher.BeginInvoke(
                    () =>
                    {
                        setProgressBar(false);
                    }
                );
            }
        }
开发者ID:jpf,项目名称:hacker-news-wp7,代码行数:28,代码来源:Post.xaml.cs

示例3: HandleNewsResult

        private void HandleNewsResult(IAsyncResult result)
        {
            try
            {
                Common common = new Common();
                var binding = (result.AsyncState as AsyncState).binding as News;
                StreamReader txt = common.makeStreamReaderFromResult(result);

                News rv = common.deserializeStreamReader<News>(txt);
                this.Dispatcher.BeginInvoke(
                () =>
                {
                    binding.nextId = rv.nextId;
                    binding.version = rv.version;
                    binding.items = rv.items;
                    // FIXME: Shouldn't I be able to do this instead?
                    //binding = processJsonString(txt);
                    setProgressBar(false);
                }
                );
            }
            catch (WebException e)
            {
                this.Dispatcher.BeginInvoke(
                    () =>
                    {
                        //errorLine.Text = e.Message;
                        //errorLine.Visibility = Visibility.Visible;
                        setProgressBar(false);
                    }
                );
            }
        }
开发者ID:jpf,项目名称:hacker-news-wp7,代码行数:33,代码来源:MainPage.xaml.cs


注:本文中的Common.makeStreamReaderFromResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。