private void Page_Loaded(object sender, RoutedEventArgs e) { this.MainGrid.Height = SystemParameters.PrimaryScreenHeight - 160; #region 组织机构 var org = new OrganizationService().GetOrganization(user.SuperAdmin, user.OrgId); this.CbOrganization.DataContext = org; this.CbOrganization.ItemsSource = org; this.CbOrganization.SelectedIndex = 0; #endregion #region 打印机配置 var printers = PrintHelper.GetComputerPrinter(); this.CbPrinter.ItemsSource = printers; var config = new CrystalPrintConfigService().GetCrystalPrintConfig(1, Dns.GetHostName()); if (config != null) { string printer = config.PrinterName; if (!printers.Contains(printer)) { this.CbPrinter.SelectedIndex = -1; this.CbPaperSize.SelectedIndex = -1; } } this.gpConfig.DataContext = config ?? new CrystalPrintConfigModel { MarginRight = 10, MarginLeft = 10, MarginBottom = 0, MarginTop = 0, Orientation = "横向" }; this.CbOrientation.ItemsSource = new List <string> { "横向", "竖向" }; #endregion #region 列表 lists = new CustomerService().GetCustomers(Convert.ToInt32((this.CbOrganization.SelectedItem as OrganizationModel).Id)); this.MainDataGrid.ItemsSource = new ObservableCollection <CustomerModel>(lists); #endregion }
private void Page_Loaded(object sender, RoutedEventArgs e) { PrinterNames = PrintHelper.GetComputerPrinter(); InitializeComponentDefaultValue(); this.MainGrid.Height = SystemParameters.PrimaryScreenHeight - 160; }