本文整理汇总了C#中MonoTouch.Dialog.StyledStringElement类的典型用法代码示例。如果您正苦于以下问题:C# StyledStringElement类的具体用法?C# StyledStringElement怎么用?C# StyledStringElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StyledStringElement类属于MonoTouch.Dialog命名空间,在下文中一共展示了StyledStringElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnSearchResultsPropertyChanged
private void OnSearchResultsPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName != "Value")
return;
var results = this.viewModel.SearchResults;
if (results != null)
return;
var value = results.Value;
if (value != null)
return;
InvokeOnMainThread (() => {
this.resultsSection.Clear();
this.resultsSection.AddAll (value.Select (p => {
StyledStringElement element = null;
element = new StyledStringElement (p.Nickname, () => {
if (element.Accessory == UITableViewCellAccessory.Checkmark) {
element.Accessory = UITableViewCellAccessory.None;
this.selected.Remove (p);
} else {
element.Accessory = UITableViewCellAccessory.Checkmark;
this.selected.Add (p);
}
});
if (p.Status != Status.Online)
element.Font = UIFont.ItalicSystemFontOfSize (element.Font.PointSize);
return element;
}));
});
}
示例2: Initialize
private void Initialize()
{
var loginWithWidgetBtn = new StyledStringElement ("Login with Widget", this.LoginWithWidgetButtonClick) {
Alignment = UITextAlignment.Center
};
var loginWithConnectionBtn = new StyledStringElement ("Login with Google", this.LoginWithConnectionButtonClick) {
Alignment = UITextAlignment.Center
};
var loginBtn = new StyledStringElement ("Login", this.LoginWithUsernamePassword) {
Alignment = UITextAlignment.Center
};
this.resultElement = new StyledMultilineElement (string.Empty, string.Empty, UITableViewCellStyle.Subtitle);
var login1 = new Section ("Login");
login1.Add (loginWithWidgetBtn);
login1.Add (loginWithConnectionBtn);
var login2 = new Section ("Login with user/password");
login2.Add (this.userNameElement = new EntryElement ("User", string.Empty, string.Empty));
login2.Add (this.passwordElement = new EntryElement ("Password", string.Empty, string.Empty, true));
login2.Add (loginBtn);
var result = new Section ("Result");
result.Add(this.resultElement);
this.Root.Add (new Section[] { login1, login2, result });
}
开发者ID:ducaciprian,项目名称:Xamarin.Auth0Client,代码行数:30,代码来源:Auth0Client_iOS_SampleViewController.designer.cs
示例3: EchoDicomServer
public void EchoDicomServer()
{
RootElement root = null;
Section resultSection = null;
var hostEntry = new EntryElement("Host", "Host name of the DICOM server", "server");
var portEntry = new EntryElement("Port", "Port number", "104");
var calledAetEntry = new EntryElement("Called AET", "Called application AET", "ANYSCP");
var callingAetEntry = new EntryElement("Calling AET", "Calling application AET", "ECHOSCU");
var echoButton = new StyledStringElement("Click to test",
delegate {
if (resultSection != null) root.Remove(resultSection);
string message;
var echoFlag = DoEcho(hostEntry.Value, Int32.Parse(portEntry.Value), calledAetEntry.Value, callingAetEntry.Value, out message);
var echoImage = new ImageStringElement(String.Empty, echoFlag ? new UIImage("yes-icon.png") : new UIImage("no-icon.png"));
var echoMessage = new StringElement(message);
resultSection = new Section(String.Empty, "C-ECHO result") { echoImage, echoMessage };
root.Add(resultSection);
})
{ Alignment = UITextAlignment.Center, BackgroundColor = UIColor.Blue, TextColor = UIColor.White };
root = new RootElement("Echo DICOM server") {
new Section { hostEntry, portEntry, calledAetEntry, callingAetEntry},
new Section { echoButton },
};
var dvc = new DialogViewController (root, true) { Autorotate = true };
navigation.PushViewController (dvc, true);
}
示例4: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
paymentDelegate = new PaymentViewControllerDelegate ();
paymentDelegate.OnScanCompleted += (viewController, cardInfo) => {
if (cardInfo == null) {
elemCardNumber.Caption = "xxxx xxxx xxxx xxxx";
Console.WriteLine("Cancelled");
} else {
elemCardNumber.Caption = cardInfo.CardNumber;
}
ReloadData();
paymentViewController.DismissViewController(true, null);
};
elemCardNumber = new StyledStringElement ("xxxx xxxx xxxx xxxx");
Root = new RootElement ("card.io") {
new Section {
elemCardNumber,
new StyledStringElement("Enter your Credit Card", () => {
paymentViewController = new PaymentViewController(paymentDelegate);
paymentViewController.AppToken = "YOUR-APP-TOKEN";
NavigationController.PresentViewController(paymentViewController, true, null);
}) { Accessory = UITableViewCellAccessory.DisclosureIndicator }
}
};
}
示例5: ViewWillAppear
public override void ViewWillAppear(bool animated)
{
var logAsStr = String.Format ("welcome {0} {1}, you have {2} credits",
string.IsNullOrWhiteSpace (ConfigurationWorker.LastMessage) ? "" : "back",
RestManager.AuthenticationResult.FirstName,
RestManager.AuthenticationResult.NumberOfCredits);
loggedAsElement = new StyledMultilineElement (logAsStr);
loggedAsElement.Font = UIFont.SystemFontOfSize (11);
loggedAsElement.TextColor = UIColor.DarkGray;
loggedAsElement.Tapped += delegate{
NavigationController.PopViewControllerAnimated (animated:true);
};
_currentCamperStr = ConfigurationWorker.LastCamper.ToString ();
_currentCabinStr = ConfigurationWorker.LastCabin.ToString ();
_chooseCamper = new StyledStringElement ("camper", _currentCamperStr);
_chooseCamper.Accessory = UITableViewCellAccessory.DisclosureIndicator;
_chooseCamper.Tapped += () => NavigationController.PushViewController (new ChooseCamperScreen (), true);
_chooseCabin = new StyledStringElement ("bunk", _currentCabinStr);
_chooseCabin.Accessory = UITableViewCellAccessory.DisclosureIndicator;
_chooseCabin.Tapped += () => NavigationController.PushViewController (new ChooseCabinScreen (), true);
Root = GetRoot ();
base.ViewWillAppear (animated);
}
示例6: buildReport
public void buildReport()
{
Root = new RootElement ("");
var v = new UIView ();
v.Frame = new RectangleF (10, 10, 600, 10);
var dummy = new Section (v);
Root.Add (dummy);
var headerLabel = new UILabel (new RectangleF (10, 10, 800, 48)) {
Font = UIFont.BoldSystemFontOfSize (18),
BackgroundColor = ColorHelper.GetGPPurple (),
TextAlignment = UITextAlignment.Center,
TextColor = UIColor.White,
Text = "Owner Fee Target Progress"
};
var view = new UIViewBordered ();
view.Frame = new RectangleF (10, 20, 800, 48);
view.Add (headerLabel);
Root.Add (new Section (view));
// NumberFormatInfo nfi = new CultureInfo ("en-US", false).NumberFormat;
for (int i = 0; i < report.branches.Count; i++) {
Branch branch = report.branches [i];
Section s = new Section (branch.name);
//var t1 = new StringElement(branch.name + " Branch Totals");
//s.Add(t1);
Root.Add (s);
for (int j = 0; j < branch.owners.Count; j++) {
Owner o = branch.owners [j];
Section ownerSection = new Section (o.name);
ownerSection.Add (new BigFinanceElement ("Invoiced MTD Total: ", o.invoicedMTDTotal));
StyledStringElement recMTD = new StyledStringElement ("Recorded MTD");
recMTD.BackgroundColor = UIColor.LightGray;
recMTD.TextColor = UIColor.White;
ownerSection.Add (recMTD);
ownerSection.Add (getElement (o.recordedMTD.achieved, "Achieved: "));
ownerSection.Add (getElement (o.recordedMTD.estimatedTarget, "Estimated Target: "));
ownerSection.Add (getElement (o.recordedMTD.invoicedDebits, "Invoiced Debits: "));
ownerSection.Add (getElement (o.recordedMTD.unbilled, "Unbilled: "));
ownerSection.Add (getElement (o.recordedMTD.total, "Total: "));
//
StyledStringElement recYTD = new StyledStringElement ("Recorded YTD");
recYTD.BackgroundColor = UIColor.LightGray;
recYTD.TextColor = UIColor.White;
ownerSection.Add (recYTD);
ownerSection.Add (getElement (o.recordedYTD.achieved, "Achieved: "));
ownerSection.Add (getElement (o.recordedYTD.estimatedTarget, "Estimated Target: "));
ownerSection.Add (getElement (o.recordedYTD.invoiced, "Invoiced: "));
ownerSection.Add (getElement (o.recordedYTD.unbilled, "Unbilled: "));
ownerSection.Add (getElement (o.recordedYTD.total, "Total: "));
Root.Add (ownerSection);
}
}
for (var i = 0; i < 10; i++) {
Root.Add (new Section (" "));
}
}
示例7: Search
void Search (string what, string where)
{
var coord = here == null ? Parse (where) : here.Coordinate;
MKCoordinateSpan span = new MKCoordinateSpan (0.25, 0.25);
MKLocalSearchRequest request = new MKLocalSearchRequest ();
request.Region = new MKCoordinateRegion (coord, span);
request.NaturalLanguageQuery = what;
MKLocalSearch search = new MKLocalSearch (request);
search.Start (delegate (MKLocalSearchResponse response, NSError error) {
// this is executed in the application main thread
if (response == null || error != null)
return;
var section = new Section ("Search Results for " + what);
results.Clear ();
foreach (MKMapItem mi in response.MapItems) {
results.Add (mi);
var element = new StyledStringElement (mi.Name, mi.PhoneNumber, UITableViewCellStyle.Subtitle);
element.Accessory = UITableViewCellAccessory.DisclosureIndicator;
element.Tapped += () => { results [element.IndexPath.Row].OpenInMaps (); };
section.Add (element);
}
var root = new RootElement ("MapKit Search Sample") { section };
var dvc = new DialogViewController (root);
(window.RootViewController as UINavigationController).PushViewController (dvc, true);
});
}
示例8: ViewDidLoad
public override void ViewDidLoad()
{
Title = "Edit Issue";
base.ViewDidLoad();
var status = new StyledStringElement("Status", ViewModel.Status, UITableViewCellStyle.Value1);
status.Accessory = UITableViewCellAccessory.DisclosureIndicator;
status.Tapped += () =>
{
var ctrl = new IssueAttributesView(IssueModifyViewModel.Statuses, ViewModel.Status) { Title = "Status" };
ctrl.SelectedValue = x => ViewModel.Status = x.ToLower();
NavigationController.PushViewController(ctrl, true);
};
var delete = new StyledStringElement("Delete", () => ViewModel.DeleteCommand.Execute(null), Images.BinClosed) { BackgroundColor = UIColor.FromRGB(1.0f, 0.7f, 0.7f) };
delete.Accessory = UITableViewCellAccessory.None;
Root[0].Insert(1, UITableViewRowAnimation.None, status);
Root.Insert(Root.Count, UITableViewRowAnimation.None, new Section { delete });
ViewModel.Bind(x => x.Status, x => {
status.Value = x;
Root.Reload(status, UITableViewRowAnimation.None);
}, true);
}
示例9: ViewDidLoad
public override void ViewDidLoad()
{
Title = "Profile";
base.ViewDidLoad();
var header = new HeaderView();
var set = this.CreateBindingSet<ProfileView, ProfileViewModel>();
set.Bind(header).For(x => x.Title).To(x => x.Username).OneWay();
set.Bind(header).For(x => x.Subtitle).To(x => x.User.Name).OneWay();
set.Bind(header).For(x => x.ImageUri).To(x => x.User.AvatarUrl).OneWay();
set.Apply();
var followers = new StyledStringElement("Followers".t(), () => ViewModel.GoToFollowersCommand.Execute(null), Images.Heart);
var following = new StyledStringElement("Following".t(), () => ViewModel.GoToFollowingCommand.Execute(null), Images.Following);
var events = new StyledStringElement("Events".t(), () => ViewModel.GoToEventsCommand.Execute(null), Images.Event);
var organizations = new StyledStringElement("Organizations".t(), () => ViewModel.GoToOrganizationsCommand.Execute(null), Images.Group);
var repos = new StyledStringElement("Repositories".t(), () => ViewModel.GoToRepositoriesCommand.Execute(null), Images.Repo);
var gists = new StyledStringElement("Gists", () => ViewModel.GoToGistsCommand.Execute(null), Images.Script);
Root.Add(new [] { new Section(header), new Section { events, organizations, followers, following }, new Section { repos, gists } });
if (!ViewModel.IsLoggedInUser)
NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Action, (s, e) => ShowExtraMenu());
}
示例10: getEntryForKey
public StyledStringElement getEntryForKey(DateTime key)
{
StyledStringElement newExercise = new StyledStringElement (key.ToString() + " - " + this._rmLog[key].ToString(), () => { EditEntryScreen (key); });
newExercise.Accessory = UITableViewCellAccessory.DisclosureIndicator;
return newExercise;
}
示例11: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
RootElement root = Root;
root.UnevenRows = true;
_imageView = new UIImageView(View.Frame);
_messageElement = new StringElement("");
_button = new StyledStringElement("", delegate
{
if (OnButtonClick != null)
{
if (_progressView == null)
_progressView = new ProgressView();
_progressView.Show("Please wait",
delegate()
{
OnButtonClick(this, new EventArgs());
});
}
}
);
root.Add(new Section() {_button });
root.Add(new Section() {_messageElement});
root.Add(new Section() {_imageView});
}
示例12: DemoStyled
public void DemoStyled ()
{
var imageBackground = new Uri ("file://" + Path.GetFullPath ("background.png"));
var image = ImageLoader.DefaultRequestImage (imageBackground, null);
var small = image.Scale (new SizeF (32, 32));
var imageIcon = new StyledStringElement ("Local image icon") {
Image = small
};
var backgroundImage = new StyledStringElement ("Image downloaded") {
BackgroundUri = new Uri ("http://www.google.com/images/logos/ps_logo2.png")
};
var localImage = new StyledStringElement ("Local image"){
BackgroundUri = imageBackground
};
var backgroundSolid = new StyledStringElement ("Solid background") {
BackgroundColor = UIColor.Green
};
var colored = new StyledStringElement ("Colored", "Detail in Green") {
TextColor = UIColor.Yellow,
BackgroundColor = UIColor.Red,
DetailColor = UIColor.Green,
};
var sse = new StyledStringElement ("DetailDisclosureIndicator") { Accessory = UITableViewCellAccessory.DetailDisclosureButton };
sse.AccessoryTapped += delegate {
var alertController = UIAlertController.Create ("Accessory", "Accessory clicked", UIAlertControllerStyle.Alert);
alertController.AddAction (UIAlertAction.Create ("Ok", UIAlertActionStyle.Default, (obj) => { }));
window.RootViewController.PresentViewController (alertController, true, () => { });
};
var root = new RootElement("Styled Elements") {
new Section ("Image icon"){
imageIcon
},
new Section ("Background") {
backgroundImage, backgroundSolid, localImage
},
new Section ("Text Color"){
colored
},
new Section ("Cell Styles"){
new StyledStringElement ("Default", "Invisible value", UITableViewCellStyle.Default),
new StyledStringElement ("Value1", "Aligned on each side", UITableViewCellStyle.Value1),
new StyledStringElement ("Value2", "Like the Addressbook", UITableViewCellStyle.Value2),
new StyledStringElement ("Subtitle", "Makes it sound more important", UITableViewCellStyle.Subtitle),
new StyledStringElement ("Subtitle", "Brown subtitle", UITableViewCellStyle.Subtitle) {
DetailColor = UIColor.Brown
}
},
new Section ("Accessories"){
new StyledStringElement ("DisclosureIndicator") { Accessory = UITableViewCellAccessory.DisclosureIndicator },
new StyledStringElement ("Checkmark") { Accessory = UITableViewCellAccessory.Checkmark },
sse
}
};
var dvc = new DialogViewController (root, true);
navigation.PushViewController (dvc, true);
}
示例13: CreateTable
private void CreateTable()
{
var application = Mvx.Resolve<IApplicationService>();
var vm = (SettingsViewModel)ViewModel;
var currentAccount = application.Account;
var accountSection = new Section("Account");
accountSection.Add(new TrueFalseElement("Save Credentials".t(), !currentAccount.DontRemember, e =>
{
currentAccount.DontRemember = !e.Value;
application.Accounts.Update(currentAccount);
}));
var showOrganizationsInEvents = new TrueFalseElement("Show Organizations in Events".t(), currentAccount.ShowOrganizationsInEvents, e =>
{
currentAccount.ShowOrganizationsInEvents = e.Value;
application.Accounts.Update(currentAccount);
});
var showOrganizations = new TrueFalseElement("List Organizations in Menu".t(), currentAccount.ExpandOrganizations, e =>
{
currentAccount.ExpandOrganizations = e.Value;
application.Accounts.Update(currentAccount);
});
var repoDescriptions = new TrueFalseElement("Show Repo Descriptions".t(), currentAccount.ShowRepositoryDescriptionInList, e =>
{
currentAccount.ShowRepositoryDescriptionInList = e.Value;
application.Accounts.Update(currentAccount);
});
var startupView = new StyledStringElement("Startup View", vm.DefaultStartupViewName, MonoTouch.UIKit.UITableViewCellStyle.Value1)
{
Accessory = MonoTouch.UIKit.UITableViewCellAccessory.DisclosureIndicator,
};
startupView.Tapped += () => vm.GoToDefaultStartupViewCommand.Execute(null);
if (vm.PushNotificationsActivated)
accountSection.Add(new TrueFalseElement("Push Notifications".t(), vm.PushNotificationsEnabled, e => vm.PushNotificationsEnabled = e.Value));
var totalCacheSizeMB = vm.CacheSize.ToString("0.##");
var deleteCache = new StyledStringElement("Delete Cache".t(), string.Format("{0} MB", totalCacheSizeMB), MonoTouch.UIKit.UITableViewCellStyle.Value1);
deleteCache.Tapped += () =>
{
vm.DeleteAllCacheCommand.Execute(null);
deleteCache.Value = string.Format("{0} MB", 0);
ReloadData();
};
var usage = new TrueFalseElement("Send Anonymous Usage".t(), vm.AnalyticsEnabled, e => vm.AnalyticsEnabled = e.Value);
//Assign the root
var root = new RootElement(Title);
root.Add(accountSection);
root.Add(new Section("Appearance") { showOrganizationsInEvents, showOrganizations, repoDescriptions, startupView });
root.Add(new Section ("Internal") { deleteCache, usage });
Root = root;
}
示例14: Generate
private Element Generate(StudentGuideModel item)
{
var root=new RootElement(item.Title);
var section=new Section(item.Title);
root.Add (section);
if (item.Phone!="") {
var phoneStyle = new StyledStringElement("Contact Number",item.Phone) {
BackgroundColor=UIColor.FromRGB(71,165,209),
TextColor=UIColor.White,
DetailColor=UIColor.White,
};
phoneStyle.Tapped+= delegate {
UIAlertView popup = new UIAlertView("Alert","Do you wish to send a text or diall a number?",null,"Cancel","Text","Call");
popup.Show();
popup.Dismissed += delegate(object sender, UIButtonEventArgs e) {
if (e.ButtonIndex==1) {
MFMessageComposeViewController msg = new MFMessageComposeViewController();
msg.Recipients=new string[] {item.Phone};
this.NavigationController.PresentViewController(msg,true,null);
} else if (e.ButtonIndex==2) {
AppDelegate.getControl.calling(item.Phone);
};
};
};
section.Add(phoneStyle);
};
if (item.Email!="") {
var style = new StyledStringElement("Contact Email",item.Email) {
BackgroundColor=UIColor.FromRGB(71,165,209),
TextColor=UIColor.White,
DetailColor=UIColor.White,
};
style.Tapped += delegate {
MFMailComposeViewController email = new MFMailComposeViewController();
email.SetToRecipients(new string[] {item.Email});
this.NavigationController.PresentViewController(email,true,null);
};
section.Add (style);
}
if (item.Address!="") {
section.Add(new StyledMultilineElement(item.Address) {
BackgroundColor=UIColor.FromRGB(71,165,209),
TextColor=UIColor.White,
DetailColor=UIColor.White,
});
}
if (item.Description!="") {
section.Add (new StyledMultilineElement(item.Description) {
BackgroundColor=UIColor.FromRGB(71,165,209),
TextColor=UIColor.White,
DetailColor=UIColor.White,
Alignment=UITextAlignment.Center,
});
}
return root;
}
示例15: CreateStringElement
private StyledStringElement CreateStringElement(User user)
{
var element = new StyledStringElement(user.Name, user.UserInfo) {Accessory = UITableViewCellAccessory.DisclosureIndicator};
element.Tapped += () => OnUserSelected(user);
user.UserInfoUpdated += (sender, args) =>
{
element.Value = user.UserInfo;
element.Caption = user.Name;
Root.TableView.ReloadData();
};
return element;
}