private async void GetActivitiesButton_OnClick(object sender, RoutedEventArgs e) { TimelinesResource timelines = await ExecuteAsync((client, cancellationToken) => client.GetTimelinesAsync(cancellationToken)); if (timelines == null) { return; } if (timelines.Timelines == null || timelines.Timelines.Length == 0) { return; } var window = new TimelinePickerWindow { Owner = this, WindowStartupLocation = WindowStartupLocation.CenterOwner, Timelines = timelines.Timelines, SelectedTimeline = timelines.Timelines.SingleOrDefault(t => t.TimelineId == SelectedTimelineId) ?? timelines.Timelines.FirstOrDefault(), FromTime = DateTime.Today, ToTime = DateTime.Today, SizeToContent = SizeToContent.WidthAndHeight }; if (window.ShowDialog() == true && window.FromTime != null && window.ToTime != null) { SelectedTimelineId = window.SelectedTimeline.TimelineId; TimelineResource timeline = await ExecuteAsync((client, cancellationToken) => client.GetActivitiesByTimelineIdAsync( SelectedTimelineId, window.FromTime.Value, window.ToTime.Value.AddDays(1), cancellationToken)); RefreshUpdatedActivitiesUrl(timeline); } }
private async void GetUpdatedActivitiesButton_OnClick(object sender, RoutedEventArgs e) { TimelineResource timeline = await ExecuteAsync((client, cancellationToken) => client.GetUpdatedActivitiesAsync(_updatedActivitiesUrl, cancellationToken)); RefreshUpdatedActivitiesUrl(timeline); }
private async void PublishTimelineButton_OnClick(object sender, RoutedEventArgs e) { var window = new PublishTimelineWindow { Owner = this, WindowStartupLocation = WindowStartupLocation.CenterOwner, TimelineName = "My test timeline", TimelineKey = Guid.NewGuid().ToString(), TimelineType = "Test/MyTestTimelineType", GenericTimelineTypes = new[] { "ManicTime/Generic/Group", "ManicTime/Generic/GroupList" }, SelectedGenericTimelineType = "ManicTime/Generic/Group", ClientName = Environment.MachineName, SizeToContent = SizeToContent.WidthAndHeight }; if (window.ShowDialog() == true) { var timeline = new TimelineResource { DisplayName = window.TimelineName, TimelineType = new TimelineTypeResource { TypeName = window.TimelineType, GenericTypeName = window.SelectedGenericTimelineType, }, ClientName = window.ClientName, TimelineKey = window.TimelineKey }; await ExecuteAsync((client, cancellationToken) => client.PublishTimeline(timeline, cancellationToken)); } }
public MirrorService(BaseClientService.Initializer initializer) : base(initializer) { this._timeline = new TimelineResource(this, base.Authenticator); this._subscriptions = new SubscriptionsResource(this, base.Authenticator); this._locations = new LocationsResource(this, base.Authenticator); this._contacts = new ContactsResource(this, base.Authenticator); this.InitParameters(); }
public async Task <TimelineResource> PublishTimeline(TimelineResource timeline, CancellationToken cancellationToken) { HomeResource home = await GetHomeAsync(cancellationToken); string timelinesUrl = home == null ? null : home.Links.Url(Relations.Timelines); if (timelinesUrl == null) { throw new InvalidOperationException("Cannot publish timeline. Timelines url not found."); } return(await SendAsync <TimelineResource>(timelinesUrl, HttpMethod.Post, timeline, cancellationToken)); }
private async void PublishTimelineButton_OnClick(object sender, RoutedEventArgs e) { var window = new PublishTimelineWindow { Owner = this, WindowStartupLocation = WindowStartupLocation.CenterOwner, TimelineName = "My test timeline", TimelineKey = Guid.NewGuid().ToString(), TimelineType = "Test/MyTestTimelineType", GenericTimelineTypes = new[] { "ManicTime/Generic/Group", "ManicTime/Generic/GroupList" }, SelectedGenericTimelineType = "ManicTime/Generic/Group", ClientName = Environment.MachineName, SizeToContent = SizeToContent.WidthAndHeight }; if (window.ShowDialog() == true) { var timeline = new TimelineResource { Name = window.TimelineName, TimelineType = new TimelineTypeResource { TypeName = window.TimelineType, GenericTypeName = window.SelectedGenericTimelineType, }, ClientEnvironment = new ClientEnvironmentResource { ApplicationName = Path.GetFileName(Assembly.GetEntryAssembly().Location), ApplicationVersion = Assembly.GetEntryAssembly().GetName().Version.ToString(), DatabaseId = "ClientRandomId", DeviceName = window.ClientName, DeviceSystemName = Environment.MachineName, OperatingSystem = "Windows", OperatingSystemVersion = Environment.OSVersion.Version.ToString() }, TimelineKey = window.TimelineKey }; await ExecuteAsync((client, cancellationToken) => client.PublishTimeline(timeline, cancellationToken)); } }
private void RefreshUpdatedActivitiesUrl(TimelineResource result) { UpdatedActivitiesUrl = result == null ? null : result.Links.Url(Relations.UpdatedActivities); }