Ejemplo n.º 1
0
 public ProgramInfo(OnlineProgramHeader header)
 {
   Author = header.Author;
   Description = header.Description;
   Downloads = header.Downloads != null
     ? uint.Parse(header.Downloads)
     : 0;
   DownloadUrl = header.DownloadUrl;
   FeaturedImage = header.FeaturedImage != null 
     ? new Uri(header.FeaturedImage)
     : null;
   FileSize = header.FileSize != null
     ? double.Parse(header.FileSize, NumberStyles.Any, new CultureInfo("en"))
     : 0;
   Id = header.ProjectId != null 
     ? uint.Parse(header.ProjectId) 
     : 0;
   Image = header.ScreenshotBig != null
     ? new Uri(header.ScreenshotBig)
     : null;
   Name = header.ProjectName;
   ProjectUrl = header.ProjectUrl != null
     ? new Uri(header.ProjectUrl)
     : null;
   Thumbnail = header.ScreenshotSmall != null 
     ? new Uri(header.ScreenshotSmall) 
     : null;
   Uploaded = header.Uploaded != null
     ? FromUnixTime(header.Uploaded) 
     : (DateTime?)null;
   UploadedString = header.UploadedString;
   Version = header.Version;
   Views = header.Views != null 
     ? uint.Parse(header.Views) 
     : 0;
 }
        private async void DownloadAction(OnlineProgramHeader programHeader)
        {
            /*lock (_importLock)
            {
                if (IsImporting)
                {
                    ServiceLocator.NotifictionService.ShowMessageBox(
                        AppResourcesHelper.Get("Main_OnlineProgramLoading"),
                        AppResourcesHelper.Get("Main_OnlineProgramDownloadBusy"),
                        CancelImportCallback,  MessageBoxOptions.Ok);
                    return;
                }

                IsImporting = true;
            }

            var message = new GenericMessage<string>(programHeader.ProjectName);
            Messenger.Default.Send(message, ViewModelMessagingToken.DownloadProgramStartedListener);

            try
            {
                ServiceLocator.DispatcherService.RunOnMainThread(() =>
                    ServiceLocator.NavigationService.NavigateBack<OnlineProgramViewModel>());

                ServiceLocator.ProgramImportService.SetDownloadHeader(programHeader);
                await Task.Run(() => ServiceLocator.ProgramImportService.TryImportWithStatusNotifications()).ConfigureAwait(false);
            }
            finally
            {
                ServiceLocator.DispatcherService.RunOnMainThread(() =>
                {
                    lock (_importLock) { IsImporting = false; }
                });
            }*/
        }
Ejemplo n.º 3
0
 private void OnlineProgramTapAction(OnlineProgramHeader program)
 {
     SelectedOnlineProgram = program;
     ServiceLocator.NavigationService.NavigateTo<OnlineProgramViewModel>();
 }
 private bool DownloadCommand_CanExecute(OnlineProgramHeader dataContext)
 {
     return ButtonDownloadIsEnabled;
 }
        private void InitOnlineProjects()
        {
            OnlineProjects = new OnlineProgramsCollection();

            var project1 = new OnlineProgramHeader
            {
                ProjectName = "Online Project 1 with very very very very very long name",
                Description = "That is a nice description of Project 1. That is a nice description of Project 1. That is a nice description of Project 1"
            };

            var project2 = new OnlineProgramHeader
            {
                ProjectName = "Online Project 2",
                Description = "That is a nice description of Project 2."
            };

            var project3 = new OnlineProgramHeader
            {
                ProjectName = "Online Project 3",
                Description = "That is a nice description of Project 3."
            };

            OnlineProjects.Add(project1);
            OnlineProjects.Add(project2);
            OnlineProjects.Add(project3);
        }