/// <summary> /// Initializes a new instance of the <see cref="MainViewModel"/> class. /// </summary> /// <param name="downloadReportCommand"> /// The download report command. /// </param> /// <param name="ignoreCommand"> /// The ignore command. /// </param> /// <param name="openUriCommand"> /// The open uri command. /// </param> /// <param name="clipboardCommand"> /// The clipboard command. /// </param> /// <param name="daily"> /// The daily. /// </param> /// <param name="monthly"> /// The monthly. /// </param> /// <param name="settingsViewModel">Settings viewmodel.</param> public MainViewModel( IDownloadReportCommand downloadReportCommand, IBaseCommand ignoreCommand, OpenUriCommand openUriCommand, IBaseCommand clipboardCommand, DailyViewModel daily, MonthlyViewModel monthly, SettingsViewModel settingsViewModel) { downloadReportCommand.ReportDownloaded += this.ReportDownloaded; downloadReportCommand.Executing += (sender, args) => { this.IsBusy = true; }; this.DownloadReportCommand = downloadReportCommand; ignoreCommand.Executed += (sender, args) => { this.Error = null; }; this.IgnoreCommand = ignoreCommand; this.OpenUriCommand = openUriCommand; this.ClipboardCommand = clipboardCommand; this.daily = daily; this.monthly = monthly; this.settings = settingsViewModel; }
private static SettingsViewModel CreateInvalidSettingsViewModel(ISettings fakeSettings) { const string AnyValue = "a"; const string AnyInvalidIntValue = ""; var settingsViewModel = new SettingsViewModel(fakeSettings); settingsViewModel.UserName = AnyValue; settingsViewModel.Password = AnyValue; settingsViewModel.Address = AnyValue; settingsViewModel.TimeoutText = AnyInvalidIntValue; return settingsViewModel; }
private void InitializeMainWindow() { var settings = new Settings(); var downlodReportCommand = new DownloadReportCommand(new ReportDownloader(), settings); var daily = new DailyViewModel(downlodReportCommand); var monthly = new MonthlyViewModel(downlodReportCommand); var settingsViewmodel = new SettingsViewModel(settings); var ignoreCommand = new Command(); var openUriCommand = new OpenUriCommand(); var clipboardCommand = new CopyErrorReportToClipboardCommand(new SystemClipboard()); this.MainWindow = new MainWindow(); this.MainWindow.DataContext = new MainViewModel(downlodReportCommand, ignoreCommand, openUriCommand, clipboardCommand, daily, monthly, settingsViewmodel); }