public void UpdatePriceNodes() { _optionsTree.Nodes["PricesNode"].Nodes.Clear(); _optionsTree.Nodes["PricesNode"].Nodes.Add(_pricesGeneralNode); foreach (PaperFormat format in _priceManager.PaperFormats) { foreach (PaperType type in _priceManager.PaperTypes) { Product product; if (_config.EnablePhotoOrdering.Value) { product = _priceManager.GetProduct(format.Name + type.Name); if (product == null) { product = _priceManager.AddProduct(format, type, ""); } _optionsTree.Nodes["PricesNode"].Nodes.Add(product.ToString(), format.Name + " " + type.Name); } if (_priceManager.ContainsProduct(format.Name + type.Name + Constants.InstantKey) && _config.EnablePhotoPrinting.Value) { product = _priceManager.GetProduct(format.Name + type.Name + Constants.InstantKey); _optionsTree.Nodes["PricesNode"].Nodes.Add(product.ToString(), format.Name + " " + type.Name + RM.GetString("InstantPostfix")); } } } }
private void _printersView_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (!_isUpdating) { var key = (KeyValuePair <PaperFormat, PaperType>)_printersView.Rows[e.RowIndex].Tag; string newPrinter = (string)_printersView["PrinterColumn", e.RowIndex].Value; if (PriceManager.ContainsProduct(GetProductKey(key))) { if (string.IsNullOrEmpty(newPrinter)) { PriceManager.RemoveProduct(GetProductKey(key)); } else { PriceManager.GetProduct(GetProductKey(key)).Printer = newPrinter; } } else if (!string.IsNullOrEmpty(newPrinter)) { PriceManager.AddProduct(key.Key, key.Value, newPrinter); } if (Parent is MainForm) { (Parent as MainForm).UpdatePriceNodes(); } } }