Esempio n. 1
0
        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));
            }
        }
        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));
            }
        }