當前位置: 首頁>>代碼示例>>C#>>正文


C# DialogViewController.SetToolbarItems方法代碼示例

本文整理匯總了C#中MonoTouch.Dialog.DialogViewController.SetToolbarItems方法的典型用法代碼示例。如果您正苦於以下問題:C# DialogViewController.SetToolbarItems方法的具體用法?C# DialogViewController.SetToolbarItems怎麽用?C# DialogViewController.SetToolbarItems使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MonoTouch.Dialog.DialogViewController的用法示例。


在下文中一共展示了DialogViewController.SetToolbarItems方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: FinishedLaunching


//.........這裏部分代碼省略.........
			_downloader.Progress += (progress) => {
				float percent = (progress.Written / (float)progress.Total) * 100;
				int ipercent = (int)percent;
				string caption = string.Format("{0} {1} {2}% ({3} / {4})", 
					"Global", 
					progress.State.ToString(),
					ipercent,
					progress.Written,
					progress.Total
				);
				InvokeOnMainThread(() => {
					globalprogress.Caption = caption;
					globalprogress
						.GetImmediateRootElement()
						.Reload(globalprogress, UITableViewRowAnimation.Automatic);
				});
			};
			
			_sample = new DialogViewController (root);

			var add = new UIBarButtonItem ("Add", 
				UIBarButtonItemStyle.Bordered, 
				 (sender, e) => {
					string url = string.Format(templateurl, 1);
				 Add(url);
			});
			
			var addall = new UIBarButtonItem ("All", 
				UIBarButtonItemStyle.Bordered, 
				 (sender, e) => {
					for(int i=1; i<80; i++) {
						string url = string.Format(templateurl, i);
					 Add(url);
					}
				});
			
			var zips = new UIBarButtonItem ("Z", 
				UIBarButtonItemStyle.Bordered, 
				 (sender, e) => {
					foreach(string coll in collections) {
						string url = string.Format(zipurl, coll);
					 Add(url);
					}
				});


			var s404 = new UIBarButtonItem ("4", 
				UIBarButtonItemStyle.Bordered, 
				 (sender, e) => {
					string url = string.Format(httpurl, 404);
					 Add(url);
				});

			var s500 = new UIBarButtonItem ("5", 
				UIBarButtonItemStyle.Bordered, 
				 (sender, e) => {
					string url = string.Format(httpurl, 500);
					 Add(url);
				});

			var s301 = new UIBarButtonItem ("3", 
				UIBarButtonItemStyle.Bordered, 
				 (sender, e) => {
					string url = string.Format(httpurl, 301);
					 Add(url);
				});


			var s301p = new UIBarButtonItem ("3+", 
				UIBarButtonItemStyle.Bordered, 
				 (sender, e) => {
					string url = string.Format(redirecturl, 301);
					 Add(url);
				});

			var reset = new UIBarButtonItem ("Reset", 
				UIBarButtonItemStyle.Bordered, 
				async (sender, e) => {
					await _downloader.Reset();
					Sync();
				});

			var sync = new UIBarButtonItem ("S", 
				UIBarButtonItemStyle.Bordered, 
				(sender, e) => {
					Sync();
				});


			Navigation = new UINavigationController ();
			Window.RootViewController = Navigation;
			Window.MakeKeyAndVisible ();

			Navigation.PushViewController (_sample, false);

			_sample.SetToolbarItems (new [] { add, addall, zips, s404, s500, s301, s301p, reset, sync}, true);
			Navigation.SetToolbarHidden (false, true);

			return true;
		}
開發者ID:lduchosal,項目名稱:DownloadManager.Xamarin,代碼行數:101,代碼來源:AppDelegate.cs


注:本文中的MonoTouch.Dialog.DialogViewController.SetToolbarItems方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。