예제 #1
0
        private void DoAddStuff()
        {
            if (!Validate())
                return;

            // if Validate is happy, create an ItemOfStuff to be added to the inbox
            // TODO: Hard coded to Trusted System 1 for now.

            var itemOfStuff = new ItemOfStuff()
                {  TrustedSystemId = "1", StuffId = Guid.NewGuid().ToString(),
                   StuffDescription = StuffDescription,
                   TimeUtc = DateTime.UtcNow
                };

            // time to store it
            _inboxService.AddStuffToInbox(itemOfStuff);

            // probably want to close our own ViewModel after
            // the "Add Screen" has finished with its purpose, adding stuff
            // uses the Close method on the MvxNavigatingObject base class to close our MvxViewModel.
            // Close TRIES (can't guarantee it) within the platform-specific UI View layer to close
            // the current ViewModel. // TODO more on that later, depends on how you design UI.
            // Close sends a msg to the UI Layer and asks,
            // "Can you close the View that Corresponds to this ViewModel?" and makes best effort to do it.
            // On closure the previous ViewModel on nav stack should be displayed (likely InboxViewModel)
            Close(this);
        }
예제 #2
0
        public void TrashStuff(ItemOfStuff itemOfStuff)
        {
            _inboxRepository.TrashStuff(itemOfStuff);

            // just like we publish a message when we add things (see above), we
            // may also want to do that when we delete things
            _mvxMessenger.Publish(new InboxChangedMessage(this));
        }
예제 #3
0
        // TODO: May want to do validation in here instead of ViewModel
        public void AddStuffToInbox(ItemOfStuff itemOfStuff)
        {
            _inboxRepository.AddStuffToInbox(itemOfStuff);

            // send msg to tell others there was stuff added
            // this can help properties in ViewModels stay updated

            _mvxMessenger.Publish(new InboxChangedMessage(this));
        }
예제 #4
0
 // TODO: Reminder about all current storage/repositories in here
 // TODO: Use SQLite as xplat file format to store "Event Stream blobs" maybe?
 // TODO: Do we want things that NEVER get deleted like events stored on a phone?
 // TODO: How would/could you be a good mobile-client citizen using ES on a client without infinite storage?
 // TODO: If I use SQLite "relational" approach, remember when I "Delete" an Action/Project, etc.
 // TODO: I have to manually deal with the ref integrity/cascading deletes, etc.
 public void TrashStuff(ItemOfStuff itemOfStuff)
 {
     _sqlConnection.Delete(itemOfStuff);
 }
예제 #5
0
 public void AddStuffToInbox(ItemOfStuff itemOfStuff)
 {
     _sqlConnection.Insert(itemOfStuff);
 }
예제 #6
0
        void ReloadInbox()
        {
            if (_inboxService.AllStuffInInbox().Count > 0)
            {
                StuffInInbox = _inboxService.AllStuffInInbox();
            }
            else
            {
                var noStuff = new ItemOfStuff
                    {StuffDescription = "no stuff in your inbox. \n  + add some stuff now!"};

                var noStuffList = new List<ItemOfStuff> {noStuff};

                StuffInInbox = noStuffList;
            }
        }