public void Initialize() { var mockedObject = MockBasedFactory.Build <ExchangeSettingsViewModel>((IWorkbook) new Workbook(new TestDatabaseContext(), new TestSettings())); this.viewmodel = mockedObject.Object; this.viewmodel.ServerUri = null; }
public ExchangeSettingsPage() { this.InitializeComponent(); this.SetRequestedTheme(); this.workbook = Ioc.Resolve <IWorkbook>(); this.cryptoService = Ioc.Resolve <ICryptoService>(); var navigationService = Ioc.Resolve <INavigationService>(); var synchronizationManager = Ioc.Resolve <ISynchronizationManager>(); var messageBoxService = Ioc.Resolve <IMessageBoxService>(); var trackingManager = Ioc.Resolve <ITrackingManager>(); this.viewModel = new ExchangeSettingsViewModel(this.workbook, navigationService, messageBoxService, synchronizationManager, trackingManager); this.DataContext = this.viewModel; this.Loaded += (s, e) => { // for whatever reason using x:Name does not work here... so we lookup for the control in the visual tree instead var passwordBox = TreeHelper.FindVisualChild <PasswordBox>(this); byte[] password = this.workbook.Settings.GetValue <byte[]>(ExchangeSettings.ExchangePassword); if (password != null) { passwordBox.Password = this.cryptoService.Decrypt(password); } // use an event handler because we cannot use DataBinding with a PasswordBox passwordBox.PasswordChanged += this.OnPasswordChanged; }; }
public SettingsViewModel(AnalyserSettingsViewModel analyserViewModel, ExchangeSettingsViewModel exchangeViewModel, ThemeSettingsViewModel themeViewModel) { AnalyserSettingsViewModel = analyserViewModel; ExchangeSettingsViewModel = exchangeViewModel; ThemeSettingsViewModel = themeViewModel; }
private void ShowExchangeSettingsView() { var exchangeSettings = EmailAccount.EmailAccountSettings is ExchangeSettings settings ? settings : new ExchangeSettings(); exchangeSettings.Validate(); exchangeSettingsViewModel = exchangeSettingsViewModelFactory.CreateExport().Value; exchangeSettingsViewModel.Model = exchangeSettings; editEmailAccountViewModel.ContentView = exchangeSettingsViewModel.View; }
public MainViewModel() { Tabs = new ObservableCollection <ViewModelBase>(); SettingsViewModel = new ExchangeSettingsViewModel(_exchangeManager); SettingsService = SettingsViewModel.SettingsService; Exchanges = new ObservableCollection <ExchangeViewModel>(); if (!DesignerProperties.GetIsInDesignMode(new DependencyObject())) { CommandToolBarViewModel = new CommandToolBarViewModel(this, _exchangeManager, SettingsViewModel); RequestViewModel = new RequestViewModel(this, ExchangeManager); AddressViewModel = new AddressViewModel(_exchangeManager, this); OrderNotificationWindowViewModel = new OrderNotificationWindowViewModel(this, _exchangeManager); OrderNotificationWindow = new OrderNotificationWindow { DataContext = OrderNotificationWindowViewModel }; ExchangeLoader.LoadExchanges(ExchangeManager); // Exchanges foreach (var exchangeBase in ExchangeManager.Exchanges) { var exchangeViewModel = new ExchangeViewModel(this, exchangeBase); Exchanges.Add(exchangeViewModel); } // Tabs DashboardViewModel = new DashboardViewModel(ExchangeManager, this); Tabs.Add(DashboardViewModel); foreach (var exchange in Exchanges) { Tabs.Add(exchange); } Tabs.Add(AddressViewModel); Tabs.Add(RequestViewModel); Tabs.Add(SettingsViewModel); CreateTimer(); } }
private void ShowExchangeSettingsView() { ExchangeSettings exchangeSettings = EmailAccount.EmailAccountSettings is ExchangeSettings ? (ExchangeSettings)EmailAccount.EmailAccountSettings : new ExchangeSettings(); exchangeSettingsViewModel = exchangeSettingsViewModelFactory.CreateExport().Value; exchangeSettingsViewModel.Model = exchangeSettings; editEmailAccountViewModel.ContentView = exchangeSettingsViewModel.View; }
private void ShowExchangeSettingsView() { ExchangeSettings exchangeSettings = EmailAccount.EmailAccountSettings is ExchangeSettings ? (ExchangeSettings)EmailAccount.EmailAccountSettings : new ExchangeSettings(); exchangeSettingsViewModel = container.GetExportedValue<ExchangeSettingsViewModel>(); exchangeSettingsViewModel.Model = exchangeSettings; editEmailAccountViewModel.ContentView = exchangeSettingsViewModel.View; }
public CommandToolBarViewModel(MainViewModel mainViewModel, ExchangeManager exchangeManager, ExchangeSettingsViewModel settings) : base(exchangeManager) { MainViewModel = mainViewModel; this.Settings = settings; Settings.SettingsService.SettingsLoaded += SettingsServiceOnSettingsLoaded; Settings.SettingsService.SettingsUnloaded += SettingsServiceOnSettingsUnloaded; }