internal void UpdateControl() { this.UpdatePosition(); this.txtPrintJobName.Font = FontManager.Montserrat16Regular; if (RenderEngine.PrintJob != null && !string.IsNullOrEmpty(RenderEngine.PrintJob.Name)) { this.txtPrintJobName.Text = RenderEngine.PrintJob.Name; } else { this.txtPrintJobName.Text = "Untitled"; } if (UserProfileManager.UserProfile != null && UserProfileManager.UserProfile.SelectedPrinter != null) { var defaultPrinter = UserProfileManager.UserProfile.SelectedPrinter; if (defaultPrinter != null) { this.cbPrinters.SelectedItem = defaultPrinter; } } if (UserProfileManager.UserProfile != null && UserProfileManager.UserProfile.SelectedMaterial != null) { var defaultMaterial = UserProfileManager.UserProfile.SelectedMaterial; var materialSummary = new MaterialSummary(); if (defaultMaterial != null) { materialSummary.Material = defaultMaterial; var supplierName = string.Empty; foreach (var supplier in MaterialManager.Catalog) { if (supplier.FindMaterialById(defaultMaterial.Id) != null) { supplierName = supplier.Supplier; materialSummary.Supplier = supplierName; break; } } materialSummary.UpdateControl(); this.cbMaterials.SelectedItem = materialSummary; //update model colors ObjectView.UpdateModelColors(defaultMaterial.ModelColor); } } }
private void CbPrinters_DropdownButtonClicked(object sender, EventArgs e) { var currentPrinter = cbPrinters.SelectedItem as AtumPrinter; using (var printerEditor = new frmPrinterEditor()) { if (cbPrinters.SelectedItem != null) { printerEditor.LoadPrinters(cbPrinters.SelectedItem as AtumPrinter); } printerEditor.ShowDialog(this); while (printerEditor.SelectedPrinter == null) { printerEditor.ShowDialog(this); } if (cbPrinters.SelectedItem != printerEditor.SelectedPrinter) { this.SelectedPrinterChanged?.Invoke(printerEditor.SelectedPrinter, null); cbPrinters.SelectedItem = printerEditor.SelectedPrinter; if (printerEditor.SelectedPrinter != null) { UserProfileManager.UserProfiles[0].SelectedPrinter = printerEditor.SelectedPrinter; UserProfileManager.Save(); } } } var selectedPrinter = cbPrinters.SelectedItem as AtumPrinter; if (currentPrinter == null || selectedPrinter.PrinterXYResolution != currentPrinter.PrinterXYResolution || selectedPrinter.GetType() != currentPrinter.GetType()) { var printerMaterials = new BindingList <MaterialsBySupplier>(); foreach (var materialSupplier in MaterialManager.Catalog) { foreach (var material in materialSupplier.GetMaterialsByResolution(selectedPrinter)) { printerMaterials.Add(material); } } if (printerMaterials.Count > 0) { var materialSummary = new MaterialSummary(); materialSummary.Material = printerMaterials.OrderBy(m => m.Materials[0].Name).First().Materials[0]; this.cbMaterials.SelectedItem = materialSummary; ObjectView.UpdateModelColors(materialSummary.Material.ModelColor); if (SceneView.CurrentViewMode == SceneView.ViewMode.MagsAI) { var selectedModel = ObjectView.SelectedModel; if (selectedModel != null) { selectedModel.ChangeTrianglesToBlendViewMode(true); } } UserProfileManager.UserProfile.SelectedMaterial = materialSummary.Material; UserProfileManager.Save(); } } }