public void Initialize()
        {
            var storage = new FileStreamStorageStrategy();
            var http = new HTTPConfigurationProvider();
            var communication = new BinaryHTTPAsynchronousCommunicationStrategy(http);
            var notification = new WindowsPhoneNotificationStrategy(http);
            communication.SetNotificationStrategy(notification);

            _community = new Community(storage);
            _community.AddAsynchronousCommunicationStrategy(communication);
            _community.Register<CorrespondenceModel>();
            _community.Subscribe(() => Individual);
            _community.Subscribe(() => Individual.MessageBoards);

            CreateIndividual(http);

            // Synchronize whenever the user has something to send.
            _community.FactAdded += delegate
            {
                Synchronize();
            };

            // Synchronize when the network becomes available.
            System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged += (sender, e) =>
            {
                if (NetworkInterface.GetIsNetworkAvailable())
                    Synchronize();
            };

            // And synchronize on startup or resume.
            Synchronize();
        }
Exemplo n.º 2
0
        public void Initialize()
        {
            var storage       = new FileStreamStorageStrategy();
            var http          = new HTTPConfigurationProvider();
            var communication = new BinaryHTTPAsynchronousCommunicationStrategy(http);
            var notification  = new WindowsPhoneNotificationStrategy(http);

            communication.SetNotificationStrategy(notification);

            _community = new Community(storage);
            _community.AddAsynchronousCommunicationStrategy(communication);
            _community.Register <CorrespondenceModel>();
            _community.Subscribe(() => Individual);
            _community.Subscribe(() => Individual.MessageBoards);

            CreateIndividual(http);

            // Synchronize whenever the user has something to send.
            _community.FactAdded += delegate
            {
                Synchronize();
            };

            // Synchronize when the network becomes available.
            System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged += (sender, e) =>
            {
                if (NetworkInterface.GetIsNetworkAvailable())
                {
                    Synchronize();
                }
            };

            // And synchronize on startup or resume.
            Synchronize();
        }
Exemplo n.º 3
0
 private void CreateIndividual(HTTPConfigurationProvider http)
 {
     Community.Perform(async delegate
     {
         var individual  = await _community.AddFactAsync(new Individual(GetAnonymousUserId()));
         Individual      = individual;
         http.Individual = individual;
     });
 }
 private void CreateIndividual(HTTPConfigurationProvider http)
 {
     Community.Perform(async delegate
     {
         var individual = await _community.AddFactAsync(new Individual(GetAnonymousUserId()));
         Individual = individual;
         http.Individual = individual;
     });
 }