public void SetTask(CloudTask task)
 {
     try
     {
         NeverEnds = false;
         Task = task;
     }
     catch
     {
         Never();
     }
 }
Exemple #2
0
 protected void Page_Init(object sender, EventArgs e)
 {
     if (!(CurrentUser = Request.GetUser()).Browse)
     {
         Response.StatusCode = 401;
         return;
     }
     if (InfoDirectory.Exists)
     {
         Views.SetActiveView(DirectoryView);
         if (IsPostBack)
         {
             return;
         }
         var dirs = InfoDirectory.EnumerateDirectories().ToList();
         DirectoryList.DataSource = dirs;
         DirectoryList.DataBind();
         DirectoryCount = dirs.Count.ToString(CultureInfo.InvariantCulture);
         var files = InfoDirectory.EnumerateFiles().ToList();
         FileList.DataSource = files;
         FileList.DataBind();
         FileCount            = files.Count.ToString(CultureInfo.InvariantCulture);
         ArchiveFilePath.Text = string.IsNullOrWhiteSpace(RelativePath) ? "Files.7z" : (RelativePath + ".7z");
     }
     else if (InfoFile.Exists)
     {
         string dataPath = FileHelper.GetDataFilePath(RelativePath), state = FileHelper.GetFileValue(dataPath, "state");
         Task = GenerateFileTask.Create(RelativePath);
         if (Task == null)
         {
             if (state == TaskType.NoTask)
             {
                 if (Request.IsAjaxRequest())
                 {
                     Response.Redirect(Request.RawUrl, true);                          // processing is finished
                 }
                 Views.SetActiveView(FileView);
                 Mime = FileHelper.GetDefaultMime(dataPath);
                 RefreshFile();
             }
             else
             {
                 Views.SetActiveView(GeneralTaskProcessingView);
             }
         }
         else if (state == TaskType.UploadTask)
         {
             Views.SetActiveView(FileUploadingView);
         }
         else
         {
             Viewer.SetTask(Task);
             Views.SetActiveView(FileProcessingView);
         }
     }
     else
     {
         Views.SetActiveView(GoneView);
         Response.StatusCode = 404;
     }
 }
Exemple #3
0
 protected void Page_Init(object sender, EventArgs e)
 {
     if (!(CurrentUser = Request.GetUser()).Browse)
     {
         Response.StatusCode = 401;
         return;
     }
     if (InfoDirectory.Exists)
     {
         Views.SetActiveView(DirectoryView);
         if (IsPostBack) return;
         var dirs = InfoDirectory.EnumerateDirectories().ToList();
         DirectoryList.DataSource = dirs;
         DirectoryList.DataBind();
         DirectoryCount = dirs.Count.ToString(CultureInfo.InvariantCulture);
         var files = InfoDirectory.EnumerateFiles().ToList();
         FileList.DataSource = files;
         FileList.DataBind();
         FileCount = files.Count.ToString(CultureInfo.InvariantCulture);
         ArchiveFilePath.Text = string.IsNullOrWhiteSpace(RelativePath) ? "Files.7z" : (RelativePath + ".7z");
     }
     else if (InfoFile.Exists)
     {
         string dataPath = FileHelper.GetDataFilePath(RelativePath), state = FileHelper.GetFileValue(dataPath, "state");
         Task = GenerateFileTask.Create(RelativePath);
         if (Task == null)
             if (state == TaskType.NoTask)
             {
                 if (Request.IsAjaxRequest()) Response.Redirect(Request.RawUrl, true); // processing is finished
                 Views.SetActiveView(FileView);
                 Mime = FileHelper.GetDefaultMime(dataPath);
                 RefreshFile();
             }
             else Views.SetActiveView(GeneralTaskProcessingView);
         else if (state == TaskType.UploadTask) Views.SetActiveView(FileUploadingView);
         else
         {
             Viewer.SetTask(Task);
             Views.SetActiveView(FileProcessingView);
         }
     }
     else
     {
         Views.SetActiveView(GoneView);
         Response.StatusCode = 404;
     }
 }