本文整理汇总了C#中MonoMac.AppKit.NSTextField类的典型用法代码示例。如果您正苦于以下问题:C# NSTextField类的具体用法?C# NSTextField怎么用?C# NSTextField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NSTextField类属于MonoMac.AppKit命名空间,在下文中一共展示了NSTextField类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: Countdown
public Countdown(TimeSpan time, NSTextField countdownLabel, NSTextField infoLabel)
{
this.time = time;
this.timeUnit = new TimeSpan (0, 0, 1); // Define basic time unit as one second
this.countdownLabel = countdownLabel;
this.infoLabel = infoLabel;
}
开发者ID:nagyist,项目名称:TeaTimer,代码行数:7,代码来源:Countdown.cs
示例3: GetCredentials
public ICredentials GetCredentials (Uri uri, IWebProxy proxy, CredentialType credentialType, ICredentials existingCredentials, bool retrying)
{
bool result = false;
DispatchService.GuiSyncDispatch (() => {
using (var ns = new NSAutoreleasePool ()) {
var message = string.Format ("{0} needs {1} credentials to access {2}.", BrandingService.ApplicationName,
credentialType == CredentialType.ProxyCredentials ? "proxy" : "request", uri.Host);
NSAlert alert = NSAlert.WithMessage ("Credentials Required", "OK", "Cancel", null, message);
alert.Icon = NSApplication.SharedApplication.ApplicationIconImage;
NSView view = new NSView (new RectangleF (0, 0, 313, 91));
var creds = Utility.GetCredentialsForUriFromICredentials (uri, existingCredentials);
var usernameLabel = new NSTextField (new RectangleF (17, 55, 71, 17)) {
Identifier = "usernameLabel",
StringValue = "Username:",
Alignment = NSTextAlignment.Right,
Editable = false,
Bordered = false,
DrawsBackground = false,
Bezeled = false,
Selectable = false,
};
view.AddSubview (usernameLabel);
var usernameInput = new NSTextField (new RectangleF (93, 52, 200, 22));
usernameInput.StringValue = creds != null ? creds.UserName : string.Empty;
view.AddSubview (usernameInput);
var passwordLabel = new NSTextField (new RectangleF (22, 23, 66, 17)) {
StringValue = "Password:",
Alignment = NSTextAlignment.Right,
Editable = false,
Bordered = false,
DrawsBackground = false,
Bezeled = false,
Selectable = false,
};
view.AddSubview (passwordLabel);
var passwordInput = new NSSecureTextField (new RectangleF (93, 20, 200, 22));
passwordInput.StringValue = creds != null ? creds.Password : string.Empty;
view.AddSubview (passwordInput);
alert.AccessoryView = view;
result = alert.RunModal () == 1;
username = usernameInput.StringValue;
password = passwordInput.StringValue;
}
});
return result ? new NetworkCredential (username, password) : null;
}
开发者ID:fedorw,项目名称:monodevelop,代码行数:56,代码来源:MacProxyCredentialProvider.cs
示例4: FinishedLaunching
public override void FinishedLaunching(NSObject notification)
{
text = new NSTextField (new RectangleF (44, 32, 232, 31)) {
StringValue = "Hello Mono Mac!"
};
window = new NSWindow (new RectangleF (50, 50, 400, 400), (NSWindowStyle) (1 | (1 << 1) | (1 << 2) | (1 << 3)), 0, false);
window.ContentView.AddSubview (text);
window.MakeKeyAndOrderFront (this);
}
开发者ID:sichy,项目名称:monomac,代码行数:10,代码来源:hello.cs
示例5: UpdateReachability
void UpdateReachability (NetworkReachabilityFlags flags, NSImageView icon, NSTextField statusField)
{
if (flags.HasFlag (NetworkReachabilityFlags.Reachable) && !flags.HasFlag (NetworkReachabilityFlags.ConnectionRequired)) {
icon.Image = NSImage.ImageNamed ("connected");
} else {
icon.Image = NSImage.ImageNamed ("disconnected");
}
statusField.StringValue = flags == 0 ? String.Empty : flags.ToString ();
}
开发者ID:RafasTavares,项目名称:mac-samples,代码行数:10,代码来源:MainWindowController.cs
示例6: SparkleSetupWindow
public SparkleSetupWindow()
: base()
{
SetFrame (new RectangleF (0, 0, 640, 420), true);
StyleMask = NSWindowStyle.Titled;
MaxSize = new SizeF (640, 420);
MinSize = new SizeF (640, 420);
HasShadow = true;
BackingType = NSBackingStore.Buffered;
Center ();
string side_splash_path = Path.Combine (NSBundle.MainBundle.ResourcePath,
"Pixmaps", "side-splash.png");
SideSplash = new NSImage (side_splash_path) {
Size = new SizeF (150, 482)
};
SideSplashView = new NSImageView () {
Image = SideSplash,
Frame = new RectangleF (0, 0, 150, 482)
};
Buttons = new List <NSButton> ();
HeaderTextField = new NSTextField () {
Frame = new RectangleF (190, Frame.Height - 100, Frame.Width, 48),
BackgroundColor = NSColor.WindowBackground,
Bordered = false,
Editable = false,
Font = NSFontManager.SharedFontManager.FontWithFamily
("Lucida Grande", NSFontTraitMask.Bold, 0, 15)
};
DescriptionTextField = new NSTextField () {
Frame = new RectangleF (190, Frame.Height - 130, 640 - 240, 44),
BackgroundColor = NSColor.WindowBackground,
Bordered = false,
Editable = false,
Font = SparkleUI.Font
};
NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
MakeKeyAndOrderFront (this);
OrderFrontRegardless ();
if (Program.UI != null)
Program.UI.UpdateDockIconVisibility ();
}
开发者ID:shilga,项目名称:SparkleShare,代码行数:52,代码来源:SparkleSetupWindow.cs
示例7: AwakeFromNib
public override void AwakeFromNib()
{
base.AwakeFromNib ();
this.Window.Title = "NSRotatingImageView";
// Size and center main window in the screen
SizeF windowSize = new SizeF (300f, 300f);
this.Window.SetFrame(new RectangleF (
new PointF ((this.Window.Screen.Frame.Width / 2f) - (windowSize.Width / 2f), (this.Window.Screen.Frame.Height / 2f) - (windowSize.Height / 2f)),
windowSize), true);
// Setup and add a new NSImageView to the window
_imageView = new NSRotatingImageView ();
_imageView.Image = NSImage.ImageNamed ("sync.pdf");
SizeF frameSize = new SizeF (32f, 32f);
_imageView.Frame = new RectangleF ((this.Window.Frame.Width - frameSize.Width) / 2f, (this.Window.Frame.Height - frameSize.Height) / 2f, frameSize.Width, frameSize.Height);
this.Window.ContentView.AddSubview (_imageView);
// Setup and add Glyphish credit
NSTextField labelGlyphish = new NSTextField ();
labelGlyphish.StringValue = "Icon via Glyphish Free";
labelGlyphish.Editable = false;
labelGlyphish.Bordered = false;
labelGlyphish.Alignment = NSTextAlignment.Center;
labelGlyphish.BackgroundColor = NSColor.Clear;
SizeF labelSize = new SizeF (200f, 18f);
labelGlyphish.Frame = new RectangleF(new PointF ((this.Window.Frame.Width - labelSize.Width) / 2f, (this.Window.Frame.Height - labelSize.Height) / 2f - 125f), labelSize);
this.Window.ContentView.AddSubview (labelGlyphish);
// Setup and add a button to start/stop animation
_btnStartStop = new NSButton ();
_btnStartStop.Title = "Start";
_btnStartStop.BezelStyle = NSBezelStyle.Rounded;
_btnStartStop.SetButtonType (NSButtonType.MomentaryPushIn);
SizeF btnSize = new SizeF (100f, 32f);
_btnStartStop.Frame = new RectangleF (new PointF ((this.Window.Frame.Width - btnSize.Width) / 2f, (this.Window.Frame.Height - btnSize.Height) / 2f - 50f), btnSize);
this.Window.ContentView.AddSubview (_btnStartStop);
_btnStartStop.Activated += (object sender, EventArgs e) => {
if(_imageView.IsAnimating)
{
_imageView.StopAnimation();
_btnStartStop.Title = "Start";
}
else
{
_imageView.StartAnimation();
_btnStartStop.Title = "Stop";
}
};
}
开发者ID:robertmiles3,项目名称:NSRotatingImageView,代码行数:51,代码来源:MainWindowController.cs
示例8: SparkleSetupWindow
public SparkleSetupWindow()
: base()
{
SetFrame (new RectangleF (0, 0, 640, 420), true);
StyleMask = NSWindowStyle.Titled;
MaxSize = new SizeF (640, 420);
MinSize = new SizeF (640, 420);
HasShadow = true;
BackingType = NSBackingStore.Buffered;
Center ();
string side_splash_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "side-splash.png");
this.side_splash = new NSImage (side_splash_path) {
Size = new SizeF (150, 482)
};
this.side_splash_view = new NSImageView () {
Image = this.side_splash,
Frame = new RectangleF (0, 0, 150, 482)
};
this.header_text_field = new NSTextField () {
Frame = new RectangleF (190, Frame.Height - 80, Frame.Width, 24),
BackgroundColor = NSColor.WindowBackground,
Bordered = false,
Editable = false,
Font = NSFontManager.SharedFontManager.FontWithFamily (
"Lucida Grande", NSFontTraitMask.Bold, 0, 15),
};
this.header_text_field.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail;
this.description_text_field = new NSTextField () {
Frame = new RectangleF (190, Frame.Height - 130, 640 - 240, 44),
BackgroundColor = NSColor.WindowBackground,
Bordered = false,
Editable = false,
Font = NSFontManager.SharedFontManager.FontWithFamily (
"Lucida Grande", NSFontTraitMask.Condensed, 0, 13)
};
if (Program.UI != null)
Program.UI.UpdateDockIconVisibility ();
}
开发者ID:nicolas-raoul,项目名称:SparkleShare,代码行数:47,代码来源:SparkleSetupWindow.cs
示例9: Initialize
private void Initialize()
{
IndexBackground = new SessionsView(new RectangleF(0, 0, 16, 24));
IndexBackground.BackgroundColor1 = new CGColor(1, 0, 0);
IndexBackground.BackgroundColor2 = new CGColor(1, 0, 0);
IndexBackground.Hidden = true;
AddSubview(IndexBackground);
IndexLabel = new NSTextField(new RectangleF(0, -2, 14, 24));
IndexLabel.Bezeled = false;
IndexLabel.Hidden = true;
IndexLabel.DrawsBackground = false;
IndexLabel.Alignment = NSTextAlignment.Center;
IndexLabel.TextColor = NSColor.White;
IndexLabel.Font = NSFont.FromFontName("Roboto", 11);
AddSubview(IndexLabel);
}
开发者ID:pascalfr,项目名称:MPfm,代码行数:17,代码来源:SessionsTableViewCell.cs
示例10: MvxTableCellView
public MvxTableCellView(string bindingText)
{
#if __UNIFIED__
this.Frame = new CGRect(0, 0, 100, 17);
TextField = new NSTextField(new CGRect(0, 0, 100, 17))
#else
this.Frame = new RectangleF(0, 0, 100, 17);
TextField = new NSTextField(new RectangleF(0, 0, 100, 17))
#endif
{
Editable = false,
Bordered = false,
BackgroundColor = NSColor.Clear,
};
AddSubview (TextField);
Initialize (bindingText);
}
开发者ID:indazoo,项目名称:MvvmCross_DesignData,代码行数:18,代码来源:MvxTableCellView.cs
示例11: SelectFile
public static void SelectFile(NSWindow window, NSTextField field)
{
NSOpenPanel openPanel = new NSOpenPanel ();
openPanel.BeginSheet (window, (i) => {
try {
if (openPanel.Url != null) {
string path = openPanel.Url.Path;
if (!string.IsNullOrEmpty (path))
field.StringValue = path;
}
} finally {
openPanel.Dispose ();
}
});
}
开发者ID:liftir,项目名称:airvpn-client,代码行数:20,代码来源:GuiUtils.cs
示例12: SparkleSetupWindow
public SparkleSetupWindow()
: base()
{
SetFrame (new RectangleF (0, 0, 450, 542), true);
StyleMask = NSWindowStyle.Titled | NSWindowStyle.Closable | NSWindowStyle.Miniaturizable;
MaxSize = new SizeF (450, 542);
MinSize = new SizeF (450, 542);
HasShadow = true;
BackingType = NSBackingStore.Buffered;
Center ();
this.background_image_view = new NSImageView () {
//Image = this.background_image,
Frame = new RectangleF (0, 0, 450, 542)
};
this.header_text_field = new NSTextField () {
Frame = new RectangleF (190, Frame.Height - 100, Frame.Width, 48),
BackgroundColor = NSColor.Clear,
Bordered = false,
Editable = false,
Font = NSFontManager.SharedFontManager.FontWithFamily (
"Lucida Grande", NSFontTraitMask.Bold, 0, 16)
};
this.description_text_field = new NSTextField () {
Frame = new RectangleF (190, Frame.Height - 210, 640 - 240, 105),
BackgroundColor = NSColor.Clear,
Bordered = false,
Editable = false,
Font = NSFontManager.SharedFontManager.FontWithFamily (
"Lucida Grande", NSFontTraitMask.Condensed, 0, 13)
};
if (Program.UI != null)
Program.UI.UpdateDockIconVisibility ();
}
开发者ID:greenqloud,项目名称:qloudsync,代码行数:39,代码来源:SparkleSetupWindow.cs
示例13: ShowPage
public void ShowPage(PageType type, string [] warnings)
{
if (type == PageType.Setup) {
Header = "Welcome to SparkleShare!";
Description = "First off, what's your name and email?\n(visible only to team members)";
FullNameLabel = new NSTextField () {
Alignment = NSTextAlignment.Right,
BackgroundColor = NSColor.WindowBackground,
Bordered = false,
Editable = false,
Frame = new RectangleF (165, Frame.Height - 234, 160, 17),
StringValue = "Full Name:",
Font = SparkleUI.Font
};
FullNameTextField = new NSTextField () {
Frame = new RectangleF (330, Frame.Height - 238, 196, 22),
StringValue = UnixUserInfo.GetRealUser ().RealName,
Delegate = new SparkleTextFieldDelegate ()
};
EmailLabel = new NSTextField () {
Alignment = NSTextAlignment.Right,
BackgroundColor = NSColor.WindowBackground,
Bordered = false,
Editable = false,
Frame = new RectangleF (165, Frame.Height - 264, 160, 17),
StringValue = "Email:",
Font = SparkleUI.Font
};
EmailTextField = new NSTextField () {
Frame = new RectangleF (330, Frame.Height - 268, 196, 22),
Delegate = new SparkleTextFieldDelegate ()
};
CancelButton = new NSButton () {
Title = "Cancel"
};
ContinueButton = new NSButton () {
Title = "Continue",
Enabled = false
};
(FullNameTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate {
Controller.CheckSetupPage (FullNameTextField.StringValue, EmailTextField.StringValue);
};
(EmailTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate {
Controller.CheckSetupPage (FullNameTextField.StringValue, EmailTextField.StringValue);
};
ContinueButton.Activated += delegate {
string full_name = FullNameTextField.StringValue.Trim ();
string email = EmailTextField.StringValue.Trim ();
Controller.SetupPageCompleted (full_name, email);
};
CancelButton.Activated += delegate {
Controller.SetupPageCancelled ();
};
Controller.UpdateSetupContinueButtonEvent += delegate (bool button_enabled) {
InvokeOnMainThread (delegate {
ContinueButton.Enabled = button_enabled;
});
};
ContentView.AddSubview (FullNameLabel);
ContentView.AddSubview (FullNameTextField);
ContentView.AddSubview (EmailLabel);
ContentView.AddSubview (EmailTextField);
Buttons.Add (ContinueButton);
Buttons.Add (CancelButton);
Controller.CheckSetupPage (FullNameTextField.StringValue, EmailTextField.StringValue);
}
if (type == PageType.Invite) {
Header = "You've received an invite!";
Description = "Do you want to add this project to SparkleShare?";
AddressLabel = new NSTextField () {
Alignment = NSTextAlignment.Right,
BackgroundColor = NSColor.WindowBackground,
Bordered = false,
Editable = false,
Frame = new RectangleF (165, Frame.Height - 240, 160, 17),
StringValue = "Address:",
Font = SparkleUI.Font
};
PathLabel = new NSTextField () {
Alignment = NSTextAlignment.Right,
BackgroundColor = NSColor.WindowBackground,
Bordered = false,
//.........这里部分代码省略.........
开发者ID:mvaello,项目名称:SparkleShare,代码行数:101,代码来源:SparkleSetup.cs
示例14: LabelControl
internal static NSView LabelControl (string label, float controlWidth, NSControl control)
{
var view = new NSView (new RectangleF (0, 0, controlWidth, 28)) {
AutoresizesSubviews = true,
AutoresizingMask = NSViewResizingMask.WidthSizable | NSViewResizingMask.MaxXMargin,
};
var text = new NSTextField (new RectangleF (0, 6, 100, 20)) {
StringValue = label,
DrawsBackground = false,
Bordered = false,
Editable = false,
Selectable = false
};
text.SizeToFit ();
float textWidth = text.Frame.Width;
float textHeight = text.Frame.Height;
control.SizeToFit ();
var rect = control.Frame;
float controlHeight = rect.Height;
control.Frame = new RectangleF (textWidth + 5, 0, controlWidth, rect.Height);
rect = view.Frame;
rect.Width = control.Frame.Width + textWidth + 5;
rect.Height = Math.Max (controlHeight, textHeight);
view.Frame = rect;
view.AddSubview (text);
view.AddSubview (control);
return view;
}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:33,代码来源:MacSelectFileDialogHandler.cs
示例15: CreateAbout
private void CreateAbout()
{
string about_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath,
"Pixmaps", "about.png");
AboutImage = new NSImage (about_image_path) {
Size = new SizeF (640, 260)
};
AboutImageView = new NSImageView () {
Image = AboutImage,
Frame = new RectangleF (0, 0, 640, 260)
};
VersionTextField = new NSTextField () {
StringValue = "version " + Controller.RunningVersion,
Frame = new RectangleF (295, 140, 318, 22),
BackgroundColor = NSColor.White,
Bordered = false,
Editable = false,
DrawsBackground = false,
TextColor = NSColor.White,
Font = NSFontManager.SharedFontManager.FontWithFamily
("Lucida Grande", NSFontTraitMask.Unbold, 0, 11)
};
UpdatesTextField = new NSTextField () {
StringValue = "Checking for updates...",
Frame = new RectangleF (295, Frame.Height - 232, 318, 98),
Bordered = false,
Editable = false,
DrawsBackground = false,
Font = NSFontManager.SharedFontManager.FontWithFamily
("Lucida Grande", NSFontTraitMask.Unbold, 0, 11),
TextColor =
NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f) // Tango Sky Blue #1
};
CreditsTextField = new NSTextField () {
StringValue = @"Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others." +
"\n" +
"\n" +
"SparkleShare is Free and Open Source Software. You are free to use, modify, and redistribute it " +
"under the GNU General Public License version 3 or later.",
Frame = new RectangleF (295, Frame.Height - 260, 318, 98),
TextColor = NSColor.White,
DrawsBackground = false,
Bordered = false,
Editable = false,
Font = NSFontManager.SharedFontManager.FontWithFamily
("Lucida Grande", NSFontTraitMask.Unbold, 0, 11),
};
// WebsiteButton.Activated += delegate {
// NSUrl url = new NSUrl ("http://www.sparkleshare.org/");
// NSWorkspace.SharedWorkspace.OpenUrl (url);
// };
// CreditsButton.Activated += delegate {
// NSUrl url = new NSUrl ("http://www.sparkleshare.org/credits/");
// NSWorkspace.SharedWorkspace.OpenUrl (url);
// };
ContentView.AddSubview (AboutImageView);
ContentView.AddSubview (VersionTextField);
ContentView.AddSubview (UpdatesTextField);
ContentView.AddSubview (CreditsTextField);
}
开发者ID:BillTheBest,项目名称:SparkleShare,代码行数:69,代码来源:SparkleAbout.cs
示例16: SparkleEventLog
public SparkleEventLog()
: base()
{
using (var a = new NSAutoreleasePool ())
{
Title = "Recent Changes";
Delegate = new SparkleEventsDelegate ();
int min_width = 480;
int min_height = 640;
float x = (float) (NSScreen.MainScreen.Frame.Width * 0.61);
float y = (float) (NSScreen.MainScreen.Frame.Height * 0.5 - (min_height * 0.5));
SetFrame (
new RectangleF (
new PointF (x, y),
new SizeF (min_width, (int) (NSScreen.MainScreen.Frame.Height * 0.85))),
true);
StyleMask = (NSWindowStyle.Closable |
NSWindowStyle.Miniaturizable |
NSWindowStyle.Titled |
NSWindowStyle.Resizable);
MinSize = new SizeF (min_width, min_height);
HasShadow = true;
BackingType = NSBackingStore.Buffered;
TitlebarHeight = Frame.Height - ContentView.Frame.Height;
this.web_view = new WebView (new RectangleF (0, 0, 481, 579), "", "") {
PolicyDelegate = new SparkleWebPolicyDelegate (),
Frame = new RectangleF (new PointF (0, 0),
new SizeF (ContentView.Frame.Width, ContentView.Frame.Height - 39))
};
this.hidden_close_button = new NSButton () {
KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
KeyEquivalent = "w"
};
this.hidden_close_button.Activated += delegate {
Controller.WindowClosed ();
};
this.size_label = new NSTextField () {
Alignment = NSTextAlignment.Right,
BackgroundColor = NSColor.WindowBackground,
Bordered = false,
Editable = false,
Frame = new RectangleF (
new PointF (0, ContentView.Frame.Height - 30),
new SizeF (60, 20)),
StringValue = "Size:",
Font = SparkleUI.BoldFont
};
this.size_label_value = new NSTextField () {
Alignment = NSTextAlignment.Left,
BackgroundColor = NSColor.WindowBackground,
Bordered = false,
Editable = false,
Frame = new RectangleF (
new PointF (60, ContentView.Frame.Height - 30),
new SizeF (60, 20)),
StringValue = "…",
Font = SparkleUI.Font
};
this.history_label = new NSTextField () {
Alignment = NSTextAlignment.Right,
BackgroundColor = NSColor.WindowBackground,
Bordered = false,
Editable = false,
Frame = new RectangleF (
new PointF (130, ContentView.Frame.Height - 30),
new SizeF (60, 20)),
StringValue = "History:",
Font = SparkleUI.BoldFont
};
this.history_label_value = new NSTextField () {
Alignment = NSTextAlignment.Left,
BackgroundColor = NSColor.WindowBackground,
Bordered = false,
Editable = false,
Frame = new RectangleF (
new PointF (190, ContentView.Frame.Height - 30),
new SizeF (60, 20)
),
StringValue = "…",
Font = SparkleUI.Font
};
this.popup_button = new NSPopUpButton () {
Frame = new RectangleF (
new PointF (ContentView.Frame.Width - 156 - 12, ContentView.Frame.Height - 33),
new SizeF (156, 26)),
PullsDown = false
};
//.........这里部分代码省略.........
开发者ID:neiljbrookes,项目名称:SparkleShare,代码行数:101,代码来源:SparkleEventLog.cs
示例17: GetCredentialsFromUser
static ICredentials GetCredentialsFromUser (Uri uri, IWebProxy proxy, CredentialType credentialType)
{
NetworkCredential result = null;
DispatchService.GuiSyncDispatch (() => {
using (var ns = new NSAutoreleasePool ()) {
var message = credentialType == CredentialType.ProxyCredentials
? GettextCatalog.GetString (
"{0} needs credentials to access the proxy server {1}.",
BrandingService.ApplicationName,
uri.Host
)
: GettextCatalog.GetString (
"{0} needs credentials to access {1}.",
BrandingService.ApplicationName,
uri.Host
);
var alert = NSAlert.WithMessage (
GettextCatalog.GetString ("Credentials Required"),
GettextCatalog.GetString ("OK"),
GettextCatalog.GetString ("Cancel"),
null,
message
);
alert.Icon = NSApplication.SharedApplication.ApplicationIconImage;
var view = new NSView (new RectangleF (0, 0, 313, 91));
var usernameLabel = new NSTextField (new RectangleF (17, 55, 71, 17)) {
Identifier = "usernameLabel",
StringValue = "Username:",
Alignment = NSTextAlignment.Right,
Editable = false,
Bordered = false,
DrawsBackground = false,
Bezeled = false,
Selectable = false,
};
view.AddSubview (usernameLabel);
var usernameInput = new NSTextField (new RectangleF (93, 52, 200, 22));
view.AddSubview (usernameInput);
var passwordLabel = new NSTextField (new RectangleF (22, 23, 66, 17)) {
StringValue = "Password:",
Alignment = NSTextAlignment.Right,
Editable = false,
Bordered = false,
DrawsBackground = false,
Bezeled = false,
Selectable = false,
};
view.AddSubview (passwordLabel);
var passwordInput = new NSSecureTextField (new RectangleF (93, 20, 200, 22));
view.AddSubview (passwordInput);
alert.AccessoryView = view;
if (alert.RunModal () != 1)
return;
var username = usernameInput.StringValue;
var password = passwordInput.StringValue;
result = new NetworkCredential (username, password);
}
});
// store the obtained credentials in the keychain
// but don't store for the root url since it may have other credentials
if (result != null)
Keychain.AddInternetPassword (uri, result.UserName, result.Password);
return result;
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:78,代码来源:MacProxyCredentialProvider.cs
示例18: ShowPage
public void ShowPage (PageType type, string [] warnings)
{
if (type == PageType.Setup) {
Header = "Welcome to SparkleShare!";
Description = "First off, what’s your name and email?\n(visible only to team members)";
FullNameLabel = new SparkleLabel ("Full Name:", NSTextAlignment.Right);
FullNameLabel.Frame = new RectangleF (165, Frame.Height - 234, 160, 17);
FullNameTextField = new NSTextField () {
Frame = new RectangleF (330, Frame.Height - 238, 196, 22),
StringValue = UnixUserInfo.GetRealUser ().RealName,
Delegate = new SparkleTextFieldDelegate ()
};
EmailLabel = new SparkleLabel ("Email:", NSTextAlignment.Right);
EmailLabel.Frame = new RectangleF (165, Frame.Height - 264, 160, 17);
EmailTextField = new NSTextField () {
Frame = new RectangleF (330, Frame.Height - 268, 196, 22),
Delegate = new SparkleTextFieldDelegate ()
};
CancelButton = new NSButton () { Title = "Cancel" };
ContinueButton = new NSButton () {
Title = "Continue",
Enabled = false
};
(FullNameTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate {
Controller.CheckSetupPage (FullNameTextField.StringValue, EmailTextField.StringValue);
};
(EmailTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate {
Controller.CheckSetupPage (FullNameTextField.StringValue, EmailTextField.StringValue);
};
ContinueButton.Activated += delegate {
string full_name = FullNameTextField.StringValue.Trim ();
string email = EmailTextField.StringValue.Trim ();
Controller.SetupPageCompleted (full_name, email);
};
CancelButton.Activated += delegate { Controller.SetupPageCancelled (); };
Controller.UpdateSetupContinueButtonEvent += delegate (bool button_enabled) {
Program.Controller.Invoke (() => {
ContinueButton.Enabled = button_enabled;
});
};
ContentView.AddSubview (FullNameLabel);
ContentView.AddSubview (FullNameTextField);
ContentView.AddSubview (EmailLabel);
ContentView.AddSubview (EmailTextField);
Buttons.Add (ContinueButton);
Buttons.Add (CancelButton);
Controller.CheckSetupPage (FullNameTextField.StringValue, EmailTextField.StringValue);
}
if (type == PageType.Invite) {
Header = "You’ve received an invite!";
Description = "Do you want to add this project to SparkleShare?";
AddressLabel = new SparkleLabel ("Address:", NSTextAlignment.Right);
AddressLabel.Frame = new RectangleF (165, Frame.Height - 240, 160, 17);
AddressTextField = new SparkleLabel (Controller.PendingInvite.Address, NSTextAlignment.Left) {
Frame = new RectangleF (330, Frame.Height - 240, 260, 17),
Font = SparkleUI.BoldFont
};
PathLabel = new SparkleLabel ("Remote Path:", NSTextAlignment.Right);
PathLabel.Frame = new RectangleF (165, Frame.Height - 264, 160, 17);
PathTextField = new SparkleLabel (Controller.PendingInvite.RemotePath, NSTextAlignment.Left) {
Frame = new RectangleF (330, Frame.Height - 264, 260, 17),
Font = SparkleUI.BoldFont
};
CancelButton = new NSButton () { Title = "Cancel" };
AddButton = new NSButton () { Title = "Add" };
CancelButton.Activated += delegate { Controller.PageCancelled (); };
AddButton.Activated += delegate { Controller.InvitePageCompleted (); };
ContentView.AddSubview (AddressLabel);
ContentView.AddSubview (PathLabel);
ContentView.AddSubview (AddressTextField);
ContentView.AddSubview (PathTextField);
Buttons.Add (AddButton);
//.........这里部分代码省略.........
开发者ID:ramabhadrarao,项目名称:niiarshare,代码行数:101,代码来源:SparkleSetup.cs
示例19: XTextFieldCell
public XTextFieldCell(NSTextField owner)
: base()
{
this.Owner = owner;
}
开发者ID:tomesoft,项目名称:FontAwesomeTouch,代码行数:5,代码来源:MainWindowController.cs
示例20: SparkleSetup
public SparkleSetup()
: base()
{
Controller.ChangePageEvent += delegate (PageType type) {
InvokeOnMainThread (delegate {
Reset ();
switch (type) {
case PageType.Setup:
Header = "Welcome to SparkleShare!";
Description = "Before we can create a SparkleShare folder on this " +
"computer, we need some information from you.";
UserInfoForm = new NSForm (new RectangleF (250, 115, 350, 64));
UserInfoForm.AddEntry ("Full Name:");
UserInfoForm.AddEntry ("Email Address:");
|
请发表评论