コード例 #1
0
        public static void ShowPrinters()
        {
            AtumPrinter currentPrinter = null;

            if (UserProfileManager.UserProfile != null && UserProfileManager.UserProfile.SelectedPrinter != null)
            {
                currentPrinter = UserProfileManager.UserProfile.SelectedPrinter;
            }
            using (var printerEditor = new frmPrinterEditor())
            {
                printerEditor.LoadPrinters(currentPrinter);
                printerEditor.ShowDialog();
            }
        }
コード例 #2
0
        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();
                }
            }
        }