示例#1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button> (Resource.Id.myButton);

            var locator = new StreamLocator();

            button.Click += delegate
            {
                button.Text = string.Format("{0} clicks!", count++);

                var l = new StreamWriterFunction(locator);

                var file = Path.Combine(
                    System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal),
                    "myFile.txt");
                l.WriteToPath(file, button.Text);
            };

            FindViewById <TextView> (Resource.Id.textApp).Text     = locator.AppFolder;
            FindViewById <TextView> (Resource.Id.textCurrent).Text = locator.CurrentPath;
        }
示例#2
0
 public Task <bool> Exists <T>(StreamLocator <T> s)
 {
     EventBatch[] batches;
     lock (_store) {
         batches = GetCore(s).ToArray();
     }
     return(Task.FromResult(batches.Any()));
 }
示例#3
0
            public Task <IAsyncEnumerable <RecordedEvent> > Get <T>(StreamLocator <T> s)
            {
                Check.NotNull(s, nameof(s));

                RecordedEvent[] events;
                lock (_store) {
                    events = GetCore(s)
                             .SelectMany(x => x.Events)
                             .ToArray();
                }

                return(Task.FromResult(events.ToAsyncEnumerable()));
            }
 public Task <IAsyncEnumerable <RecordedEvent> > Get <T>(StreamLocator <T> s)
 {
     return(_transaction.GetCollection <RecordedEvent>(MongoEventStore.CollectionName).FindAll(x => x.StreamID, s.StreamID));
 }
        public Task <bool> Exists <T>(StreamLocator <T> s)
        {
            StreamConfiguration config = _store.GetStreamConfig <T>();

            return(_transaction.GetCollection <StreamInfo>(MongoEventStore.GetStreamInfoName(config)).Exists(i => i.StreamID, s.StreamID));
        }
示例#6
0
 private IEnumerable <EventBatch> GetCore <T>(StreamLocator <T> s) => _store
 .Where(x => x.StreamType == typeof(T) && x.Batch.StreamID.Equals(s.StreamID))
 .Select(x => x.Batch);