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; }
public Task <bool> Exists <T>(StreamLocator <T> s) { EventBatch[] batches; lock (_store) { batches = GetCore(s).ToArray(); } return(Task.FromResult(batches.Any())); }
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)); }
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);