public AgentViewModel(AgentsViewModel owner, Agent agent)
        {
            _owner = owner;
            _agent = agent;

            ResetForm(true);

            PropertiesAreInitialized = true;
        }
        public MainViewModel(
            TrackerViewModel tracker,
            AgentsViewModel agents,
            SettingsViewModel settings,
            LogsViewModel logs,
            ITrackerScanContext scanContext,
            INotifyIconViewModel notifyViewModel)
        {
            Tabs = new() {
                tracker,
                agents,
                settings,
                logs
            };

            scanContext.ScanProgress.Subscribe(args => {
                if (args.Status == Helpers.TrackerScanStatus.InProgress)
                {
                    ProgressState = TaskbarItemProgressState.Normal;
                    ProgressValue = args.Progress;
                }
                else if (args.Status == Helpers.TrackerScanStatus.InProgressWithErrors)
                {
                    ProgressState = TaskbarItemProgressState.Paused;
                    ProgressValue = args.Progress;
                }
                else if (args.Status == Helpers.TrackerScanStatus.Finished)
                {
                    var message = scanContext.HasNewLowestPrice
                            ? "Prices for some products have become even lower! Check it out."
                            : "Nothing interesting has been caught.";
                    if (scanContext.HasErrors)
                    {
                        message += Environment.NewLine + "NOTE: Some products could not finish scanning properly. Check the logs for details.";
                    }
                    notifyViewModel.ShowBalloonTip("Scan finished", message,
                                                   scanContext.HasErrors ? BalloonIcon.Warning : BalloonIcon.Info);
                    ProgressState = TaskbarItemProgressState.None;
                    ProgressValue = 0;
                }
                else
                {
                    ProgressState = TaskbarItemProgressState.None;
                    ProgressValue = 0;
                }
            });
        }
 public AgentViewModel CreateAgent(AgentsViewModel owner, Agent agent)
 {
     return(new AgentViewModel(owner, agent));
 }