Skip to content

Instantly share code, notes, and snippets.

@prashantvc
Created September 23, 2013 11:41
Show Gist options
  • Save prashantvc/6669380 to your computer and use it in GitHub Desktop.
Save prashantvc/6669380 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.Dialog;
namespace LinqMtd
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
// class-level declarations
UIWindow window;
UINavigationController navigation;
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// create a new window instance based on the screen size
window = new UIWindow (UIScreen.MainScreen.Bounds);
var mSerachResults = new [] {
new { SectionName = "Section1", PrdDescription = "Description1"},
new { SectionName = "Section1", PrdDescription = "Description12"},
new { SectionName = "Section2", PrdDescription = "Description21"},
new { SectionName = "Section3", PrdDescription = "Description31"},
};
var re = new RootElement ("Test") {
from sr in mSerachResults
group sr by sr.SectionName into g
let sections = new Section (g.Key)
let a = sections.AddAll(g.Select(p=>new StringElement(p.PrdDescription)))
select sections
};
var dv = new DialogViewController (re) {
Autorotate = true
};
navigation = new UINavigationController ();
navigation.PushViewController (dv, true);
// If you have defined a root view controller, set it here:
window.RootViewController = navigation;
// make the window visible
window.MakeKeyAndVisible ();
return true;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment