コード例 #1
0
		// Load the list of lists and setup their events
		private Task RefreshAsync()
		{
			AppDelegate.AddActivity();

			return this.db.Table<List>().ToListAsync().ContinueWith (t => {
				if (t.Exception != null) {
					BeginInvokeOnMainThread (ReloadComplete);
					AppDelegate.FinishActivity();
					ShowError (t.Exception.Flatten().InnerException);
					return;
				}

				Section section = new Section();
				section.AddAll (t.Result.Select (l =>
					new StringElement (l.Name, () => {
						var tasks = new TasksViewController (this.db, l);
						NavigationController.PushViewController (tasks, true);
					})
				).Cast<Element>());

				InvokeOnMainThread (() => {
					Root.Clear();
					Root.Add (section);

					ReloadComplete();

					AppDelegate.FinishActivity();
				});
			});
		}
コード例 #2
0
        public OptionsRootElement(Model.Options options)
            : base("Bedside Clock")
        {
            customFontNames = new string[] { "LCDMono" };
            standardFontNames = UIFont.FamilyNames.OrderBy(f => f).ToArray();

            use24Hour = new BooleanElement("24 hour", options.Use24Hour);
            showSeconds = new BooleanElement("Seconds", options.ShowSeconds);
            fontGroup = new RadioGroup(GetIndexForSelectedFont(options.Font));

            var customFontSection = new Section("Custom");
            customFontSection.AddAll(customFontNames.Select(f => new FontEntryElement(f)));

            var fontSection = new Section("Standard Fonts");
            fontSection.AddAll(standardFontNames.Select(f => new FontEntryElement(f)));

            Add(new Section("Clock Display") {
                new StringElement("Color", "Green"),
                new RootElement("Font", fontGroup) { customFontSection, fontSection },
                use24Hour,
                showSeconds
            });
            Add(new Section("Brightness") {
                new FloatElement(null, null, 0.5f)
            });
        }
コード例 #3
0
ファイル: OrderView.cs プロジェクト: rvdplas/QuickCross
        public OrderView(IntPtr handle)
            : base(handle)
        {
            Pushing = true;

            var deliveryLocationList = new Section();
            deliveryLocationList.AddAll(from i in ViewModel.DeliveryLocationList select new RadioElement(i));

            var titleList = new Section();
            titleList.AddAll(from i in ViewModel.TitleList select new RadioElement(i));

            var m = ViewModel;
            Root = new RootElement("Order") {
                new Section() {
                    new RootElement("Deliver", new RadioGroup(0)) {
                        deliveryLocationList }                    .Bind(bp, () => m.DeliveryLocation, listProperty: () => m.DeliveryLocationList)
                },
                new Section() {
                    new RootElement("Title", new RadioGroup(0)) {
                        titleList }                               .Bind(bp, () => m.Title, listProperty: () => m.TitleList),
                    new EntryElement("Name"   , "First name", "") .Bind(bp, () => m.FirstName), // Note that you MUST specify "" for the initial element value; any other value will update the viewmodel property in a 2-way binding.
                    new EntryElement(null     , "Middle name", "").Bind(bp, () => m.MiddleName),
                    new EntryElement(null     , "Last name", "")  .Bind(bp, () => m.LastName),
                    new EntryElement("Address", "Street", "")     .Bind(bp, () => m.Street),
                    new EntryElement(null     , "Zip", "")        .Bind(bp, () => m.Zip),
                    new EntryElement(null     , "City", "")       .Bind(bp, () => m.City),
                    new EntryElement(null     , "Country", "")    .Bind(bp, () => m.Country),
                    new EntryElement("Email"  , "", "")           .Bind(bp, () => m.Email),
                    new EntryElement("Mobile" , "", "")           .Bind(bp, () => m.Mobile),
                    new EntryElement("Phone"  , "", "")           .Bind(bp, () => m.Phone)
                }
            };
        }
コード例 #4
0
ファイル: TEMP.cs プロジェクト: semuserable/Cloud9
        public PopoverContentViewController(SizeF contentSizeForViewInPopover)
        {
            _contentSizeForViewInPopover = contentSizeForViewInPopover;

            QuickFillCore quickFillCore = QuickFillManager.GetQuickFillCore ();
            var quickFillNames = quickFillCore.QuickFillNames;

            var styleHeaderElement = new Section ("Style Header") {
                new RootElement ("Manual Entry", rt => GetNewDialog(StyleEntityManager.GetManualEntry()))
            };

            var quickFillElement = new Section ("Quick Fill");
            var quickFills = StyleEntityManager.GetQuickFills (quickFillCore);

            var styleDialogs = new List<RootElement> ();
            for (int i = 0; i < quickFillNames.Count; i++)
            {
                var style = GetNewDialog (quickFills [i]);
                var rootElement = new RootElement (quickFillNames [i], rt => style);
                styleDialogs.Add (rootElement);
            }
            quickFillElement.AddAll (styleDialogs);

            var rootStyles = new RootElement ("Add New Styles");
            rootStyles.Add (new [] { styleHeaderElement, quickFillElement });

            var rootDialog = new DialogViewController (rootStyles);
            rootDialog.NavigationItem.SetLeftBarButtonItem (new UIBarButtonItem ("Cancel", UIBarButtonItemStyle.Bordered, HandlePopoverCancelledEvent), true);

            this.SetViewControllers (new [] { rootDialog }, true);
        }
コード例 #5
0
ファイル: AppDelegate.cs プロジェクト: Celderon/oxyplot
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching (UIApplication app, NSDictionary options)
        {
            exampleInfoList = ExampleLibrary.Examples.GetList();

            // create a new window instance based on the screen size
            window = new UIWindow (UIScreen.MainScreen.Bounds);

            navigation = new UINavigationController();

            var root = new RootElement ("OxyPlot Example Browser");
            var section = new Section ();
            section.AddAll (exampleInfoList
                .GroupBy (e => e.Category)
                .OrderBy (g => g.Key)
                .Select (g =>
                    (Element)new StyledStringElement (g.Key, delegate {
                        DisplayCategory (g.Key);
                    }) { Accessory = UITableViewCellAccessory.DisclosureIndicator }));
            root.Add (section);

            var dvc = new DialogViewController (root, true);

            navigation.PushViewController(dvc, true);

            window.RootViewController = navigation;

            // make the window visible
            window.MakeKeyAndVisible ();

            return true;
        }
コード例 #6
0
ファイル: AppDelegate.cs プロジェクト: EmiiFont/MyShuttle_RC
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);

            // open a new storage group with name "Demo" --- this is even possible
            // in code which is shared between Android and iOS because EditGroup is
            // a property holding a delegate which creates a plattform specific
            // instance
            var storage = SimpleStorage.EditGroup("Demo");

            // loading key "app_launches" with an empty string as default value
            var appLaunches = storage.Get("app_launches", "").Split(',').ToList();

            // adding a new timestamp to list to show that SimpleStorage is working
            appLaunches.Add(DateTime.Now.ToString());

            // save the value with key "app_launches" for next application start
            storage.Put("app_launches", String.Join(",", appLaunches));

            // simple presentation of the timestamp list with MonoTouch.Dialog
            var section = new Section();
            section.AddAll(from l in appLaunches where !String.IsNullOrEmpty(l) select new StringElement(l));
            window.RootViewController = new DialogViewController(new RootElement("SimpleStorage Demo") {
                section
            });
            
            window.MakeKeyAndVisible();
            
            return true;
        }
コード例 #7
0
        public DatePickerDemoViewController()
            : base(UITableViewStyle.Grouped, new RootElement ("Demo"), true)
        {
            //NOTE: ENSURE THAT ROOT.UNEVENROWS IS SET TO TRUE
            // OTHERWISE THE DatePickerElement.Height function is not called
            Root.UnevenRows = true;

            // Create section to hold date picker
            Section section = new Section ("Date Picker Test");

            // Create elements
            StringElement descriptionElement = new StringElement ("This demo shows how the date picker works within a section");
            DatePickerElement datePickerElement = new DatePickerElement ("Select date", section, DateTime.Now, UIDatePickerMode.DateAndTime);
            EntryElement entryElement = new EntryElement ("Example entry box", "test", "test");
            StringElement buttonElement = new StringElement ("Reset Date Picker", () => {
                // This is how you can set the date picker after it has been created
                datePickerElement.SelectedDate = DateTime.Now;
            });
            StringElement buttonFinalElement = new StringElement ("Show Selected Date", () => {
                // This is how you can access the selected date from the date picker
                entryElement.Value = datePickerElement.SelectedDate.ToString();
            });

            // Add to section
            section.AddAll (new Element[] { descriptionElement, datePickerElement, entryElement, buttonElement, buttonFinalElement });

            // Add section to root
            Root.Add (section);
        }
コード例 #8
0
        public ParentListPickerElement(string caption, Item list)
            : base(caption, new RadioGroup(null, 0))
        {
            lists = new List<Item>();
            foreach (var f in App.ViewModel.Folders.OrderBy(f => f.SortOrder))
            {
                lists.Add(new Item() { Name = f.Name, FolderID = f.ID, ID = Guid.Empty });
                var s = new Section() { new RadioElement(f.Name, f.Name) };
                // get all the lists in this folder except for the current list (if passed in)
                var folderlists = f.Items.
                    Where(li => li.IsList == true && li.ItemTypeID != SystemItemTypes.Reference && (list == null || li.ID != list.ID)).
                    OrderBy(li => li.Name).ToList();
                foreach (var l in folderlists)
                    lists.Add(l);
                var radioButtons = folderlists.Select(li => (Element) new RadioElement("        " + li.Name, f.Name)).ToList();
                s.AddAll(radioButtons);
                this.Add(s);
            };

            Item thisList = null;
            Guid listID = list != null && list.ParentID != null ? (Guid) list.ParentID : Guid.Empty;
            if (list != null && lists.Any(li => li.FolderID == list.FolderID && li.ID == listID))
                thisList = lists.First(li => li.FolderID == list.FolderID && li.ID == listID);

            this.RadioSelected = thisList != null ? Math.Max(lists.IndexOf(thisList, 0), 0) : 0;
        }
コード例 #9
0
		RootElement BuildMoviesElement()
		{
			var element = new RootElement ("Movies");
			var section = new Section ("Recorded At");
			section.AddAll (GetMediaElements (rootVideoPath, MediaFileType.Movie));
			element.Add (section);
			return element;
		}
コード例 #10
0
		private RootElement buildMoviesElement()
		{
			RootElement element = new RootElement("Movies");
			Section section = new Section("Recorded At");
			section.AddAll( getMediaElements(this.rootVideoPath, MediaFileType.Movie ) );
			element.Add( section );
			return element;
		}
コード例 #11
0
		RootElement BuildImagesElement ()
		{
			var element = new RootElement ("Images");
			var section = new Section ("Captured At");
			section.AddAll (GetMediaElements (rootImagePath, MediaFileType.Image));
			element.Add (section);
			return element;
		}
コード例 #12
0
		protected void PopulateTable()
		{
			tasks = TaskManager.GetTasks().ToList ();
			var rows = from t in tasks
				select (Element)new StringElement ((t.Name == "" ? "<new task>" : t.Name), t.Notes);
			var s = new Section ();
			s.AddAll(rows);
			Root = new RootElement("Tasky") {s}; 
		}
コード例 #13
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            var root = new RootElement(Title);
            var accountSection = new Section();
            accountSection.AddAll(PopulateAccounts());
            root.Add(accountSection);
            Root = root;
        }
コード例 #14
0
ファイル: SettingsView.cs プロジェクト: sbondini/BleChat
        private RootElement GetStatusRootView()
        {
            var statusNames = Enum.GetNames(typeof(UserStatuses));
            var radioElements = statusNames.Select(name => new RadioElement(name)).ToList();

            var radioSection = new Section();
            radioSection.AddAll(radioElements);

            return new RootElement("Status", _statusRadioGroup = new RadioGroup(_settings.StatusId)) {radioSection};
        }
コード例 #15
0
		protected void PopulateTable()
		{
			tasks = TodoItemManager.GetTasks().ToList ();
//			var rows = from t in tasks
//				select (Element)new StringElement ((t.Name == "" ? "<new task>" : t.Name), t.Notes);
			// TODO: use this element, which displays a 'tick' when item is completed
			var rows = from t in tasks
				select (Element)new CheckboxElement ((t.Name == "" ? "<new task>" : t.Name), t.Done);
			var s = new Section ();
			s.AddAll(rows);
			Root = new RootElement("Tasky") {s}; 
		}
コード例 #16
0
 protected void PopulateTable(bool remove)
 {
     _items = new List<TimingItem> (); // _timingItemManager.Items.ToList ();
     if (remove)
         foreach (var item in _items)
             _details.Remove (item.StartNumber);
     var rows = from t in _items
         orderby t.Time descending
         select (Element)new StringElement (String.Format("{0} : {1}", t.StartNumber, t.Time.ToString("HH:mm:ss.fff")), t.Notes);
     var s = new Section ();
     s.AddAll(rows);
     Root = new RootElement (string.Format ("{0}/{1}: {2} crews", _popover.Location, _popover.Secret, _items.Count)) { s };
 }
コード例 #17
0
        public MasterController()
            : base(null)
        {
            var layoutSection = new Section ();

            layoutSection.AddAll (
                from layout in layouts
                select (Element)new StringElement (layout, () => {
                if (LayoutSelected != null)
                    LayoutSelected (this, new LayoutSelectedEventArgs{LayoutName = layout});
            }));

            Root = new RootElement ("Layouts") { layoutSection };
        }
コード例 #18
0
		protected void PopulateTable ()
		{
			tasks = BL.Managers.TaskManager.GetTasks ().ToList ();
			var newTaskDefaultName = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("<new task>", "<new task>");
			// make into a list of MT.D elements to display
			List<Element> le = new List<Element>();
			foreach (var t in tasks) 
				le.Add (new StringElement((t.Name== "" ? newTaskDefaultName : t.Name), t.Notes));
			// add to section
			var s = new Section ();
			s.AddAll (le);
			// add as root
			Root = new RootElement ("Tasky") { s }; 
		}
コード例 #19
0
		protected void PopulateTable()
		{
			if (tasks == null)
				tasks = new List<Todo> (); 
			// make the CloudMine call via service (aync) and add the sections
			TodoService.GetTodos ().ContinueWith (res => {
				tasks = res.Result.Success.Values.ToList();
				var rows = from t in tasks
				          select (Element)new StringElement ((t.Name == "" ? "<new task>" : t.Name), t.Notes);
				var s = new Section ();
				s.AddAll (rows);
				Root = new RootElement ("Tasky") { s }; 
			});
		}
コード例 #20
0
ファイル: TaskListScreen.cs プロジェクト: AranHu/TaskCloud
		public void Reload() {
			Console.WriteLine ("Reload MonoTouch.Dialog");
		
			var tasklist = from task in tasks
				orderby task.Title
					select (Element)new TickElement (task.Title, task.IsDone, () => {
				var ts = new TaskScreen (task, this);
				NavigationController.PushViewController (ts, true);
			});

			var s = new Section ();
			s.AddAll (tasklist);

			Root = new RootElement ("TaskyParse") { s };
		}
コード例 #21
0
        public void PopulateResults(IEnumerable<Element> elements)
        {
            // Simulate WS call by sleeping for 5 seconds
            Thread.Sleep (5000);

            BeginInvokeOnMainThread(() => {
                Section section = new Section("Search Results");
                section.AddAll(elements);

                Root = new RootElement(Title){
                    section
                };

                TableView.ReloadData();
                TableView.SetNeedsDisplay ();
            });
        }
コード例 #22
0
ファイル: AppDelegate.cs プロジェクト: Celderon/oxyplot
        private void DisplayCategory(string category)
        {
            var root = new RootElement (category);
            var section = new Section ();
            section.AddAll (exampleInfoList
                .Where (e => e.Category == category)
                .OrderBy (e => e.Title)
                .Select (e => (Element)new StyledStringElement (e.Title, delegate {
                GraphView (e);
            }) { Accessory = UITableViewCellAccessory.DisclosureIndicator }
            ));
            root.Add (section);

            var dvc = new DialogViewController (root, true);

            navigation.PushViewController (dvc, true);
        }
コード例 #23
0
        public OccurrencesSection(CheckPoint checkpoint,iCheckpointCommandController Controller,CheckPointDetailDialog dialog)
        {
            this.Caption= "Completions:";
            this.Footer = "Tap to remove.";

            var occurenceElements =
                checkpoint
                    .AllOccurrences
                    .OrderByDescending (o => o.TimeStamp)
                    .Select (o => new StringElement (o.Date.ToString ("d")  + (o.IsSkipped?" (Skipped)":""),
                        ()=>{
                            var c = SharedDialogs.ConfirmationDialog(
                                (a)=>
                                {
                                    checkpoint.RemoveOccurrence(o);
                                    Controller.RewriteOccurrences();
                                    dialog.Render();
                                },Message:"Deleting this completion will affect averages and streaks.");
                            dialog.PresentModalViewController(c,true);
                        })
                        {
                            Value= o.TimeStamp.ToString ("t")
                        })
                    .ToList();
            this.AddAll (occurenceElements.Take(5));

            if (occurenceElements.Count > 5)
                this.Add (new StringElement ("All Completions",
                    ()=>{
                        var r = new RootElement(checkpoint.Name);
                        var s = new Section("All Completions");
                        r.Add(s);
                        s.AddAll(
                            occurenceElements.Select(o=>
                                {
                                    o.Tapped+=()=>
                                    {r.Reload(s,UITableViewRowAnimation.Automatic);};
                                    return o;
                                }
                            ));
                        dialog.moreDialog = new DialogViewController(r,true);
                        dialog.NavigationController.PushViewController(dialog.moreDialog,true);
                    }
                ){ Alignment = UITextAlignment.Center });
        }
コード例 #24
0
		public EventListController ( EKCalendarItem[] events, EKEntityType eventType )
			: base ( UITableViewStyle.Plain, null, true)
		{
			this.events = events;
			this.eventType = eventType;

			Section section;
			if (events == null) {
				section = new Section () { new StringElement ("No calendar events") };
			} else {
				section = new Section ();
				section.AddAll (
					from items in this.events
					select new StringElement (items.Title)
				);
			}
			itemListRoot.Add (section);
			// set our element root
			this.InvokeOnMainThread ( () => { this.Root = itemListRoot; } );
		}
コード例 #25
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var msgs = Controller.Notifier
                .ScheduledNotifications
                .Select(n => new MessageElement()
                {
                    Body = n.AlertBody,
                    Subject = n.Category,
                    Date = n.FireDate.ToDateTime().ToLocalTime(),
                    Sender = n.AlertTitle,
                    MessageCount = 1,
                    NewFlag = false
                });

            var msglist = new Section("current");

            msglist.AddAll(msgs);
            Root.Add(msglist);
        }
コード例 #26
0
 public ItemTypePickerElement(string caption, Guid itemTypeID)
     : base(caption, new RadioGroup(null, 0))
 {
     itemTypes = App.ViewModel.ItemTypes.Where(i => i.UserID != SystemUsers.System).OrderBy(i => i.Name).ToList();
     ItemType thisItemType = itemTypes.FirstOrDefault(i => i.ID == itemTypeID);
     int selectedIndex = Math.Max(itemTypes.IndexOf(thisItemType), 0);
     var itemTypeSection = new Section();
     itemTypeSection.AddAll(from it in itemTypes select (Element) new RadioEventElement(it.Name));
     foreach (var e in itemTypeSection)
     {
         RadioEventElement ree = (RadioEventElement)e;
         ree.OnSelected += (sender, ea) =>
         {
             var selected = OnSelected;
             if (selected != null)
                 selected(this, EventArgs.Empty);
         };
     }
     this.Add(itemTypeSection);
     this.RadioSelected = selectedIndex;
 }
コード例 #27
0
		RootElement MakeHardware ()
		{
			int sources = (int)Midi.SourceCount;
			int destinations = (int)Midi.DestinationCount;

			var sourcesSection = new Section ("Sources");
			sourcesSection.AddAll (
				from x in Enumerable.Range (0, sources)
				let source = MidiEndpoint.GetSource (x)
				select (Element)new StringElement (source.DisplayName, source.IsNetworkSession ? "Network" : "Local")
			);
			var targetsSection = new Section ("Targets");
			targetsSection.AddAll (
				from x in Enumerable.Range (0, destinations)
				let target = MidiEndpoint.GetDestination (x)
				select (Element)new StringElement (target.DisplayName, target.IsNetworkSession ? "Network" : "Local")
			);
			return new RootElement ("Endpoints (" + sources + ", " + destinations + ")") {
				sourcesSection,
				targetsSection
			};
		}
コード例 #28
0
		void AddVersionRoot (Section byIOSSection, string versionString, byte majorVersion)
		{
			RootElement iOSRoot = null;

			foreach (string section in sectionList) {
				var query = masterList.Where (fi => fi.MajorVersion == majorVersion && fi.SectionName == section);
				if (query.Any ()) {
					if (iOSRoot == null) {
						iOSRoot = new RootElement (versionString);
						byIOSSection.Add (iOSRoot);
					}

					var catSection = new Section (section);
					iOSRoot.Add (catSection);
					var elementList = query.Select (fi => (Element)new RootElement (fi.Name, (x) => {
						var viewCtrl = Demo (fi.Callback);
						viewCtrl.Title = fi.Name;
						return viewCtrl;
					}));
					catSection.AddAll (elementList);
				}
			}
		}
コード例 #29
0
ファイル: UpgradesView.cs プロジェクト: jrschumacher/CodeHub
        private void Render()
        {
            var section = new Section();
            section.AddAll(_items.Select(item =>
            {
                var el = new MultilinedElement(item.Name + " (" + item.Price + ")", item.Description);
                if (_features.IsActivated(item.Id))
                {
                    el.Accessory = MonoTouch.UIKit.UITableViewCellAccessory.Checkmark;
                }
                else
                {
                    el.Accessory = MonoTouch.UIKit.UITableViewCellAccessory.DisclosureIndicator;
                    el.Tapped += () => Tapped(item);
                }

                return el;
            }));

            var root = new RootElement(Title) { UnevenRows = true };
            root.Add(section);
            Root = root;
        }
コード例 #30
0
        public PopoverContentViewController(SizeF contentSizeForViewInPopover)
        {
            // Fixes a bug with contentSizeInPopover
            this.Delegate = new YuNavigationControllerDelegate (contentSizeForViewInPopover);

            QuickFillCore quickFillCore = QuickFillManager.GetQuickFillCore ();
            var quickFillNames = quickFillCore.QuickFillNames;

            // Style entities
            var testStyleEntities = StyleEntityManager.GetDummies ();
            var styleEntities = StyleEntityManager.GetQuickFills (quickFillCore);
            // --------------

            var styleHeaderElement = new Section ("Style Header") {
                new RootElement ("Manual Entry", rt => GetCreateStyle(StyleEntityManager.GetManualEntry()))
            };

            var quickFillElement = new Section ("Quick Fill");

            var styleDialogs = new List<RootElement> ();
            for (int i = 0; i < quickFillNames.Count; i++) {
                var style = GetCreateStyle (styleEntities [i]);
                var rootElement = new RootElement (quickFillNames [i], rt => style);
                styleDialogs.Add (rootElement);
            }
            quickFillElement.AddAll (styleDialogs); //(new [] { womenTops, womenOutwear, womenSweaters });

            var rootStyles = new RootElement ("Add New Styles");
            rootStyles.Add (new [] { styleHeaderElement, quickFillElement });

            var rootDialog = new DialogViewController (rootStyles);

            rootDialog.NavigationItem.BackBarButtonItem = new UIBarButtonItem ("Back", UIBarButtonItemStyle.Bordered, null);
            rootDialog.NavigationItem.SetLeftBarButtonItem (new UIBarButtonItem ("Cancel", UIBarButtonItemStyle.Bordered, HandlePopoverCancelledEvent), true);

            this.SetViewControllers (new [] { rootDialog }, true);
        }