Ejemplo n.º 1
0
 /// <summary>
 /// Indicate that we are to enter a frame that will take up the specified amount of work. Completes any previous frames (potentially contributing to parent scopes' progress).
 /// </summary>
 /// <param name="expectedWorkThisFrame">The amount of work that will happen between now and the next frame, as a numerator of TotalAmountOfWork.</param>
 /// <param name="text">Optional text to describe this frame's purpose.</param>
 public void EnterProgressFrame(float expectedWorkThisFrame = 1.0f, string text = null)
 {
     using (FStringUnsafe textUnsafe = new FStringUnsafe(text))
     {
         Native_FSlowTask.EnterProgressFrame(Address, expectedWorkThisFrame, ref textUnsafe.Array);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Construct this scope from an amount of work to do, and a message to display
 /// </summary>
 /// <param name="amountOfWork">
 /// Arbitrary number of work units to perform (can be a percentage or number of steps).
 /// 0 indicates that no progress frames are to be entered in this scope (automatically enters a frame encompassing the entire scope)
 /// </param>
 /// <param name="defaultMessage">A message to display to the user to describe the purpose of the scope</param>
 /// <param name="enabled">When false, this scope will have no effect. Allows for proper scoped objects that are conditionally disabled.</param>
 public FScopedSlowTask(float amountOfWork, string defaultMessage = null, bool enabled = true)
 {
     using (FStringUnsafe defaultMessageUnsafe = new FStringUnsafe(defaultMessage))
     {
         Address = Native_FSlowTask.New_FScopedSlowTask(amountOfWork, ref defaultMessageUnsafe.Array, enabled);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Get the frame message or default message if empty
 /// </summary>
 public string GetCurrentMessage()
 {
     using (FStringUnsafe resultUnsafe = new FStringUnsafe())
     {
         Native_FSlowTask.GetCurrentMessage(Address, ref resultUnsafe.Array);
         return(resultUnsafe.Value);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// True if the user has requested that the slow task be canceled
 /// </summary>
 public bool ShouldCancel()
 {
     return(Native_FSlowTask.ShouldCancel(Address));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates a new dialog for this slow task, if there is currently not one open
 /// </summary>
 /// <param name="showCancelButton">Whether to show a cancel button on the dialog or not</param>
 /// <param name="allowInPIE">Whether to allow this dialog in PIE. If false, this dialog will not appear during PIE sessions.</param>
 public void MakeDialog(bool showCancelButton = false, bool allowInPIE = false)
 {
     Native_FSlowTask.MakeDialog(Address, showCancelButton, allowInPIE);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Creates a new dialog for this slow task after the given time threshold. If the task completes before this time, no dialog will be shown.
 /// </summary>
 /// <param name="threshold">Time in seconds before dialog will be shown.</param>
 /// <param name="showCancelButton">Whether to show a cancel button on the dialog or not</param>
 /// <param name="allowInPIE">Whether to allow this dialog in PIE. If false, this dialog will not appear during PIE sessions.</param>
 public void MakeDialogDelayed(float threshold, bool showCancelButton = false, bool allowInPIE = false)
 {
     Native_FSlowTask.MakeDialogDelayed(Address, threshold, showCancelButton, allowInPIE);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Function that finishes any remaining work and removes itself from the global scope stack
 /// </summary>
 public void Destroy()
 {
     Native_FSlowTask.Destroy(Address);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Function that initializes the scope by adding it to its context's stack
 /// </summary>
 public void Initialize()
 {
     Native_FSlowTask.Initialize(Address);
 }
Ejemplo n.º 9
0
 public void Dispose()
 {
     Destroy();// Why do we need to call this? Shouldn't this be called by the dtor? (at least for FScopedSlowTask)
     Native_FSlowTask.Delete(Address);
 }