本文整理汇总了C#中MonoTouch.Dialog.RootElement类的典型用法代码示例。如果您正苦于以下问题:C# RootElement类的具体用法?C# RootElement怎么用?C# RootElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RootElement类属于MonoTouch.Dialog命名空间,在下文中一共展示了RootElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreateMenu
/// <summary>
/// Invoked when it comes time to set the root so the child classes can create their own menus
/// </summary>
private void OnCreateMenu(RootElement root)
{
var addGistSection = new Section();
root.Add(addGistSection);
addGistSection.Add(new MenuElement("New Gist", () => {
var gistController = new CreateGistController();
gistController.Created = (id) => {
NavigationController.PushViewController(new GistInfoController(id), true);
};
var navController = new UINavigationController(gistController);
PresentViewController(navController, true, null);
}, Images.Buttons.NewGist));
var gistMenuSection = new Section() { HeaderView = new MenuSectionView("Gists") };
root.Add(gistMenuSection);
gistMenuSection.Add(new MenuElement("My Gists", () => NavigationController.PushViewController(new MyGistsController(), true), Images.Buttons.MyGists));
gistMenuSection.Add(new MenuElement("Starred", () => NavigationController.PushViewController(new StarredGistsController(), true), Images.Buttons.Star2));
gistMenuSection.Add(new MenuElement("Public", () => NavigationController.PushViewController(new PublicGistsController(), true), Images.Buttons.Public));
// var labelSection = new Section() { HeaderView = new MenuSectionView("Tags") };
// root.Add(labelSection);
// labelSection.Add(new MenuElement("Add New Tag", () => { }, null));
var moreSection = new Section() { HeaderView = new MenuSectionView("Info") };
root.Add(moreSection);
moreSection.Add(new MenuElement("About", () => NavigationController.PushViewController(new AboutController(), true), Images.Buttons.Info));
moreSection.Add(new MenuElement("Feedback & Support", () => {
var config = UserVoice.UVConfig.Create("http://gistacular.uservoice.com", "lYY6AwnzrNKjHIkiiYbbqA", "9iLse96r8yki4ZKknfHKBlWcbZAH9g8yQWb9fuG4");
UserVoice.UserVoice.PresentUserVoiceInterface(this, config);
}, Images.Buttons.Feedback));
moreSection.Add(new MenuElement("Logout", Logout, Images.Buttons.Logout));
}
示例2: ProvisioningDialog
public ProvisioningDialog()
: base(UITableViewStyle.Grouped, null)
{
Root = new RootElement ("GhostPractice Mobile");
var topSec = new Section ("Welcome");
topSec.Add (new StringElement ("Please enter activation code"));
activation = new EntryElement ("Code", "Activation Code", "999998-zcrdbrkqwogh");
topSec.Add (activation);
var submit = new StringElement ("Send Code");
submit.Alignment = UITextAlignment.Center;
submit.Tapped += delegate {
if (activation.Value == null || activation.Value == string.Empty) {
new UIAlertView ("Device Activation", "Please enter activation code", null, "OK", null).Show ();
return;
}
if (!isBusy) {
getAsyncAppAndPlatform ();
} else {
Wait ();
}
};
topSec.Add (submit);
Root.Add (topSec);
UIImage img = UIImage.FromFile ("Images/launch_small.png");
UIImageView v = new UIImageView (new RectangleF (0, 0, 480, 600));
v.Image = img;
Root.Add (new Section (v));
}
示例3: LoadTable
private void LoadTable()
{
var imageCount = Data.Database.Main.Table<ProjectImage>().Count();
var allPatternsButton = new StyledElement("All UI Images", imageCount.ToString(), UITableViewCellStyle.Value1);
if (imageCount > 0)
{
allPatternsButton.Accessory = UITableViewCellAccessory.DisclosureIndicator;
allPatternsButton.Tapped += () => NavigationController.PushViewController(new LocalViewPatternsViewController() { Title = "All" }, true);
}
var section = new Section("Albums");
var projects = Data.Database.Main.Table<Project>();
foreach (var p in projects)
{
var project = p;
var element = new ProjectElement(project);
if (Data.Database.Main.Table<ProjectImage>().Where(a => a.ProjectId == project.Id).Count() > 0)
{
element.Accessory = UITableViewCellAccessory.DisclosureIndicator;
element.Tapped += () => {
NavigationController.PushViewController(new LocalViewPatternsViewController(project.Id) { Title = project.Name }, true);
};
}
section.Add(element);
}
var root = new RootElement(Title) { new Section() { allPatternsButton }, section };
Root = root;
}
示例4: LoginViewController
public LoginViewController()
: base (UITableViewStyle.Grouped, null)
{
var defaults = NSUserDefaults.StandardUserDefaults;
string mobileServiceUri = defaults.StringForKey (MobileServiceUriKey);
string mobileServiceKey = defaults.StringForKey (MobileServiceKeyKey);
string tags = defaults.StringForKey (TagsKey);
this.uriEntry = new EntryElement (null, "Mobile Service URI", mobileServiceUri);
this.keyEntry = new EntryElement (null, "Mobile Service Key", mobileServiceKey);
this.tagsEntry = new EntryElement (null, "Tags", tags);
Root = new RootElement ("C# Client Library Tests") {
new Section ("Login") {
this.uriEntry,
this.keyEntry,
this.tagsEntry
},
new Section {
new StringElement ("Run Tests", RunTests)
},
new Section{
new StringElement("Login with Microsoft", () => Login(MobileServiceAuthenticationProvider.MicrosoftAccount)),
new StringElement("Login with Facebook", () => Login(MobileServiceAuthenticationProvider.Facebook)),
new StringElement("Login with Twitter", () => Login(MobileServiceAuthenticationProvider.Twitter)),
new StringElement("Login with Google", () => Login(MobileServiceAuthenticationProvider.Google))
}
};
}
示例5: 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 = "Branch Matter Analysis"
};
var view = new UIViewBordered ();
view.Frame = new RectangleF (10, 20, 800, 48);
view.Add (headerLabel);
Root.Add (new Section (view));
//
for (int i = 0; i < report.branches.Count; i++) {
Branch branch = report.branches [i];
Section s = new Section (branch.name + " Branch Totals");
Root.Add (s);
//
if (branch.branchTotals.matterActivity != null) {
var matterActivitySection = new Section ();
var mTitle = new TitleElement ("Matter Activity");
matterActivitySection.Add (mTitle);
matterActivitySection.Add (new NumberElement (branch.branchTotals.matterActivity.active, "Active Matters: "));
matterActivitySection.Add (new NumberElement (
branch.branchTotals.matterActivity.deactivated,
"Deactivated Matters: "
));
matterActivitySection.Add (new NumberElement (branch.branchTotals.matterActivity.newWork, "New Work: "));
matterActivitySection.Add (new NumberElement (branch.branchTotals.matterActivity.workedOn, "Worked On: "));
matterActivitySection.Add (new NumberElement (branch.branchTotals.matterActivity.noActivity, "No Activity: "));
matterActivitySection.Add (new StringElement ("No Activity Duration: " + branch.branchTotals.matterActivity.noActivityDuration));
Root.Add (matterActivitySection);
}
//
if (branch.branchTotals.matterBalances != null) {
var matterBalancesSection = new Section ();
var mTitle = new TitleElement ("Matter Balances");
matterBalancesSection.Add (mTitle);
matterBalancesSection.Add (getElement (branch.branchTotals.matterBalances.business, S.GetText (S.BUSINESS) + ": "));
matterBalancesSection.Add (getElement (branch.branchTotals.matterBalances.trust, S.GetText (S.TRUST_BALANCE) + ": "));
matterBalancesSection.Add (getElement (branch.branchTotals.matterBalances.investment, S.GetText (S.INVESTMENTS) + ": "));
matterBalancesSection.Add (getElement (branch.branchTotals.matterBalances.unbilled, "Unbilled: "));
matterBalancesSection.Add (getElement (branch.branchTotals.matterBalances.pendingDisbursements, "Pending Disb.: "));
Root.Add (matterBalancesSection);
}
}
for (var i = 0; i < 10; i++) {
Root.Add (new Section (" "));
}
}
示例6: ButtonSwitcher
public void ButtonSwitcher ()
{
if (DBAccountManager.SharedManager.LinkedAccount == null) {
Root = new RootElement ("DropBox Sync") {
new Section (){
new StringElement ("Link Account", () => DBAccountManager.SharedManager.LinkFromController (NavigationController)) {
Alignment = UITextAlignment.Center
}
}
};
} else {
Root = new RootElement ("DropBox Sync") {
new Section () {
new StringElement ("Unlink Account", () => {
DBAccountManager.SharedManager.LinkedAccount.Unlink ();
ButtonSwitcher ();
}) { Alignment = UITextAlignment.Center },
new StringElement ("Show DropBox Files", () => {
filesController = new DVCFiles (DBPath.Root);
NavigationController.PushViewController (filesController, true);
}) { Alignment = UITextAlignment.Center }
}
};
}
}
示例7: SettingsViewController
public SettingsViewController()
: base(new RootElement("Einstellungen"))
{
var root = new RootElement("Einstellungen");
var userEntry = new EntryElement("Benutzername", "benutzername", ApplicationSettings.Instance.UserCredentials.Name);
var passwordEntry = new EntryElement("Passwort", "passwort", ApplicationSettings.Instance.UserCredentials.Password, true);
userEntry.AutocorrectionType = MonoTouch.UIKit.UITextAutocorrectionType.No;
userEntry.AutocapitalizationType = MonoTouch.UIKit.UITextAutocapitalizationType.None;
userEntry.Changed += UsernameChanged;
passwordEntry.Changed += PasswordChanged;
root.Add(new Section("Benutzerinformationen"){
userEntry,
passwordEntry
});
root.Add(new Section("Stundenplaneinstellungen"){
new StyledStringElement("Andere Stundenpläne", () => {NavigationController.PushViewController(new SettingsTimetablesDetailViewController(), true);}){
Accessory = UITableViewCellAccessory.DisclosureIndicator
}
});
Root = root;
Title = "Einstellungen";
NavigationItem.Title = "Einstellungen";
TabBarItem.Image = UIImage.FromBundle("Settings-icon");
}
示例8: FinishedLaunching
// This method is invoked when the application has loaded its UI and its ready to run
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
var Last = new DateTime (2010, 10, 7);
Console.WriteLine (Last);
window.AddSubview (navigation.View);
var menu = new RootElement ("Demos"){
new Section ("Element API"){
new StringElement ("iPhone Settings Sample", DemoElementApi),
new StringElement ("Dynamically load data", DemoDynamic),
new StringElement ("Add/Remove demo", DemoAddRemove),
new StringElement ("Assorted cells", DemoDate),
},
new Section ("Auto-mapped", footer){
new StringElement ("Reflection API", DemoReflectionApi)
},
new Section ("Other"){
new StringElement ("Headers and Footers", DemoHeadersFooters)
}
};
var dv = new DialogViewController (menu);
navigation.PushViewController (dv, true);
window.MakeKeyAndVisible ();
return true;
}
示例9: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
var hockey = BITHockeyManager.SharedHockeyManager;
Root = new RootElement ("HockeyApp Sample") {
new Section {
new StringElement("Check for Updates", () => {
hockey.UpdateManager.CheckForUpdate();
}),
new StringElement("Show Feedback", () => {
hockey.FeedbackManager.ShowFeedbackListView();
}),
new StringElement("Submit New Feedback", () => {
hockey.FeedbackManager.ShowFeedbackComposeView();
}),
new StringElement("Crashed Last Run:", hockey.CrashManager.DidCrashInLastSession.ToString())
},
new Section {
new StringElement("Throw Managed .NET Exception", () => {
throw new HockeyAppSampleException("You intentionally caused a crash!");
})
}
};
}
示例10: FoundResults
private void FoundResults(ParseObject[] array, NSError error)
{
var easySection = new Section("Easy");
var mediumSection = new Section("Medium");
var hardSection = new Section("Hard");
var objects = array.Select(x=> x.ToObject<GameScore>()).OrderByDescending(x=> x.Score).ToList();
foreach(var score in objects)
{
var element = new StringElement(score.Player,score.Score.ToString("#,###"));
switch(score.Dificulty)
{
case GameDificulty.Easy:
easySection.Add(element);
break;
case GameDificulty.Medium:
mediumSection.Add(element);
break;
case GameDificulty.Hard:
hardSection.Add (element);
break;
}
}
Root = new RootElement("High Scores")
{
easySection,
mediumSection,
hardSection,
};
}
示例11: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
var vm = (AboutViewModel)ViewModel;
var root = new RootElement(Title)
{
new Section
{
new MultilinedElement("CodeHub".t()) { Value = About, CaptionColor = Theme.CurrentTheme.MainTitleColor, ValueColor = Theme.CurrentTheme.MainTextColor }
},
new Section
{
new StyledStringElement("Source Code".t(), () => vm.GoToSourceCodeCommand.Execute(null))
},
new Section(String.Empty, "Thank you for downloading. Enjoy!")
{
new StyledStringElement("Follow On Twitter".t(), () => UIApplication.SharedApplication.OpenUrl(new NSUrl("https://twitter.com/CodeHubapp"))),
new StyledStringElement("Rate This App".t(), () => UIApplication.SharedApplication.OpenUrl(new NSUrl("https://itunes.apple.com/us/app/codehub-github-for-ios/id707173885?mt=8"))),
new StyledStringElement("App Version".t(), vm.Version)
}
};
root.UnevenRows = true;
Root = root;
}
示例12: ConfigureRoot
private void ConfigureRoot()
{
TableView.BackgroundColor = UIColor.Clear;
var root = new RootElement("Home")
{
new Section()
{
new StringElement("Heading Element") { CssClass = "heading" }
},
new Section()
{
new ImageStringElement("Detailed Item", "This should be orange", null),
new ImageStringElement("Detailed Item", "This should be all green", null) { CssClass = "Green" },
},
new Section()
{
new RootElement("Radio Items", new RadioGroup(0))
{
new Section("", "", "Radio")
{
new RadioElement("Radio Item 1"),
new RadioElement("Radio Item 2"),
new RadioElement("This should be big") { CssClass = "Heading" }
}
}
}
};
root.CssClass = "Root";
Root = root;
}
示例13: ViewDidLoad
public override void ViewDidLoad() {
base.ViewDidLoad();
_MainSection = new Section() {
new ActivityElement()
};
Root = new RootElement("Markers") {
_MainSection
};
// Simple demo of a progress HUD. Doesn't actually do anything useful.
// Added after question from audience.
MTMBProgressHUD progress = new MTMBProgressHUD() {
DimBackground = true,
LabelText = "Doing something.",
};
View.Add(progress);
progress.Show(animated: true);
Task.Factory.StartNew(() => {
Thread.Sleep(2000);
InvokeOnMainThread(() => {
progress.Hide(animated: true);
});
});
mapController = new MapViewController();
mapController.NewMarkerCreated += (object sender, MarkerAddedEventArgs e) => {
InvokeOnMainThread(() => {
_Database.SaveMarker(e.MarkerInfo);
RefreshMarkers();
});
};
RefreshMarkers();
}
示例14: LoadTimetable
private void LoadTimetable(Timetable timetable)
{
UIApplication.SharedApplication.InvokeOnMainThread(() =>
{
_pageScrollController.Clear();
if (timetable.BlockedTimetable)
{
var root = new RootElement("Blockiert"){
new Section("Blockiert"){
new MultilineElement("Benutzer hat Stundenplan\nblockiert")
}
};
var dvc = new DefaultDialogViewController(root, UITableViewStyle.Plain, RefreshRequested);
dvc.CustomLastUpdate = timetable.LastUpdated;
_pageScrollController.AddPage(dvc);
}
else if (timetable.HasError)
{
var root = new RootElement("Error"){
new Section("Error"){
new MultilineElement(timetable.ErrorMessage)
}
};
var dvc = new DefaultDialogViewController(root, UITableViewStyle.Plain, RefreshRequested);
dvc.CustomLastUpdate = timetable.LastUpdated;
_pageScrollController.AddPage(dvc);
}
else
{
foreach (var day in timetable.TimetableDays)
{
if (day.Lessions.Count() == 0)
continue;
var root = new RootElement((string.IsNullOrEmpty(day.Weekday) ? "Ohne Wochentag" : day.Weekday));
foreach (var lession in day.Lessions)
{
var section = new Section(lession.Name + " " + lession.Type);
foreach (var alloc in lession.CourseAllocations)
{
string t = alloc.Timeslot;
if (alloc.RoomAllocations.Count() > 0)
t += "\n" + alloc.RoomAllocations.FirstOrDefault().Roomnumber;
var tmpLession = new Lession(){CourseAllocations=lession.CourseAllocations,
Lecturers=lession.Lecturers,
Name=lession.Name,
Type=lession.Type};
section.Add(new MultilineElement(t, () => {
OnElementTappet(tmpLession);}){Value=lession.LecturersShortVersion});
}
root.Add(section);
}
var dvc = new DefaultDialogViewController(root, UITableViewStyle.Plain, RefreshRequested);
dvc.CustomLastUpdate = timetable.LastUpdated;
_pageScrollController.AddPage(dvc);
}
}
});
_loadedTimetable = timetable;
}
示例15: CreateDynamicContent
// Creates the dynamic content from the twitter results
RootElement CreateDynamicContent (XDocument doc)
{
var users = doc.XPathSelectElements ("./statuses/status/user").ToArray ();
var texts = doc.XPathSelectElements ("./statuses/status/text").Select (x=>x.Value).ToArray ();
var people = doc.XPathSelectElements ("./statuses/status/user/name").Select (x=>x.Value).ToArray ();
var section = new Section ();
var root = new RootElement ("Tweets") { section };
for (int i = 0; i < people.Length; i++){
var line = new RootElement (people [i]) {
new Section ("Profile"){
new StringElement ("Screen name", users [i].XPathSelectElement ("./screen_name").Value),
new StringElement ("Name", people [i]),
new StringElement ("oFllowers:", users [i].XPathSelectElement ("./followers_count").Value)
},
new Section ("Tweet"){
new StringElement (texts [i])
}
};
section.Add (line);
}
return root;
}