예제 #1
0
        public async Task <Share> JoinMessageBoardAsync(string topic)
        {
            MessageBoard messageBoard = await Community.AddFactAsync(new MessageBoard(topic));

            Share share = await Community.AddFactAsync(new Share(this, messageBoard));

            return(share);
        }
예제 #2
0
        // Fields

        // Results

        // Business constructor
        public Share(
            Individual individual
            , MessageBoard messageBoard
            )
        {
            _unique = Guid.NewGuid();
            InitializeResults();
            _individual   = new PredecessorObj <Individual>(this, GetRoleIndividual(), individual);
            _messageBoard = new PredecessorObj <MessageBoard>(this, GetRoleMessageBoard(), messageBoard);
        }
예제 #3
0
        // Results

        // Business constructor
        public Message(
            MessageBoard messageBoard
            , Domain domain
            , string text
            )
        {
            _unique = Guid.NewGuid();
            InitializeResults();
            _messageBoard = new PredecessorObj <MessageBoard>(this, GetRoleMessageBoard(), messageBoard);
            _domain       = new PredecessorObj <Domain>(this, GetRoleDomain(), domain);
            _text         = text;
        }
예제 #4
0
 private async Task<MessageBoardViewModel> LoadMessageBoardAsync(MessageBoard messageBoard)
 {
     var messages = await messageBoard.Messages.EnsureAsync();
     return new MessageBoardViewModel
     {
         Topic = messageBoard.Topic,
         Messages = messages
             .Take(3)
             .Select(m => m.Text)
             .ToList()
     };
 }
예제 #5
0
            public CorrespondenceFact CreateFact(FactMemento memento)
            {
                MessageBoard newFact = new MessageBoard(memento);

                // Create a memory stream from the memento data.
                using (MemoryStream data = new MemoryStream(memento.Data))
                {
                    using (BinaryReader output = new BinaryReader(data))
                    {
                        newFact._topic = (string)_fieldSerializerByType[typeof(string)].ReadData(output);
                    }
                }

                return(newFact);
            }
예제 #6
0
 // Results
 // Business constructor
 public Message(
     MessageBoard messageBoard
     ,Domain domain
     ,string text
     )
 {
     _unique = Guid.NewGuid();
     InitializeResults();
     _messageBoard = new PredecessorObj<MessageBoard>(this, GetRoleMessageBoard(), messageBoard);
     _domain = new PredecessorObj<Domain>(this, GetRoleDomain(), domain);
     _text = text;
 }
예제 #7
0
 // Fields
 // Results
 // Business constructor
 public Share(
     Individual individual
     ,MessageBoard messageBoard
     )
 {
     _unique = Guid.NewGuid();
     InitializeResults();
     _individual = new PredecessorObj<Individual>(this, GetRoleIndividual(), individual);
     _messageBoard = new PredecessorObj<MessageBoard>(this, GetRoleMessageBoard(), messageBoard);
 }
예제 #8
0
            public CorrespondenceFact CreateFact(FactMemento memento)
            {
                MessageBoard newFact = new MessageBoard(memento);

                // Create a memory stream from the memento data.
                using (MemoryStream data = new MemoryStream(memento.Data))
                {
                    using (BinaryReader output = new BinaryReader(data))
                    {
                        newFact._topic = (string)_fieldSerializerByType[typeof(string)].ReadData(output);
                    }
                }

                return newFact;
            }
예제 #9
0
 public CorrespondenceFact GetNullInstance()
 {
     return(MessageBoard.GetNullInstance());
 }
예제 #10
0
 public CorrespondenceFact GetUnloadedInstance()
 {
     return(MessageBoard.GetUnloadedInstance());
 }
예제 #11
0
            public void WriteFactData(CorrespondenceFact obj, BinaryWriter output)
            {
                MessageBoard fact = (MessageBoard)obj;

                _fieldSerializerByType[typeof(string)].WriteData(output, fact._topic);
            }
예제 #12
0
 public void RegisterAllFactTypes(Community community, IDictionary <Type, IFieldSerializer> fieldSerializerByType)
 {
     community.AddType(
         Individual._correspondenceFactType,
         new Individual.CorrespondenceFactFactory(fieldSerializerByType),
         new FactMetadata(new List <CorrespondenceFactType> {
         Individual._correspondenceFactType
     }));
     community.AddQuery(
         Individual._correspondenceFactType,
         Individual.GetQueryMessageBoards().QueryDefinition);
     community.AddQuery(
         Individual._correspondenceFactType,
         Individual.GetQueryShares().QueryDefinition);
     community.AddQuery(
         Individual._correspondenceFactType,
         Individual.GetQueryIsToastNotificationEnabled().QueryDefinition);
     community.AddType(
         Share._correspondenceFactType,
         new Share.CorrespondenceFactFactory(fieldSerializerByType),
         new FactMetadata(new List <CorrespondenceFactType> {
         Share._correspondenceFactType
     }));
     community.AddQuery(
         Share._correspondenceFactType,
         Share.GetQueryIsDeleted().QueryDefinition);
     community.AddUnpublisher(
         Share.GetRoleIndividual(),
         Condition.WhereIsEmpty(Share.GetQueryIsDeleted())
         );
     community.AddType(
         ShareDelete._correspondenceFactType,
         new ShareDelete.CorrespondenceFactFactory(fieldSerializerByType),
         new FactMetadata(new List <CorrespondenceFactType> {
         ShareDelete._correspondenceFactType
     }));
     community.AddType(
         MessageBoard._correspondenceFactType,
         new MessageBoard.CorrespondenceFactFactory(fieldSerializerByType),
         new FactMetadata(new List <CorrespondenceFactType> {
         MessageBoard._correspondenceFactType
     }));
     community.AddQuery(
         MessageBoard._correspondenceFactType,
         MessageBoard.GetQueryMessages().QueryDefinition);
     community.AddType(
         Domain._correspondenceFactType,
         new Domain.CorrespondenceFactFactory(fieldSerializerByType),
         new FactMetadata(new List <CorrespondenceFactType> {
         Domain._correspondenceFactType
     }));
     community.AddType(
         Message._correspondenceFactType,
         new Message.CorrespondenceFactFactory(fieldSerializerByType),
         new FactMetadata(new List <CorrespondenceFactType> {
         Message._correspondenceFactType
     }));
     community.AddType(
         EnableToastNotification._correspondenceFactType,
         new EnableToastNotification.CorrespondenceFactFactory(fieldSerializerByType),
         new FactMetadata(new List <CorrespondenceFactType> {
         EnableToastNotification._correspondenceFactType
     }));
     community.AddQuery(
         EnableToastNotification._correspondenceFactType,
         EnableToastNotification.GetQueryIsDisabled().QueryDefinition);
     community.AddType(
         DisableToastNotification._correspondenceFactType,
         new DisableToastNotification.CorrespondenceFactFactory(fieldSerializerByType),
         new FactMetadata(new List <CorrespondenceFactType> {
         DisableToastNotification._correspondenceFactType
     }));
 }
예제 #13
0
 bool ConfirmLeaveBoard(MessageBoard messageBoard)
 {
     return MessageBox.Show(
         String.Format("Leave the group {0}?", messageBoard.Topic),
         "Leave group",
         MessageBoxButton.OKCancel) == MessageBoxResult.OK;
 }