public SettingsTabViewModel(ViewModel.MainWindowViewModel parentViewModel) { logger.Debug("Constructor of SettingsTabViewModel called"); logger.Debug("Is parent viewmodel null: " + (parentViewModel == null ? "true" : "false")); SettingsList = new ObservableCollection<TabItem>(); ArticleUnits = new ObservableCollection<Core.Utils.Unit>(); PaymentMethodes = new ObservableCollection<Core.Utils.PaymentMethode>(); DocumentFolder = new ObservableCollection<Core.Models.DocumentFolderModel>(); RegisteredExportClasses = new ObservableCollection<Core.Interfaces.IExport>(); PreferedExportClasses = new ObservableCollection<Core.Models.DocumentExportModel>(); RegisteredPlugins = new ObservableCollection<Interface.IPlugIn>(); RegisteredDatabases = new ObservableCollection<Core.Models.DatabaseUIModel>(); KeyValueStore = new Core.Utils.KeyValueStore(); logger.Debug("Creating new UnitTabItem"); SettingsList.Add(new SettingsList.UnitSettings.UnitTabItem()); SettingsList.Add(new SettingsList.PaymentSettings.PaymentTabItem()); SettingsList.Add(new SettingsList.TaxClassSettings.TaxClassTabItem()); SettingsList.Add(new SettingsList.ShipmentSettings.ShipmentTabItem()); TabContent = new SettingsTabContent() { DataContext = this }; RibbonTabItem = new SettingsTabRibbonTabItem(this) { DataContext = this }; ParentViewModel = parentViewModel; SelectedUnit = new Core.Utils.Unit(); SelectedPaymentMethode = new Core.Utils.PaymentMethode(); SelectedTaxClass = new Core.Utils.TaxClass(); SelectedShipment = new Core.Utils.Shipment(); logger.Info("Finished constructor of SettingsTabViewModel"); }
/// <summary> /// Selected item changed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { if ((sender as ListView).SelectedItem != null) { var selected = (sender as ListView).SelectedItem as Core.Utils.Unit; var temp = new Core.Utils.Unit() { Name = selected.Name, DecimalDigits = selected.DecimalDigits, DecimalSeperator = selected.DecimalSeperator, ShortName = selected.ShortName, ThousandSeperator = selected.ThousandSeperator }; (DataContext as SettingsTabViewModel).SelectedUnit = temp; } }