コード例 #1
0
        public VideoFilePopup(FileViewModel context)
        {
            InitializeComponent();

            DataContext = context;
            CurrentFile = context;
            Visible = true;

            //Put.io assumes that if the file format is of MP4 then we can use it
            if (FileNativeMp4())
            {
                ConvertMp4.IsEnabled = false;
                DownloadMp4.IsEnabled = true;
                StreamMp4.IsEnabled = true;
                return;
            }

            App.ViewModel.FileCollection.GetMp4Status(context, (mp4Available, percentDone) =>
            {
                if (mp4Available == Mp4Status.InQueue || mp4Available == Mp4Status.Converting)
                    Task.Factory.StartNew(ConversionInProgress);

                UpdateUi(() => SetupButtons(mp4Available, percentDone));
            });
        }
コード例 #2
0
ファイル: MainViewModel.cs プロジェクト: jbouwens/Put.io.Wp
        public void SelectFile(FileViewModel selected)
        {
            if (selected.IsExpandable)
            {
                FileCollection.SelectedFile = selected;
                FileCollection.ExpandFile(selected);
                return;
            }

            if (selected.IsOpenable)
            {
                FileCollection.SelectedFile = selected;
                OpenFilePopup(selected);
                return;
            }

        }
コード例 #3
0
        public void ExpandFile(FileViewModel file)
        {
            if (file.File.ContentType != ContentType.Directory)
                return;

            if (file.Children != null)
            {
                CurrentFileList = file.Children;
                return;
            }

            var transactionID = ProgressTracker.StartNewTransaction();

            RestApi.ListFiles(file.File.FileID, response =>
            {
                file.Children = OrderCollection(response.Data.ToModelList(Invoker, Settings, ProgressTracker));
                CurrentFileList = file.Children;

                ProgressTracker.CompleteTransaction(transactionID);
            });
        }
コード例 #4
0
        public void ExpandFile(FileViewModel file)
        {
            if (file.File.ContentType != ContentType.Directory)
            {
                return;
            }

            if (file.Children != null)
            {
                CurrentFileList = file.Children;
                return;
            }

            var transactionID = ProgressTracker.StartNewTransaction();

            RestApi.ListFiles(file.File.FileID, response =>
            {
                file.Children   = OrderCollection(response.Data.ToModelList(Invoker, Settings, ProgressTracker));
                CurrentFileList = file.Children;

                ProgressTracker.CompleteTransaction(transactionID);
            });
        }
コード例 #5
0
ファイル: MainViewModel.cs プロジェクト: jbouwens/Put.io.Wp
 private void OpenFilePopup(FileViewModel file)
 {
     if (OnOpenFilePopup != null)
         OnOpenFilePopup(file, Tracker);
 }
コード例 #6
0
ファイル: MainPage.xaml.cs プロジェクト: jbouwens/Put.io.Wp
 private void ViewModel_OnOpenFilePopup(FileViewModel file, ProgressTracker tracker)
 {
     var videoFilePopup = new VideoFilePopup(file);
     SetupPopup(videoFilePopup);
 }
コード例 #7
0
        public void GetStreamUrl(FileViewModel context, Action<Uri> action)
        {
            var transaction = ProgressTracker.StartNewTransaction();

            RestApi.StreamFile(context.File.FileID, response =>
            {
                ProgressTracker.CompleteTransaction(transaction);
                action(response.ResponseUri);
            });
        }
コード例 #8
0
        public void ConvertToMp4(FileViewModel context, Action action)
        {
            var transaction = ProgressTracker.StartNewTransaction();

            RestApi.FileToMp4(context.File.FileID, response =>
            {
                ProgressTracker.CompleteTransaction(transaction);
                action();
            });
        }
コード例 #9
0
        public void GetMp4Status(FileViewModel context, Action<Mp4Status, int> action)
        {
            var transaction = ProgressTracker.StartNewTransaction();

            RestApi.Mp4Status(context.File.FileID, response =>
            {
                ProgressTracker.CompleteTransaction(transaction);
                action(response.Data.ToMp4Status(), response.Data.mp4.percent_done);
            });
        }