当前位置: 首页>>代码示例>>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;未经允许,请勿转载。