public void OnAppearing()
 {
     if (LoadCommand.CanExecute(null))
     {
         LoadCommand.Execute(null);
     }
 }
Exemple #2
0
 public SourceViewModel()
 {
     _editToken = Messenger.SubscribeOnMainThread <SourceEditMessage>(x =>
     {
         if (x.OldSha == null || x.Update == null)
         {
             return;
         }
         _gitUrl = x.Update.Content.GitUrl;
         if (LoadCommand.CanExecute(null))
         {
             LoadCommand.Execute(true);
         }
     });
 }
Exemple #3
0
 public SourceViewModel(IMessageService messageService)
 {
     _editToken = messageService.Listen <SourceEditMessage>(x =>
     {
         if (x.OldSha == null || x.Update == null)
         {
             return;
         }
         _gitUrl = x.Update.Content.GitUrl;
         if (LoadCommand.CanExecute(null))
         {
             LoadCommand.Execute(true);
         }
     });
 }
Exemple #4
0
        public LazyLoadListView()
        {
            ItemSelected += OnItemSelected;

            ItemAppearing += (object sender, ItemVisibilityEventArgs e) =>
            {
                var items = ItemsSource as IList;
                if (items != null && e.Item == items[items.Count - 1])
                {
                    if (LoadCommand != null && LoadCommand.CanExecute(null))
                    {
                        LoadCommand.Execute(null);
                    }
                }
            };
        }
        protected virtual void OnMenuClick(MenuItem menuItem)
        {
            string filepath = GetFilepath(menuItem);

            if (String.IsNullOrEmpty(filepath))
            {
                return;
            }

            if (LoadCommand == null)
            {
                return;
            }
            if (LoadCommand.CanExecute(filepath))
            {
                LoadCommand.Execute(filepath);
            }
        }
        public void CanExecuteTest()
        {
            LoadCommand loadCommand = new LoadCommand(new FakeOpenFileDialogService());

            Assert.IsTrue(loadCommand.CanExecute(null));
        }