Пример #1
0
        public ThreadItemsAdapter(Activity activity, ThreadsViewModel viewModel)
        {
            this.viewModel = viewModel;
            this.activity  = activity;

            this.viewModel.Items.CollectionChanged += (sender, args) =>
            {
                this.activity.RunOnUiThread(NotifyDataSetChanged);
            };
        }
Пример #2
0
        public ActionResult Threads(int id)
        {
            ThreadsViewModel threads = null;

            try
            {
                threads = service.GetThreads(id);
            } catch (NoCategoryException e) {
                return View("NoCategory");
            }

            return View(threads);
        }
Пример #3
0
 public ActionResult Create(ThreadsViewModel model)
 {
     if (ModelState.IsValid)
     {
         var thread = new Thread
         {
             UserID      = User.Identity.GetUserId(),
             Subject     = model.Subject,
             CreatedTime = DateTime.Now,
         };
         db.Thread.Add(thread);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View());
 }
        public void Update()
        {
            bool changed  = false;
            var  newModel = new ThreadsViewModel(settings);

            foreach (var areTheySame in newModel.MessagesThreads.Zip(model.MessagesThreads, (f, s) => f.Name.Equals(s.Name)))
            {
                changed = changed || !areTheySame;
            }

            if (changed)
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    base.OnAppearing();
                    BindingContext = newModel;
                });
            }
        }
Пример #5
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var favorites = FavoritesHelper.GetFavorites(Context);

            ViewModel = new ThreadsViewModel(this.Context, this.Context.ContentResolver, favorites);

            View view         = inflater.Inflate(Resource.Layout.fragment_threads, container, false);
            var  recyclerView =
                view.FindViewById <RecyclerView>(Resource.Id.recyclerView);

            recyclerView.HasFixedSize       = true;
            recyclerView.SetAdapter(adapter = new ThreadItemsAdapter(Activity, ViewModel));

            refresher = view.FindViewById <SwipeRefreshLayout>(Resource.Id.refresher);
            refresher.SetColorSchemeColors(Resource.Color.accent);

            progress            = view.FindViewById <ProgressBar>(Resource.Id.progressbar_loading);
            progress.Visibility = ViewStates.Gone;

            return(view);
        }
Пример #6
0
 public ThreadView()
 {
     InitializeComponent();
     DataContext = new ThreadsViewModel();
 }
Пример #7
0
 public ThreadsView(Process proc)
 {
     InitializeComponent();
     DataContext = new ThreadsViewModel(proc);
 }
 protected override void OnAppearing()
 {
     base.OnAppearing();
     model          = new ThreadsViewModel(settings);
     BindingContext = model;
 }
Пример #9
0
        public ThreadsWindow(MyProcess myProcess)
        {
            InitializeComponent();

            DataContext = new ThreadsViewModel(myProcess);
        }