Ejemplo n.º 1
0
 public static GistViewController FromGist(Gist gist)
 {
     return(new GistViewController
     {
         ViewModel = GistViewModel.FromGist(gist)
     });
 }
Ejemplo n.º 2
0
        public GistViewController(string id)
        {
            Title     = "Gist";
            ViewModel = new GistViewModel(id);
            _header   = new HeaderView(0f)
            {
                Title = "Gist: " + id
            };

            ToolbarItems = new []
            {
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                new UIBarButtonItem((_starButton = ToolbarButton.Create(Images.Gist.Star, StarButtonPress))),
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                (_userButton = new UIBarButtonItem(ToolbarButton.Create(Images.Gist.User, UserButtonPress))),
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                (_shareButton = new UIBarButtonItem(ToolbarButton.Create(Images.Gist.Share, ShareButtonPress))),
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace)
            };

            //Disable these buttons until the gist object becomes valid
            _userButton.Enabled  = false;
            _shareButton.Enabled = false;

            ViewModel.Bind(x => x.Gist, (gist) => {
                UpdateOwned();
                RenderGist(gist);
            });
            ViewModel.Bind(x => x.IsStarred, isStarred => {
                _starButton.SetImage(isStarred ? Images.Gist.StarHighlighted : Images.Gist.Star, UIControlState.Normal);
                _starButton.SetNeedsDisplay();
            });
        }
Ejemplo n.º 3
0
 public GitDetailPage(GistViewModel gistViewModel)
 {
     InitializeComponent();
     if (gistViewModel != null)
     {
         BindingContext = Context = gistViewModel;
     }
 }
 public FavoriteDetailPage(GistViewModel gistViewModel)
 {
     InitializeComponent();
     BindingContext = Context = gistViewModel;
 }
 public FavoriteListPage()
 {
     InitializeComponent();
     BindingContext = Context = new GistViewModel(false);
 }
Ejemplo n.º 6
0
 public GitListPage()
 {
     InitializeComponent();
     BindingContext = Context = new GistViewModel();
 }
Ejemplo n.º 7
0
 public CreateGistFileCommandArgs(string content, GistViewModel parentGist)
 {
     Content    = content;
     ParentGist = parentGist;
 }