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


C# Foundation.Foundation类代码示例

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


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

示例1: startStopPing

partial         void startStopPing(Foundation.NSObject sender)
        {
            if (task != null) {
                task.Interrupt();
            }
            else {
                task = new NSTask();
                task.LaunchPath = "/sbin/ping";
                string[] args = {"-c10", hostField.StringValue};

                task.Arguments = args;

                // Create a new pipe
                pipe = new NSPipe();
                task.StandardOutput = pipe;

                NSFileHandle fh = pipe.ReadHandle;

                NSNotificationCenter nc = NSNotificationCenter.DefaultCenter;
                nc.RemoveObserver(this);
                nc.AddObserver(this, new Selector("dataReady:"), NSFileHandle.ReadCompletionNotification, fh);
                nc.AddObserver(this, new Selector("taskTerminated:"), NSTask.NSTaskDidTerminateNotification, task);
                task.Launch();
                outputView.Value = "";

                // Suspect = Obj-C example is [fh readInBackgroundAndNotify] - no arguments
                fh.ReadInBackground();
            }
        }
开发者ID:yingfangdu,项目名称:BNR,代码行数:29,代码来源:MainWindowController.cs

示例2: moveFile

partial         void moveFile(Foundation.NSObject sender)
        {
            if (textFieldFrom.StringValue == "" || textFieldTo.StringValue == "") {
                textFieldResults.StringValue = "Must set 'from' and 'to' paths";
                return;
            }

            // Prepare a task object
            NSTask task = new NSTask();
            task.LaunchPath = "/bin/mv";
            string[] args = {textFieldFrom.StringValue, textFieldTo.StringValue};
            task.Arguments = args;

            // Create a pipe to read from
            NSPipe outPipe = new NSPipe();
            task.StandardOutput = outPipe;

            // Start the process
            task.Launch();

            // Read the output
            NSData data = outPipe.ReadHandle.ReadDataToEndOfFile();

            // Make sure the task terminates normally
            task.WaitUntilExit();
            int status = task.TerminationStatus;

            // Check status
            if (status != 0) {
                textFieldResults.StringValue = "Move Failed: " + status;
                return;
            }

            textFieldResults.StringValue = String.Format("{0} moved to {1}", textFieldFrom.StringValue, textFieldTo.StringValue);
        }
开发者ID:yingfangdu,项目名称:BNR,代码行数:35,代码来源:MainWindowController.cs

示例3: RowSelected

		public override void RowSelected (UITableView tableView, Foundation.NSIndexPath indexPath)
		{
			var session = sessions[indexPath.Row];
			ConsoleD.WriteLine("SessionsTableSource.RowSelected");			
			view.SelectSession(session);
			if (AppDelegate.IsPhone) tableView.DeselectRow (indexPath, true);
		}
开发者ID:topcbl,项目名称:mobile-samples,代码行数:7,代码来源:SessionsTableSource.cs

示例4: PreviousCat

		partial void PreviousCat (Foundation.NSObject sender) {
			// Display previous cat
			if (--PageNumber < 0) {
				PageNumber = 0;
			}
			ShowCat();
		}
开发者ID:BytesGuy,项目名称:monotouch-samples,代码行数:7,代码来源:ViewController.cs

示例5: GetCell

		public override UITableViewCell GetCell (UITableView tableView, Foundation.NSIndexPath indexPath)
		{
			var changeLoginGroup = GroupedData [indexPath.Section];
			var changeLoginEntry = changeLoginGroup.ElementAt (indexPath.Row);

			var cell = (TSDepartmentCell)tableView.DequeueReusableCell (CellId);

			if (cell == null) {
				cell = new TSDepartmentCell (CellId, fontSize);
			}

			if (UIDevice.CurrentDevice.CheckSystemVersion (8, 0)) {
				cell.LayoutMargins = UIEdgeInsets.Zero;
				cell.PreservesSuperviewLayoutMargins = false;
			}

			cell.CellText.Text = changeLoginEntry.EntryData.Title;
			cell.DetailText.Text = changeLoginEntry.EntryData.Detail;
			if (changeLoginEntry.EntryData.Count != null) {
				cell.Count.Alpha = 1;
				cell.Count.Text = changeLoginEntry.EntryData.Count;
			}
			if (changeLoginEntry.EntryData.IsChecked)
				cell.imgCheckmark.Alpha = 1;
				
			cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;

			return cell;
		}
开发者ID:kumaralg2,项目名称:Jan28-TS,代码行数:29,代码来源:TSDepartmentSource.cs

示例6: GetCell

        public override UICollectionViewCell GetCell(UICollectionView collectionView, Foundation.NSIndexPath indexPath)
        {
            var cell = (ListingImageCell)collectionView.DequeueReusableCell(CellID, indexPath);
            cell.Image = urls[indexPath.Row];

            return cell;
        }
开发者ID:erdennis13,项目名称:EthansList,代码行数:7,代码来源:ImageCollectionViewSource.cs

示例7: ShowAboutPanel

        public void ShowAboutPanel(Foundation.NSObject sender)
        {
            // The strict chap 12 challenge solution. non-modal, no window controller for the about panel
            // so multiple about panels can be displayed
            //			NSBundle.LoadNib("About", this);
            //			aboutPanel.MakeKeyAndOrderFront(null);

            // Make about panel modal and position it in the center of the active window
            NSBundle.LoadNib("About", this);
            // Change BG color and posiiton
            aboutPanel.BackgroundColor = NSColor.White;
            if (NSApplication.SharedApplication.MainWindow != null) {
                var mainWindowFrame = NSApplication.SharedApplication.MainWindow.Frame;
                nfloat x = mainWindowFrame.X + mainWindowFrame.Width/2 - aboutPanel.Frame.Width/2;
                nfloat y = mainWindowFrame.Y + mainWindowFrame.Height/2 - aboutPanel.Frame.Height/2;
                aboutPanel.SetFrame(new CGRect(x, y, aboutPanel.Frame.Width, aboutPanel.Frame.Height), true);
            }
            else {
                NSScreen screen = NSScreen.MainScreen;
                aboutPanel.SetFrame(new CGRect(screen.Frame.Width/2-aboutPanel.Frame.Width/2, screen.Frame.Height - aboutPanel.Frame.Height - 100, aboutPanel.Frame.Width, aboutPanel.Frame.Height), true);
            }
            // Stop modal when about panel closed.
            aboutPanel.WillClose += (object s, EventArgs e) =>  {
                Console.WriteLine("Window will close");
                NSApplication.SharedApplication.StopModal();
            };
            // Show modal about panel
            NSApplication.SharedApplication.RunModalForWindow(aboutPanel);
        }
开发者ID:yingfangdu,项目名称:BNR,代码行数:29,代码来源:AppController.cs

示例8: OnConnect

		partial void OnConnect (Foundation.NSObject sender)
		{
			ActionHelper.Execute(delegate() {
					
				if (ConnectPopupButton.SelectedItem.Title != "New Server")
				{	
					var server = ConnectPopupButton.SelectedItem.Title;
					var tokens = SnapInContext.Instance.AuthTokenManager.GetAllAuthTokens ();
					var serverDto = tokens.Where(x=>x.ServerDto != null && x.ServerDto.ServerName == server).Select(x=>x.ServerDto).FirstOrDefault();
					if (!WebUtil.PingHost (serverDto.ServerName)) {
						UIErrorHelper.ShowAlert ("Server name or ip address no longer exists or not reachable", "Alert");
						return;
					}
					else
					{
						var mainWindowController = new MainWindowController (serverDto);
						mainWindowController.Window.MakeKeyAndOrderFront (null);
					}
				}
				else
				{
					//var controller = new AddNewServerController ();
					var mainWindowController = new MainWindowController ();
					mainWindowController.Window.MakeKeyAndOrderFront (null);
				}
				this.Window.IsVisible = false;
				//this.Close ();
			});
		}
开发者ID:saberlilydian,项目名称:lightwave,代码行数:29,代码来源:WelcomeController.cs

示例9: TouchesBegan

        //
        public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesBegan (touches, evt);
            UITouch touch1 = evt.AllTouches.AnyObject as UITouch;
            CGPoint point = touch1.LocationInView (View);

            if (point.X > lbl1.Frame.X && point.X < lbl1.Frame.X + lbl1.Frame.Size.Width && point.Y > lbl1.Frame.Y && point.Y < lbl1.Frame.Y + lbl1.Frame.Size.Height) {

                myLab = lbl1;
            }
            if (point.X > lbl2.Frame.X && point.X < lbl2.Frame.X + lbl2.Frame.Size.Width && point.Y > lbl2.Frame.Y && point.Y < lbl2.Frame.Y + lbl2.Frame.Size.Height) {

                myLab = lbl2;
            }
            if (point.X > lbl3.Frame.X && point.X < lbl3.Frame.X + lbl3.Frame.Size.Width && point.Y > lbl3.Frame.Y && point.Y < lbl3.Frame.Y + lbl3.Frame.Size.Height) {

                myLab = lbl3;
            }
            if (point.X > lbl4.Frame.X && point.X < lbl4.Frame.X + lbl4.Frame.Size.Width && point.Y > lbl4.Frame.Y && point.Y < lbl4.Frame.Y + lbl4.Frame.Size.Height) {

                myLab = lbl4;
            }
            if (point.X > lbl5.Frame.X && point.X < lbl5.Frame.X + lbl5.Frame.Size.Width && point.Y > lbl5.Frame.Y && point.Y < lbl5.Frame.Y + lbl5.Frame.Size.Height) {

                myLab = lbl5;
            }
        }
开发者ID:ctsxamarintraining,项目名称:cts458701,代码行数:28,代码来源:ViewController.cs

示例10: Main

 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Foundation game = new Foundation())
     {
         game.Run();
     }
 }
开发者ID:sdomenici009,项目名称:XNA,代码行数:10,代码来源:Program.cs

示例11: RowSelected

		public override void RowSelected (UITableView tableView, Foundation.NSIndexPath indexPath)
		{
			tableView.DeselectRow (indexPath, true);
			var changeLoginGroup = GroupedData [indexPath.Section];
			var changeLoginEntry = changeLoginGroup.ElementAt (indexPath.Row);
			if (changeLoginEntry.OnClickAction != null) {
                if (!CrossConnectivity.Current.IsConnected)
                {
                    DialogUtil.ShowAlert("Network Unavailable", "This application requires internet access to function. Please check your connection and try again.", "OK");
                    return;
                }
                else
                {
                    if (changeLoginEntry.OnClickAction.Equals("PushChangePin"))
                    {
                        controller.NavigationController.PushViewController(new RSChangePinViewController(), true);
                    }
                    else if (changeLoginEntry.OnClickAction.Equals("PushChangePassword"))
                    {
                        controller.NavigationController.PushViewController(new RSChangePasswordViewController(), true);
                    }
                    else if (changeLoginEntry.OnClickAction.Equals("PushChangeUserID"))
                    {
                  
                        controller.NavigationController.PushViewController(new RSChangeUserIdViewController(), true);
                    }
                }
			}
		}
开发者ID:KiranKumarAlugonda,项目名称:TXTSHD,代码行数:29,代码来源:ChangeLoginTableViewSource.cs

示例12: GetCell

        public override UITableViewCell GetCell(UITableView tableView, Foundation.NSIndexPath indexPath)
        {
            var tableCell = tableView.DequeueReusableCell (cellId);

            if (tableCell == null) {
                tableCell = new UITableViewCell (
                    UITableViewCellStyle.Subtitle,
                    cellId
                );
                tableCell.SelectionStyle = UITableViewCellSelectionStyle.Blue;
                if (tableCell.TextLabel != null) {
                    tableCell.TextLabel.TextColor = UIColor.White;
                }
                tableCell.BackgroundColor = UIColor.FromRGB (9, 34, 65);

                var backgroundView = new UIView ();
                backgroundView.BackgroundColor = UIColor.FromRGB (88, 181, 222);
                tableCell.SelectedBackgroundView = backgroundView;

                tableCell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
                tableCell.TintColor = UIColor.White;
            }

            var entry = Entries [indexPath.Row];
            tableCell.TextLabel.Text = entry;

            return tableCell;
        }
开发者ID:seansparkman,项目名称:InfiniteScroll,代码行数:28,代码来源:InfiniteViewSource.cs

示例13: GetCell

		/// <summary>
		/// Called by the TableView to get the actual UITableViewCell to render for the particular section and row
		/// </summary>
		public override UITableViewCell GetCell (UITableView tableView, Foundation.NSIndexPath indexPath)
		{
			// declare vars
			UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier);
			TableItem item = tableItems[indexPath.Section].Items[indexPath.Row];
			
			// if there are no cells to reuse, create a new one
			if (cell == null)
				cell = new UITableViewCell (item.CellStyle, cellIdentifier);
			
			// set the item text
			cell.TextLabel.Text = tableItems[indexPath.Section].Items[indexPath.Row].Heading;
			
			// if it's a cell style that supports a subheading, set it
			if(item.CellStyle == UITableViewCellStyle.Subtitle 
			   || item.CellStyle == UITableViewCellStyle.Value1
			   || item.CellStyle == UITableViewCellStyle.Value2)
			{ cell.DetailTextLabel.Text = item.SubHeading; }
			
			// if the item has a valid image, and it's not the contact style (doesn't support images)
			if(!string.IsNullOrEmpty(item.ImageName) && item.CellStyle != UITableViewCellStyle.Value2)
			{
				if(File.Exists(item.ImageName))
					cell.ImageView.Image = UIImage.FromBundle(item.ImageName);
			}
			
			// set the accessory
			cell.Accessory = item.CellAccessory;
			
			return cell;
		}
开发者ID:ARMoir,项目名称:mobile-samples,代码行数:34,代码来源:TableSource.cs

示例14: GetCell

        public override UITableViewCell GetCell(UITableView tableView, Foundation.NSIndexPath indexPath)
        {
            var cell = (FeedResultsCell)tableView.DequeueReusableCell(FeedResultsCell.Key);

            if (cell == null)
            {
                cell = new FeedResultsCell();
            }

            cell.BackgroundColor = ColorScheme.Clouds;
            Posting post = savedListings[indexPath.Row];

            cell.PostingTitle.AttributedText = new NSAttributedString(post.PostTitle, Constants.HeaderAttributes);
            cell.PostingDescription.AttributedText = new NSAttributedString(post.Description, Constants.FeedDescriptionAttributes);
            if (post.ImageLink != "-1")
            {
                cell.PostingImage.SetImage(
                    url: new NSUrl(post.ImageLink),
                    placeholder: UIImage.FromBundle("placeholder.png")
                );
            }
            else
            {
                cell.PostingImage.Image = UIImage.FromBundle("placeholder.png");
            }

            return cell;
        }
开发者ID:erdennis13,项目名称:EthansList,代码行数:28,代码来源:SavedPostingsTableViewSource.cs

示例15: PlayerCountChanged

		partial void PlayerCountChanged (Foundation.NSObject sender) {

			// Take Action based on the segment
			switch(PlayerCount.SelectedSegment) {
			case 0:
				Player1.Hidden = false;
				Player2.Hidden = true;
				Player3.Hidden = true;
				Player4.Hidden = true;
				break;
			case 1:
				Player1.Hidden = false;
				Player2.Hidden = false;
				Player3.Hidden = true;
				Player4.Hidden = true;
				break;
			case 2:
				Player1.Hidden = false;
				Player2.Hidden = false;
				Player3.Hidden = false;
				Player4.Hidden = true;
				break;
			case 3:
				Player1.Hidden = false;
				Player2.Hidden = false;
				Player3.Hidden = false;
				Player4.Hidden = false;
				break;
			}
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:30,代码来源:ViewController.cs


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