public ThreadItemsAdapter(Activity activity, ThreadsViewModel viewModel)
        {
            this.viewModel = viewModel;
            this.activity  = activity;

            this.viewModel.Items.CollectionChanged += (sender, args) =>
            {
                this.activity.RunOnUiThread(NotifyDataSetChanged);
            };
        }
        public ActionResult Threads(int id)
        {
            ThreadsViewModel threads = null;

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

            return View(threads);
        }
Example #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;
                });
            }
        }
        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);
        }
Example #6
0
 public ThreadView()
 {
     InitializeComponent();
     DataContext = new ThreadsViewModel();
 }
Example #7
0
 public ThreadsView(Process proc)
 {
     InitializeComponent();
     DataContext = new ThreadsViewModel(proc);
 }
 protected override void OnAppearing()
 {
     base.OnAppearing();
     model          = new ThreadsViewModel(settings);
     BindingContext = model;
 }
        public ThreadsWindow(MyProcess myProcess)
        {
            InitializeComponent();

            DataContext = new ThreadsViewModel(myProcess);
        }