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


C# AppKit.NSButton類代碼示例

本文整理匯總了C#中MonoMac.AppKit.NSButton的典型用法代碼示例。如果您正苦於以下問題:C# NSButton類的具體用法?C# NSButton怎麽用?C# NSButton使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


NSButton類屬於MonoMac.AppKit命名空間,在下文中一共展示了NSButton類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ViewDidLoad

		public override void ViewDidLoad ()
		{
			View = new NSView (new RectangleF (0, 0, 320, 400));
			base.ViewDidLoad ();

			var textEditFirst = new NSTextField(new System.Drawing.RectangleF(0,0,320,40));
			View.AddSubview (textEditFirst);
			var textEditSecond = new NSTextField(new System.Drawing.RectangleF(0,50,320,40));
			View.AddSubview(textEditSecond);
			var slider = new NSSlider(new System.Drawing.RectangleF(0,150,320,40));
			slider.MinValue = 0;
			slider.MaxValue = 100;
			slider.IntValue = 23;
			View.AddSubview(slider);
			var labelFull = new NSTextField(new System.Drawing.RectangleF(0,100,320,40));
			labelFull.Editable = false;
			labelFull.Bordered = false;
			labelFull.AllowsEditingTextAttributes = false;
			labelFull.DrawsBackground = false;
			View.AddSubview (labelFull);
			var sw = new NSButton(new RectangleF(0,200,320,40));
			sw.SetButtonType (NSButtonType.Switch);
			View.AddSubview (sw);
			//sw.AddObserver()

			var set = this.CreateBindingSet<SecondViewController, SecondViewModel> ();
			set.Bind (textEditFirst).For(v => v.StringValue).To (vm => vm.FirstName);
			set.Bind (textEditSecond).For(v => v.StringValue).To (vm => vm.LastName);
			set.Bind (labelFull).Described("SliderValue + ' ' + OnOffValue").For("StringValue");	
			set.Bind (slider).For("IntValue").To (vm => vm.SliderValue);
			set.Bind (sw).For(c => c.State).To (vm => vm.OnOffValue);


			set.Apply ();
		}
開發者ID:Dexyon,項目名稱:MvvmCross-Samples,代碼行數:35,代碼來源:FirstViewController.cs

示例2: useNumbersPressed

partial         void useNumbersPressed(NSButton sender)
        {
            if( sender.IntValue == 0 )
                useNumbers = false;
            else
                useNumbers = true;
        }
開發者ID:mkoby,項目名稱:PasswordGenerator,代碼行數:7,代碼來源:MainWindowController.cs

示例3: useLowerCaseLettersPressed

partial         void useLowerCaseLettersPressed(NSButton sender)
        {
            if( sender.IntValue == 0 )
                useLowercaseLetters = false;
            else
                useLowercaseLetters = true;
        }
開發者ID:mkoby,項目名稱:PasswordGenerator,代碼行數:7,代碼來源:MainWindowController.cs

示例4: lightPointalize

		partial void lightPointalize (NSButton sender)
		{
			if (controls.ContentFilters == null || controls.ContentFilters.Count() == 0)
				Pointalize();	
			
			var path = string.Format ("contentFilters.pointalize.{0}", CIFilter.InputRadiusKey);
			controls.SetValueForKeyPath (NSNumber.FromFloat (1.0f), (NSString)path);
		}
開發者ID:kangaroo,項目名稱:monomac,代碼行數:8,代碼來源:FilteredView.cs

示例5: MvxNSButtonTitleTargetBinding

 public MvxNSButtonTitleTargetBinding(NSButton button)
     : base(button)
 {
     if (button == null)
     {
         MvxBindingTrace.Trace(MvxTraceLevel.Error, "Error - NSButton is null in MvxNSButtonTitleTargetBinding");
     }
 }
開發者ID:indazoo,項目名稱:MvvmCross_DesignData,代碼行數:8,代碼來源:MvxNSButtonTitleTargetBinding.cs

示例6: removeLastBox

		// Action for Remove pushbutton
		partial void removeLastBox (NSButton sender)
		{
			if (simpleView.Subviews.Length == 0)
				return;
			
			simpleView.Subviews.Last ().RemoveFromSuperview ();
			layout ();
		}
開發者ID:kangaroo,項目名稱:monomac,代碼行數:9,代碼來源:AnimatingViewsWindowController.cs

示例7: makeFast

		partial void makeFast (NSButton sender)
		{
			CABasicAnimation frameOriginAnimation = new CABasicAnimation();
			frameOriginAnimation.Duration = 0.1f;
			NSDictionary animations = NSDictionary.FromObjectAndKey(frameOriginAnimation,
			                                                        (NSString)"frameOrigin");
			myView.Mover.Animations = animations;
		}
開發者ID:Anomalous-Software,項目名稱:monomac,代碼行數:8,代碼來源:MainWindowController.cs

示例8: heavyPointalize

		partial void heavyPointalize (NSButton sender)
		{
			if (controls.ContentFilters == null || controls.ContentFilters.Count() == 0)
				Pointalize();	
			
			string path = string.Format ("contentFilters.pointalize.{0}", CIFilterInputKey.Radius);
			controls.SetValueForKeyPath (NSNumber.FromFloat (5), (NSString)path);
		}
開發者ID:Anomalous-Software,項目名稱:monomac,代碼行數:8,代碼來源:FilteredView.cs

示例9: generatePasswordClicked

partial         void generatePasswordClicked(NSButton sender)
        {
            gen = new Generator(Int32.Parse( passwordLengthText.StringValue ),
                                useUppercaseLetters,
                                useLowercaseLetters,
                                useNumbers,
                                useSpecialCharacters);
            generatedPasswordText.StringValue = gen.GeneratePassword();
        }
開發者ID:mkoby,項目名稱:PasswordGenerator,代碼行數:9,代碼來源:MainWindowController.cs

示例10: requestAction

 partial void requestAction (NSButton sender)
 {
         myTimer = NSTimer.CreateScheduledTimer (3.0, delegate {
                 if (popupRequestType.Cell.SelectedItemIndex == 0)
                         NSApp.RequestUserAttention (NSRequestUserAttentionType.InformationalRequest);
                 else
                         NSApp.RequestUserAttention (NSRequestUserAttentionType.CriticalRequest);
         });
 }
開發者ID:Anomalous-Software,項目名稱:monomac,代碼行數:9,代碼來源:MainWindowController.cs

示例11: openInDefaultBrowser

		partial void openInDefaultBrowser (NSButton sender)
		{
			CLLocation currentLocation = locationManager.Location;
			
			var urlPath = String.Format("http://maps.google.com/maps?ll={0},{1}&amp;spn={2},{3}",
						    currentLocation.Coordinate.Latitude,currentLocation.Coordinate.Longitude,
						    latitudeRangeForLocation (currentLocation), longitudeRangeForLocation (currentLocation));

			var externalBrowserURL = new NSUrl (urlPath);
			NSWorkspace.SharedWorkspace.OpenUrl (externalBrowserURL);
		}
開發者ID:roblillack,項目名稱:monomac,代碼行數:11,代碼來源:MainWindowController.cs

示例12: DeleteButtonClicked

		partial void DeleteButtonClicked (NSButton sender)
		{
			if (bookmarkTableView.SelectedRowCount != 1)
				return;
			
			var index = bookmarkTableView.SelectedRow;
			if (index < 0 || index > bookmarkTableView.RowCount)
				return;
			var temp = BookmarkDeleted;
			if (temp != null)
				temp (index);
		}
開發者ID:Anomalous-Software,項目名稱:monomac,代碼行數:12,代碼來源:BookmarkAssistant.cs

示例13: Canvas

        public Canvas()
        {
            root = new RootNode ();
            renderers = new List<object> ();
            uisync = new UISyncInvoke ();
            Motion.Tweener.Sync = uisync;

            testButton = new NSButton (new System.Drawing.RectangleF (100, 100, 100, 50));
            testButton.BezelStyle = NSBezelStyle.Rounded;

            testButton.FrameCenterRotation = 40;

            AddSubview (testButton);
        }
開發者ID:Clancey,項目名稱:Canvas,代碼行數:14,代碼來源:Canvas.cs

示例14: startStopAction

		partial void startStopAction (NSButton sender) 
		{
			if (sender.Title == "Start") {
				counter.Start ();
				sender.Title = "Stop";
				GrowlApplicationBridge.Notify ("The two-minute rule is magic.", 
				                               "You now have two minutes to Get Your Things Done.", "Start", null, 0, false, null);
			} else {
				counter.Stop ();
				sender.Title = "Start";
				if (counter.TimerMark.Minutes > 0 && counter.TimerMark.Seconds > 0)
					GrowlApplicationBridge.Notify ("Action Completed", String.Format ("You still have {0} left.  Step back and breath.  " + "Take a second and contemplate what you have achieved.  " + "You'll be suprised how many two-minute actions you can " + "perform even on your most critical projects", counter.TimeLeft), "Stop", null, 0, true, null);
			}
		}
開發者ID:kangaroo,項目名稱:monomac,代碼行數:14,代碼來源:MainWindowController.cs

示例15: goFullScreen

		partial void goFullScreen (NSButton sender)
		{
			isInFullScreenMode = true;
			
			// Pause the non-fullscreen view
			openGLView.StopAnimation ();
			
			RectangleF mainDisplayRect;
			RectangleF viewRect;
			
			// Create a screen-sized window on the display you want to take over
			// Note, mainDisplayRect has a non-zero origin if the key window is on a secondary display
			mainDisplayRect = NSScreen.MainScreen.Frame;
			
			fullScreenWindow = new NSWindow (mainDisplayRect, NSWindowStyle.Borderless, NSBackingStore.Buffered, true);
			
			// Set the window level to be above the menu bar
			fullScreenWindow.Level = NSWindowLevel.MainMenu + 1;
			
			// Perform any other window configuration you desire
			fullScreenWindow.IsOpaque = true;
			fullScreenWindow.HidesOnDeactivate = true;
			
			// Create a view with a double-buffered OpenGL context and attach it to the window
			// By specifying the non-fullscreen context as the shareContext, we automatically inherit the 
			// OpenGL objects (textures, etc) it has defined
			viewRect = new RectangleF (0, 0, mainDisplayRect.Size.Width, mainDisplayRect.Size.Height);
			
			fullScreenView = new MyOpenGLView (viewRect, openGLView.OpenGLContext);
			fullScreenWindow.ContentView = fullScreenView;
			
			// Show the window
			fullScreenWindow.MakeKeyAndOrderFront (this);
			
			// Set the scene with the full-screen viewport and viewing transformation
			Scene.setViewportRect (viewRect);
			
			// Assign the view's MainController to self
			fullScreenView.MainController = this;
			
			if (!isAnimating) {
				// Mark the view as needing drawing to initalize its contents
				fullScreenView.NeedsDisplay = true;
			} else {
				// Start playing the animation
				fullScreenView.StartAnimation ();
				
			}
		}
開發者ID:Anomalous-Software,項目名稱:monomac,代碼行數:49,代碼來源:MainWindowController.cs


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