Loading plan

Hi, is there a way to get loading progress of a plan? i mean when we do this:

var project = new Project(stream)

@Herrington

To get the loading progress of a project when using the Project class in Aspose.Tasks, you can utilize the LoadOptions class, specifically the CancellationToken property. This allows you to monitor the loading process and potentially cancel it if needed.

Here’s a basic example of how to implement this:

using System;
using System.IO;
using System.Threading;
using Aspose.Tasks;

class Program
{
    static void Main()
    {
        // Create a CancellationTokenSource
        CancellationTokenSource cts = new CancellationTokenSource();
        
        // Set up load options with the cancellation token
        LoadOptions loadOptions = new LoadOptions
        {
            CancellationToken = cts.Token
        };

        // Load the project
        using (var stream = new FileStream("path_to_your_project_file.mpp", FileMode.Open))
        {
            try
            {
                var project = new Project(stream, loadOptions);
                Console.WriteLine("Project Name: " + project.Get(Prj.Name));
            }
            catch (OperationCanceledException)
            {
                Console.WriteLine("Project loading was canceled.");
            }
        }

        // You can call cts.Cancel() from another thread to cancel the loading operation if needed.
    }
}

In this example, the CancellationToken allows you to manage the loading process. If you need to track the progress, you would typically implement additional logic to update the user interface or log the progress based on your specific requirements. However, the Aspose.Tasks library does not provide built-in progress reporting during the loading of a project file.

For more advanced scenarios, consider implementing your own progress tracking mechanism based on the size of the file or the number of tasks being loaded, but this would require additional handling beyond the provided API.

If you have further questions or need more specific examples, feel free to ask!

@Herrington,
there is no loading progress notification API / callbacks.

I’ve attached the corresponding ticket in our internal issue tracking system. The fix will be delivered according to the terms mentioned in Free Support Policies.

Issue ID(s): TASKSNET-11298

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.