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


C# NSAutoreleasePool.Dispose方法代码示例

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


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

示例1: DispatchPendingEvents

 public override void DispatchPendingEvents()
 {
     var until = NSDate.DistantPast;
     var app = NSApplication.SharedApplication;
     var p = new NSAutoreleasePool ();
     while (true) {
         var ev = app.NextEvent (NSEventMask.AnyEvent, until, NSRunLoop.NSDefaultRunLoopMode, true);
         if (ev != null)
             app.SendEvent (ev);
         else
             break;
     }
     p.Dispose ();
 }
开发者ID:nite2006,项目名称:xwt,代码行数:14,代码来源:MacEngine.cs

示例2: FetchDocument

            public string FetchDocument(int page)
            {
                var p = page > 1 ? "&p=" + page : "";
                var uri = string.Format("http://www.dzone.com/links/index.html?type=html{0}", p);

                /* WebClient doesn't work because libc.dylib is not being linked properly by MonoMac
                 * Use Cocoa NSUrlRequest instead as a not-so-pretty-fix
                 *
                var web = new WebClient();
                web.Headers["User-Agent"] = "Mozilla/5.0 (Windows NT 5.1; U; rv:5.0) Gecko/20100101 Firefox/5.0";

                return web.DownloadString(uri);
                */

                var pool = new NSAutoreleasePool();

                NSError error = null;
                NSUrlResponse response = null;
                NSMutableUrlRequest request = new NSMutableUrlRequest(NSUrl.FromString(uri));
                var headerKeys = new NSObject[] {
                    (NSString)"Accept",
                    (NSString)"Accept-Charset",
                    (NSString)"Accept-Encoding",
                    (NSString)"Accept-Language",
                    (NSString)"Cache-Control",
                    (NSString)"Host",
                    (NSString)"User-Agent"
                };
                var headerVals = new NSObject[] {
                    (NSString)"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
                    (NSString)"ISO-8859-1,utf-8;q=0.7,*;q=0.3",
                    (NSString)"deflate",
                    (NSString)"en-US,en;q=0.8",
                    (NSString)"max-age=0",
                    (NSString)"www.dzone.com",
                    (NSString)"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.21 Safari/535.7"
                };
                request.Headers = NSDictionary.FromObjectsAndKeys(headerVals, headerKeys);
                var data = NSUrlConnection.SendSynchronousRequest(request, out response, out error);
                var html = (string)NSString.FromData(data, NSStringEncoding.UTF8);

                pool.Dispose();

                return html;
            }
开发者ID:seanho,项目名称:DZoneApp,代码行数:45,代码来源:DZoneProxy.cs


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