本文整理汇总了C#中Gtk.Button.SetFlag方法的典型用法代码示例。如果您正苦于以下问题:C# Button.SetFlag方法的具体用法?C# Button.SetFlag怎么用?C# Button.SetFlag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Button
的用法示例。
在下文中一共展示了Button.SetFlag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowAdd1Page
//.........这里部分代码省略.........
Add (layout_vertical);
// Cancel button
Button cancel_button = new Button (cancelText);
cancel_button.Clicked += delegate {
Controller.PageCancelled ();
};
// Continue button
Button continue_button = new Button (continueText) {
Sensitive = String.IsNullOrEmpty( Controller.CheckAddPage (address_entry.Text))
};
continue_button.Clicked += delegate {
// Show wait cursor
this.GdkWindow.Cursor = wait_cursor;
// Try to find the CMIS server (asynchronous using a delegate)
GetRepositoriesFuzzyDelegate dlgt =
new GetRepositoriesFuzzyDelegate(CmisUtils.GetRepositoriesFuzzy);
ServerCredentials credentials = new ServerCredentials() {
UserName = user_entry.Text,
Password = password_entry.Text,
Address = new Uri(address_entry.Text)
};
IAsyncResult ar = dlgt.BeginInvoke(credentials, null, null);
while (!ar.AsyncWaitHandle.WaitOne(100)) {
while (Application.EventsPending()) {
Application.RunIteration();
}
}
Tuple<CmisServer, Exception> result = dlgt.EndInvoke(ar);
CmisServer cmisServer = result.Item1;
if(cmisServer != null)
{
Controller.repositories = cmisServer.Repositories;
address_entry.Text = cmisServer.Url.ToString();
}
else
{
Controller.repositories = null;
}
// Hide wait cursor
this.GdkWindow.Cursor = default_cursor;
if (Controller.repositories == null)
{
// Show warning
string warning = "";
string message = result.Item2.Message;
Exception e = result.Item2;
if (e is CmisPermissionDeniedException)
{
warning = Properties_Resources.LoginFailedForbidden;
}
// else if (e is CmisServerNotFoundException)
// {
// warning = Properties_Resources.ConnectFailure;
// }
else if (e.Message == "SendFailure" && cmisServer.Url.Scheme.StartsWith("https"))
{
warning = Properties_Resources.SendFailureHttps;
}
else if (e.Message == "TrustFailure")
{
warning = Properties_Resources.TrustFailure;
}
else
{
warning = message + Environment.NewLine + Properties_Resources.Sorry;
}
address_error_label.Markup = "<span foreground=\"red\">" + warning + "</span>";
address_error_label.Show();
}
else
{
// Continue to folder selection
Controller.Add1PageCompleted(
new Uri(address_entry.Text), user_entry.Text, password_entry.Text);
}
};
Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) {
Application.Invoke (delegate {
continue_button.Sensitive = button_enabled;
if(button_enabled) {
continue_button.SetFlag(Gtk.WidgetFlags.CanFocus);
continue_button.SetFlag(Gtk.WidgetFlags.CanDefault);
continue_button.GrabDefault();
}
});
};
AddButton (cancel_button);
AddButton (continue_button);
Controller.CheckAddPage (address_entry.Text);
address_entry.GrabFocus ();
}
示例2: ShowAdd1Page
//.........这里部分代码省略.........
Markup = "<b>" + Properties_Resources.User + ":</b>",
Xalign = 0
},
true,
true,
0);
layout_user.PackStart(user_entry, false, false, 0);
// Password
layout_password.PackStart(
new Label() {
Markup = "<b>" + Properties_Resources.Password + ":</b>",
Xalign = 0
},
true,
true,
0);
layout_password.PackStart(password_entry, false, false, 0);
layout_fields.PackStart(layout_user);
layout_fields.PackStart(layout_password);
layout_vertical.PackStart(layout_address, false, false, 0);
layout_vertical.PackStart(layout_fields, false, false, 0);
layout_vertical.PackStart(address_error_label, true, true, 0);
this.Add(layout_vertical);
// Cancel button
Button cancel_button = new Button(this.cancelText);
cancel_button.Clicked += delegate {
this.controller.PageCancelled();
};
// Continue button
Button continue_button = new Button(this.continueText) {
Sensitive = string.IsNullOrEmpty(this.controller.CheckAddPage(address_entry.Text))
};
continue_button.Clicked += delegate {
// Show wait cursor
this.GdkWindow.Cursor = waitCursor;
// Try to find the CMIS server (asynchronous using a delegate)
GetRepositoriesDelegate dlgt =
new GetRepositoriesDelegate(SetupController.GetRepositories);
ServerCredentials credentials = new ServerCredentials() {
UserName = user_entry.Text,
Password = password_entry.Text,
Address = new Uri(address_entry.Text),
Binding = this.controller.saved_binding ?? ServerCredentials.BindingBrowser
};
IAsyncResult ar = dlgt.BeginInvoke(credentials, null, null);
while (!ar.AsyncWaitHandle.WaitOne(100)) {
while (Application.EventsPending()) {
Application.RunIteration();
}
}
var result = dlgt.EndInvoke(ar);
if (result.Repositories != null) {
this.controller.repositories = result.Repositories.WithoutHiddenOnce();
address_entry.Text = result.Credentials.Address.ToString();
} else {
this.controller.repositories = null;
// Show best found Url
address_entry.Text = result.Credentials.Address.ToString();
// Show warning
string warning = this.controller.GetConnectionsProblemWarning(result.FailedException);
address_error_label.Markup = "<span foreground=\"red\">" + warning + "</span>";
address_error_label.Show();
}
// Hide wait cursor
this.GdkWindow.Cursor = defaultCursor;
if (this.controller.repositories != null) {
// Continue to folder selection
this.controller.Add1PageCompleted(
new Uri(address_entry.Text), result.Credentials.Binding, user_entry.Text, password_entry.Text);
}
};
this.controller.UpdateAddProjectButtonEvent += delegate(bool button_enabled) {
Application.Invoke(delegate {
continue_button.Sensitive = button_enabled;
if (button_enabled) {
continue_button.SetFlag(Gtk.WidgetFlags.CanFocus);
continue_button.SetFlag(Gtk.WidgetFlags.CanDefault);
continue_button.GrabDefault();
}
});
};
this.AddButton(cancel_button);
this.AddButton(continue_button);
this.controller.CheckAddPage(address_entry.Text);
address_entry.GrabFocus();
}