public void Initialize() { HTTPConfigurationProvider configurationProvider = new HTTPConfigurationProvider(); _community = new Community(IsolatedStorageStorageStrategy.Load()) .AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(configurationProvider)) .Register<CorrespondenceModel>(); _domain = _community.AddFact(new Domain("Improving Enterprises")); _community.Subscribe(_domain); // Synchronize whenever the user has something to send. _community.FactAdded += delegate { _community.BeginSending(); }; // Periodically resume if there is an error. DispatcherTimer synchronizeTimer = new DispatcherTimer(); synchronizeTimer.Tick += delegate { _community.BeginSending(); _community.BeginReceiving(); }; synchronizeTimer.Interval = TimeSpan.FromSeconds(60.0); synchronizeTimer.Start(); // And synchronize on startup. _community.BeginSending(); _community.BeginReceiving(); }
protected void InitializeCommunity() { var sharedCommunication = new MemoryCommunicationStrategy(); _communityFlynn = NewCommunity(sharedCommunication); _communityAlan = NewCommunity(sharedCommunication); _communityModerator = NewCommunity(sharedCommunication); _individualFlynn = _communityFlynn.AddFact(new Individual("flynn")); _individualAlan = _communityAlan.AddFact(new Individual("alan")); _domainModerator = _communityModerator.AddFact(new Domain("Improving Enterprises")); _communityFlynn.Subscribe(_individualFlynn); _communityAlan.Subscribe(_individualAlan); _communityModerator.Subscribe(_domainModerator); }
// Business constructor public Company( Domain domain ) { _unique = Guid.NewGuid(); InitializeResults(); _domain = new PredecessorObj<Domain>(this, RoleDomain, domain); }
// Business constructor public Game( Domain domain ,IEnumerable<Company> companies ) { _unique = Guid.NewGuid(); InitializeResults(); _domain = new PredecessorObj<Domain>(this, RoleDomain, domain); _companies = new PredecessorList<Company>(this, RoleCompanies, companies); }
public CorrespondenceFact CreateFact(FactMemento memento) { Domain newFact = new Domain(memento); // Create a memory stream from the memento data. using (MemoryStream data = new MemoryStream(memento.Data)) { using (BinaryReader output = new BinaryReader(data)) { newFact._name = (string)_fieldSerializerByType[typeof(string)].ReadData(output); } } return newFact; }
public NewGameViewModel(Domain domain, NewGameSelectionModel selection) { _domain = domain; _selection = selection; }