Пример #1
0
        public UploadViewModel(IFileUploader fileUploader,
                               IDialogManager dialogManager,
                               IHelpers helpers,
                               IUploadListSerializer uploadFileSerializer,
                               INavigatorService navigatorService,
                               IWikiSearchFactory wikiSearchFactory,
                               IYoutube youtube,
                               IFileFinder fileFinder,
                               IAppSettings appSettings)
        {
            _fileUploader         = fileUploader;
            _appSettings          = appSettings;
            _dialogs              = dialogManager;
            _helpers              = helpers;
            _navigatorService     = navigatorService;
            _uploadFileSerializer = uploadFileSerializer;
            _youtube              = youtube;
            _fileFinder           = fileFinder;
            _wikiSearchFactory    = wikiSearchFactory;

            UploadFiles = new UploadList(_helpers);
            ResetViewModel();

            LaunchSiteCommand = new RelayCommand(() => _helpers.LaunchProcess(_fileUploader.HomePage));
            ShowFileCommand   = new RelayParameterizedCommand((filePath) => ShowImage((string)filePath));
            SignOutCommand    = new RelayCommand(SignOut);

            // Manage upload file list commands
            AddFilesCommand    = new RelayCommand(AddFiles);
            AddFolderCommand   = new RelayCommand(AddFolder);
            RemoveFilesCommand = new RelayParameterizedCommand(RemoveFiles);
            LoadListCommand    = new RelayCommand(LoadList);
            SaveListCommand    = new RelayCommand(SaveList);

            // Upload commands
            UploadCommand = new RelayCommand(async() => await Upload());
            CancelCommand = new RelayCommand(Cancel);

            // Manage content commands
            LoadContentCommand = new RelayCommand(LoadContent);
            SaveContentCommand = new RelayCommand(SaveContent);

            // Category and Template commands (UploadPage)
            PickCategoryCommand = new RelayCommand(PickCategory);
            PickTemplateCommand = new RelayCommand(PickTemplate);

            // Category and Template commands (SearchPage)
            CancelSearchCommand   = new RelayCommand(() => _navigatorService.NavigateToUploadPage());
            AddSearchItemCommand  = new RelayParameterizedCommand(AddSearchItem);
            NextSearchCommand     = new RelayCommand(async() => await NextSearch());
            StartSearchCommand    = new RelayParameterizedCommand(async(from) => await StartSearch((string)from));
            PreviousSearchCommand = new RelayCommand(async() => await PreviousSearch());
        }
Пример #2
0
 public void Serialize(string fileName, UploadList uploadList)
 {
     using (var sw = new StreamWriter(fileName))
         Serialize(sw, uploadList);
 }
Пример #3
0
        public void Serialize(TextWriter textWriter, UploadList uploadList)
        {
            var serializer = new XmlSerializer(typeof(UploadList));

            serializer.Serialize(textWriter, uploadList);
        }