0

I have one class called TerminalCommandScanUtility.cs with a delegate called ScanUtility:

public static event Action scanUtilityEvent;
public void ScanUtility()
{
    if (scanUtilityEvent != null)
    {
        scanUtilityEvent();
    }
}

In another class called FolderEvent.cs, I listen for this delegate being fired as follows:

bool isScannable;
TerminalCommandScanUtility.scanUtilityEvent += StartFolderScan;

void StartFolderScan()
{
    if(!isScannable)
    {
        return;
    }
    else
    {
        //How can I inform TerminalCommandScanUtility that this folder was scannable, and thus ran?
    }
}

When the scan utility runs, I want it to be able to know that a folder's isScannable variable was true so that I can display some feedback text for the user like "Despite running the function.. nothing was scanned", or "One folder has begun scanning!"

Vranvs
  • 1,411
  • 4
  • 17
  • 38

1 Answers1

0

You need to implement the INotifyPropertyChanged interface for TerminalCommandScanUtility and a corresponding event handler. There is a similar post here.

DrMaxB
  • 540
  • 1
  • 3
  • 13