public BlockOrIgnoreDialog(ApplicationHandler handler) { InitializeComponent(); Handler = handler; AppName.Content = handler.Handled.ProcessName; Blocked = false; }
public void Update() { if (!_blockingEnabled && TotalFreeTime == 60) { TotalFreeTime -= 1; FreeTimeOver(this, new EventArgs()); } else if (!_blockingEnabled) { TotalFreeTime -= 1; } else if (TotalFreeTime <= 0) { _blockingEnabled = true; TotalFreeTime = 0; } var processes = GetProcesses(); foreach (var process in processes) { var handler = GetHandler(process); if (handler == null) { var ignored = IgnoredApps.Contains(process.ProcessName); var blocked = BlockedApps.Contains(process.ProcessName + ".exe"); handler = new ApplicationHandler(process, ignored, blocked); handler.LaunchPrompt += BlockAppPrompt; Handlers.Add(handler); } handler.Update(); } }
public void LoadHandlersIntoManager() { var load = PersistenceManager.LoadHandlers(); var handlerList = new List<ApplicationHandler>(); foreach (var model in load) { var handler = new ApplicationHandler(model); handler.LaunchPrompt += BlockAppPrompt; handlerList.Add(handler); Handlers.Add(handler); } }