コード例 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            // Perform any additional setup after loading the view, typically from a nib.
            var tableSource = new MvxSimpleTableViewSource(ResultsTable, "SimpleItem");
            ResultsTable.RowHeight = 69;
            this.ResultsTable.Source = tableSource;

            this.CreateBinding( KeyTextField).To((HomeViewModel vm) => vm.Key ).Apply();
            this.CreateBinding( FetchButton).To( (HomeViewModel vm) => vm.FetchItemsCommand ).Apply();
            this.CreateBinding( tableSource).To( (HomeViewModel vm) => vm.Items ).Apply();

            // alternative approach would be:
            //this.AddBindings (
            //	new Dictionary<object,string> ()
            //    {
            //		{ this.KeyTextField, "Text Key" },
            //		{ this.FetchButton, "TouchUpInside FetchItemsCommand" },
            //		{ tableSource, "ItemsSource Items" }
            //	});

            this.ResultsTable.ReloadData ();

            // UI only concerns
            this.FetchButton.TouchUpInside += (s,e) => ClearKeyboard();
            this.View.AddGestureRecognizer(new UITapGestureRecognizer(ClearKeyboard));
        }
コード例 #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            var folderControl = new FolderControl();
            AddChildViewController(folderControl);
            FolderView.AddSubview(folderControl.View);

            var mailControl = new MailControl();
            AddChildViewController(mailControl);
            MailView.AddSubview(mailControl.View);

            var source = new MvxSimpleTableViewSource(FoldersTable, FolderCellTemplate.Key, FolderCellTemplate.Key);
            FoldersTable.Source = source;

            var set = this.CreateBindingSet<FoldersView, FoldersViewModel>();
            set.Bind(source).To (vm => vm.Folders);
            set.Bind(source).For(s => s.SelectedItem).To (vm => vm.SelectedFolder);
            set.Apply ();

            this.Title = "MailApp";

            //As the folder is also showed on this view, we don't wait for the user to select one
            ((FoldersViewModel)ViewModel).SelectedFolder = ((FoldersViewModel)ViewModel).Folders.FirstOrDefault();
        }
コード例 #3
0
        public override void ViewDidLoad()
        {
            View = new UIView(){ BackgroundColor = UIColor.White};
            base.ViewDidLoad();

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
                EdgesForExtendedLayout = UIRectEdge.None;

            var textField = new UITextField(new RectangleF(10, 10, 300, 40));
            Add(textField);

            var tableView = new UITableView(new RectangleF(0, 50, 320, 500), UITableViewStyle.Plain);
            Add(tableView);

			// choice here:
			//
			//   for original demo use:
            //     var source = new MvxStandardTableViewSource(tableView, "TitleText");
			//
			//   or for prettier cells from XIB file use:
			//     tableView.RowHeight = 88;
			//     var source = new MvxSimpleTableViewSource(tableView, BookCell.Key, BookCell.Key);

			tableView.RowHeight = 88;
			var source = new MvxSimpleTableViewSource(tableView, BookCell.Key, BookCell.Key);
			tableView.Source = source;

            var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
            set.Bind(textField).To(vm => vm.SearchTerm);
            set.Bind(source).To(vm => vm.Results);
            set.Apply();

            tableView.ReloadData();
        }
コード例 #4
0
ファイル: NewsOverviewView.cs プロジェクト: rootdevelop/Sunny
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
			
            var tableView = new UITableView();
            tableView.Frame = new RectangleF(70, 144, 884, 654);
            tableView.RowHeight = 150;
            
            var coolBorder = new UIButton(UIButtonType.System);
            coolBorder.Frame = new RectangleF(tableView.Frame.X - 2, tableView.Frame.Y - 2, tableView.Frame.Width + 4, tableView.Frame.Height + 4);
            coolBorder.BackgroundColor = UIColor.White;
            coolBorder.Layer.BorderColor = UIColor.FromRGBA(0.631f, 0.816f, 0.922f, 1.000f).CGColor;
            coolBorder.Layer.CornerRadius = 4;
            coolBorder.Layer.BorderWidth = 1;
            View.AddSubview(coolBorder);
            View.AddSubview(tableView);

            var source = new MvxSimpleTableViewSource(tableView, NewsTableViewCell.Key, NewsTableViewCell.Key);
            tableView.Source = source;           
            
            var set = this.CreateBindingSet<NewsOverviewView, NewsOverviewViewModel>();
            set.Bind(source).To(vm => vm.News); 
            set.Bind(backButton).To("GoBackCommand"); 
            set.Apply();
        }
コード例 #5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            if (RespondsToSelector (new Selector ("edgesForExtendedLayout"))) {
                EdgesForExtendedLayout = UIRectEdge.None;
            }

            ScrollView.ContentSize = controlsView.Bounds.Size;

            var source = new MvxSimpleTableViewSource (SetsTableView, SetNameWithCommandTableViewCell.Key, SetNameWithCommandTableViewCell.Key);

            SetsTableView.Source = source;

            var set = this.CreateBindingSet<AddSearchResultToSetView, AddSearchResultToSetViewModel>();

            set.Bind (source).To (ViewModel => ViewModel.SetList);

            SetsTableView.AllowsMultipleSelection = false;

            source.SelectedItemChanged += (object sender, EventArgs e) => {
                var selectedSet = (WithCommand<FlashCardSet>)source.SelectedItem;
                selectedSet.Command.Execute(null);
                // todo: display added message
            };

            set.Bind (SimplifiedLabel).To (ViewModel => ViewModel.Card.Simplified);
            set.Bind (TraditionalLabel).To (ViewModel => ViewModel.Card.Traditional);
            set.Bind (PinyinLabel).To (ViewModel => ViewModel.Card.Pinyin);
            set.Bind (DefinitionLabel).To (ViewModel => ViewModel.Card.Definition);

            set.Bind (CreateCustomCardButton).To (ViewModel => ViewModel.CreateCustomCardCommand);

            set.Apply ();
        }
コード例 #6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            // Perform any additional setup after loading the view, typically from a nib.
            /*var source = new MvxStandardTableViewSource(
                TableView,
                UITableViewCellStyle.Subtitle,
                new NSString("ExampleOverviewView"),
                "TitleText Description;DetailText Value",
                UITableViewCellAccessory.DisclosureIndicator);

            this.AddBindings(
                new Dictionary<object, string>()
                {
                    { source, "ItemsSource ExampleViewModel" }
                });

            TableView.Source = source;
            TableView.ReloadData();*/

            var source = new
                MvxSimpleTableViewSource(
                    TableView,
                    ExampleOverviewTableCell.Key,
                    ExampleOverviewTableCell.Key);
            TableView.Source = source;

            this.CreateBinding(source)
                .To<ExampleOverviewViewModel>(vm => vm.ExampleViewModel)
                .Apply();

            // Perform our MVVM Binding
            var set = this.CreateBindingSet<ExampleOverviewView, ExampleOverviewViewModel> ();

            set.Bind ( source )
                .To ( vm => vm.ExampleViewModel );

            set
                .Bind ( BoiletPlateLabel1 )
                .To ( vm => vm.ExampleViewModel.Count );
            set
                .Bind ( BoiletPlateTextField1 )
                .To ( vm => vm.ExampleViewModel.Count );

            set
                .Bind ( BoiletPlateLabel2 )
                .To ( vm => vm.ExampleViewModel.Distance );
            set
                .Bind ( BoiletPlateTextField2 )
                .To ( vm => vm.ExampleViewModel.Distance );

            set.Apply ();
            TableView.ReloadData ();
        }
コード例 #7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new MvxSimpleTableViewSource(TableView, ListCell.Key);
            TableView.Source = source;

            var set = this.CreateBindingSet<ListView, Core.ViewModels.ListViewModel>();
            set.Bind(source).To(vm => vm.Items);
            set.Apply();
        }
コード例 #8
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			var source = new MvxSimpleTableViewSource(TableView, DescriptionCell.Key, DescriptionCell.Key);
			this.CreateBinding(source).To<HomeViewModel>(vm => vm.Descriptions).Apply();

			TableView.RowHeight = 100.0f;
			TableView.Source = source;
			TableView.ReloadData();
		}
コード例 #9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            var source = new MvxSimpleTableViewSource(MailsTable, MailCellTemplate.Key, MailCellTemplate.Key);
            MailsTable.Source = source;

            var set = this.CreateBindingSet<FolderControl, FolderViewModel>();
            set.Bind(source).To (vm => vm.Mails);
            set.Bind(source).For(s => s.SelectedItem).To (vm => vm.SelectedMail);
            set.Apply ();
        }
コード例 #10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new MvxSimpleTableViewSource(TableView, KittenCell.Key, KittenCell.Key);
            TableView.RowHeight = 100;
            TableView.Source = source;

            var set = this.CreateBindingSet<FirstView, FirstViewModel>();
            set.Bind(source).To(vm => vm.Kittens);
            set.Apply();

            TableView.ReloadData();
        }
コード例 #11
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            var source = new MvxSimpleTableViewSource(FoldersTable, FolderCellTemplate.Key, FolderCellTemplate.Key);
            FoldersTable.Source = source;

            var set = this.CreateBindingSet<FoldersView, FoldersViewModel>();
            set.Bind(source).To (vm => vm.Folders);
            set.Bind(source).For(s => s.SelectedItem).To (vm => vm.SelectedFolder);
            set.Apply ();

            this.Title = "MailApp";
        }
コード例 #12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            // ios7 layout
            if (RespondsToSelector (new Selector ("edgesForExtendedLayout"))) {
                EdgesForExtendedLayout = UIRectEdge.None;
            }

            PageScrollView.ContentSize = contentView.Bounds.Size;

            var source = new MvxSimpleTableViewSource (SetsTableView, SetNameWithCommandTableViewCell.Key, SetNameWithCommandTableViewCell.Key);

            SetsTableView.Source = source;

            var set = this.CreateBindingSet<StudyFlashCardSetSettingsView, StudyFlashCardSetSettingsViewModel> ();

            set.Bind (source).To (ViewModel => ViewModel.SetList);

            SetsTableView.AllowsMultipleSelection = false;

            source.SelectedItemChanged += (object sender, EventArgs e) => {
                var selectedSet = (WithCommand<FlashCardSet>)source.SelectedItem;
                selectedSet.Command.Execute(null);
                // todo: display added message
            };

            set.Bind (MaxNumberOfCardsScroller).To (ViewModel => ViewModel.MaxCardsInStudySet).TwoWay();
            set.Bind (MaxNumberOfCardsText).To (ViewModel => ViewModel.MaxCardsInStudySet).TwoWay();

            set.Bind (ShowCharactersFirstSwitch).To (ViewModel => ViewModel.CharactersFirst).TwoWay();
            set.Bind (ShowPinyinFirstSwitch).To (ViewModel => ViewModel.PinyinFirst).TwoWay();
            set.Bind (ShowDefinitionFirstSwitch).To (ViewModel => ViewModel.EnglishFirst).TwoWay();

            set.Bind (ShowDefinitionSwitch).To (ViewModel => ViewModel.Settings.ShowDefinition).TwoWay();
            set.Bind (ShowSimplifiedSwitch).To (ViewModel => ViewModel.Settings.ShowSimplified).TwoWay();
            set.Bind (ShowTraditionalSwitch).To (ViewModel => ViewModel.Settings.ShowTraditional).TwoWay();
            set.Bind (ShowPinyinSwitch).To (ViewModel => ViewModel.Settings.ShowPinyin).TwoWay();

            set.Bind (MaxCardsSlider).To (ViewModel => ViewModel.MaxCardsInStudySet).TwoWay ();

            //		set.Bind (SelectedSetNameLabel).To (ViewModel => ViewModel.SelectedSet.SetName);

            set.Apply ();

            // Perform any additional setup after loading the view, typically from a nib.
        }
コード例 #13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            var source = new MvxSimpleTableViewSource(TableView, TaskCell.Key, TaskCell.Key);
            TableView.Source = source;

            var set = this.CreateBindingSet<TaskListView, TaskListViewModel>();
            set.Bind(TextFieldAdd).To(vm => vm.NewTaskText).TwoWay();
            set.Bind(ButtonAdd).To(vm => vm.AddTaskCommand);
            set.Bind(ButtonAll).To(vm => vm.ShowAllTasksCommand);
            set.Bind(ButtonFinished).To(vm => vm.ShowFinishedTasksCommand);
            set.Bind(ButtonUnfinished).To(vm => vm.ShowUnfinishedTasksCommand);
            set.Bind(source).To(vm => vm.Tasks);
            set.Apply();
            TableView.ReloadData();
            this.ButtonAdd.TouchUpInside += (sender, e) => this.View.EndEditing(true);
        }
コード例 #14
0
        private void InitTableBindings()
        {
            var tableSource =
                new MvxSimpleTableViewSource(CountryDataTableView, CountryInfoCell.Key, CountryInfoCell.Key);

            CountryDataTableView
                .RegisterNibForCellReuse(CountryInfoCell.Nib, CountryInfoCell.Key);

            CountryDataTableView.Source = tableSource;
            CountryDataTableView.RowHeight = 110f;

            var set = this.CreateBindingSet<CountryInfoView, CountryInfoViewModel>();
            set.Bind(tableSource).For(t => t.ItemsSource).To(vm => vm.CountryData);
            set.Bind(tableSource).For(t => t.SelectionChangedCommand)
                .To(vm => vm.CountrySelectionCommand);
            set.Apply();
        }
コード例 #15
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
                EdgesForExtendedLayout = UIRectEdge.None;

			var source = new MvxSimpleTableViewSource(TableView, KittenCell.Key, KittenCell.Key);
			TableView.RowHeight = 100;
			TableView.Source = source;

            var set = this.CreateBindingSet<FirstView, FirstViewModel>();
            set.Bind(source).To(vm => vm.Kittens);
            set.Apply();

            TableView.ReloadData();
        }
コード例 #16
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            EnterText.Delegate = new EnterTextDelegate ();

            var itemListSource = new MvxSimpleTableViewSource (ItemList, "ItemView");

            var set = this.CreateBindingSet<BootstrapView, BootstrapViewModel> ();

            set.Bind (Click).For ("TouchUpInside").To ("ClickCommand");
            set.Bind (Click).For ("Title").To ("ClickText");
            set.Bind (GoToNavigate).For ("TouchUpInside").To ("GoToNavigateCommand");
            set.Bind (EnterText).To ("EnterText");
            set.Bind (DisplayText).For ("Text").To ("EnterText");
            set.Bind (itemListSource).For ("ItemsSource").To ("Items");
            set.Apply ();

            ItemList.Source = itemListSource;
            ItemList.ReloadData ();
        }
コード例 #17
0
        public override void ViewDidLoad()
        {
            View = new UIView(){ BackgroundColor = UIColor.White};
            base.ViewDidLoad();

            var textField = new UITextField(new RectangleF(10, 10, 300, 40));
            Add(textField);

            var activity = new UIActivityIndicatorView(new RectangleF(130, 130, 60, 60));
            activity.Color = UIColor.Orange;

            Add(activity);

            var tableView = new UITableView(new RectangleF(0, 50, 320, 500), UITableViewStyle.Plain);
            Add(tableView);

            // choice here:
            //
            //   for original demo use:
            //     var source = new MvxStandardTableViewSource(tableView, "TitleText");
            //
            //   or for prettier cells from XIB file use:
            //     tableView.RowHeight = 88;
            //     var source = new MvxSimpleTableViewSource(tableView, BookCell.Key, BookCell.Key);

            tableView.RowHeight = 88;
            var source = new MvxSimpleTableViewSource(tableView, BookCell.Key, BookCell.Key);
            tableView.Source = source;

            var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
            set.Bind(textField).To(vm => vm.SearchTerm);
            set.Bind(textField).For(t => t.Enabled).To(vm => vm.IsLoading).WithConversion("InverseBool");
            set.Bind(source).To(vm => vm.Results);
            set.Bind(activity).For("Visibility").To(vm => vm.IsLoading).WithConversion("Visibility");
            set.Bind(tableView).For("Visibility").To(vm => vm.IsLoading).WithConversion("InvertedVisibility");
            set.Apply();

            tableView.ReloadData();
        }
コード例 #18
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            // ios7 layout
            if (RespondsToSelector (new Selector ("edgesForExtendedLayout"))) {
                EdgesForExtendedLayout = UIRectEdge.None;
            }

            var source = new MvxSimpleTableViewSource(FlashCardSetsTableView, FlashCardSetTableViewCell.Key, FlashCardSetTableViewCell.Key);
            FlashCardSetsTableView.Source = source;

            var set = this.CreateBindingSet<FlashCardSetListView, FlashCardSetListViewModel> ();
            set.Bind (NewSetNameTextField).To (ViewModel => ViewModel.NewSetName).TwoWay();
            set.Bind (AddNewSetButton).To ("AddSetCommand");

            set.Bind (source).To (v => v.FlashCardSets);

            source.SelectedItemChanged += (object sender, EventArgs e) => {

                var selectedItem = (WithCommand<FlashCardSet>)source.SelectedItem;
                ViewModel.SelectedSet = selectedItem.Item;
                selectedItem.Command.Execute(null);

            };

            set.Apply ();

            var gesture = new UITapGestureRecognizer(() =>
                {
                    NewSetNameTextField.ResignFirstResponder();

                });
            gesture.CancelsTouchesInView = false;

            View.AddGestureRecognizer(gesture);

            // Perform any additional setup after loading the view, typically from a nib.
        }
コード例 #19
0
        public override void ViewDidLoad()
        {
			if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
				EdgesForExtendedLayout = UIRectEdge.None;

            base.ViewDidLoad();

			var source = new MvxSimpleTableViewSource (BowTieTableView, BowTieViewCell.Key, BowTieViewCell.Key);
			BowTieTableView.Source = source;

            var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();

			set.Bind (source).To (ViewModel => ViewModel.BowTies);
			set.Bind (GetBowTiesButton).To (ViewModel => ViewModel.GetBowtiesCommand);


			set.Apply();

			//((FirstViewModel)this.ViewModel).GetBowtiesCommand.Execute(null);


			BowTieTableView.ReloadData ();
        }
コード例 #20
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            var source = new MvxSimpleTableViewSource(FlashCardTableView, FlashCardTableViewCell.Key, FlashCardTableViewCell.Key);

            FlashCardTableView.Source = source;

            var set = this.CreateBindingSet<FlashCardSetDetailsView, FlashCardSetDetailsViewModel> ();
            set.Bind (SetNameLabel).To (ViewModel => ViewModel.Set.SetName);
            set.Bind (source).To (ViewModel => ViewModel.SetCards);

            source.SelectedItemChanged += (object sender, EventArgs e) =>
            {
                ViewModel.SelectedCard = (FlashCard)source.SelectedItem;
            };

            set.Bind (DeleteCardButton).To ("DeleteCardCommand");
            set.Bind (DeleteSetButton).To ("DeleteSetCommand");
            set.Bind (CardDetailsButton).To ("ShowCardDetailCommand");

            set.Apply ();
        }
コード例 #21
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            // ios7 layout
            if (RespondsToSelector (new Selector ("edgesForExtendedLayout"))) {
                EdgesForExtendedLayout = UIRectEdge.None;
            }

            var source = new MvxSimpleTableViewSource(FlashCardSetTableView, FlashCardSetTableViewCell.Key, FlashCardSetTableViewCell.Key);
            FlashCardSetTableView.Source = source;

            var set = this.CreateBindingSet<SearchResultView, SearchResultViewModel> ();
            set.Bind (SimplifiedLabel).To (ViewModel => ViewModel.TheSearchResult.Simplified);
            set.Bind (TraditionalLabel).To (ViewModel => ViewModel.TheSearchResult.Traditional);
            set.Bind (PinyinLabel).To (ViewModel => ViewModel.TheSearchResult.AccentedPinyin).TwoWay();
            set.Bind (DefinitionLabel).To (ViewModel => ViewModel.TheSearchResult.DefintionsString);

            set.Bind (source).To (ViewModel => ViewModel.FlashCardSets);

            set.Bind (AddToSetButton).To ("AddCardToSetCommand");

            set.Bind (source).To (v => v.FlashCardSets);

            source.SelectedItemChanged += (object sender, EventArgs e) => {

                var selectedItem = (FlashCardSet)source.SelectedItem;
                ViewModel.SelectedFlashCardSet = selectedItem;
            };

            set.Bind (source).For ("SelectedItemChanged").To ("ShowDetailCommand");

            set.Apply ();

            // Perform any additional setup after loading the view, typically from a nib.
        }