private void InitializeTreeViewReceipt() { treeViewReceipt.Items.Clear(); comboBoxCurrencies.IsEnabled = false; int count; Decimal totalPrice = 0; for (int i = 0; i < houseObjects.Count; i++) { count = 1; int j = i + 1; while (j < houseObjects.Count && CheckEquivalenceBetweenObjects(houseObjects[i], houseObjects[j])) { count++; j++; } i = j - 1; totalPrice += count * houseObjects[i].Price; TreeViewItem item = new TreeViewItem(); Decimal initialPrice = CurrencyHelper.FromCurrencyToCurrency(CurrencyHelper.GetDefaultCurrency(), houseObjects[i].InitialPrice, currentCurrency); //initialPrice = CurrencyHelper.FromCurrencyToCurrency(lastCurrency, initialPrice, currentCurrency); Decimal materialsPrice = CurrencyHelper.FromCurrencyToCurrency(CurrencyHelper.GetProjectCurrency(), houseObjects[i].MaterialsPrice, currentCurrency); Decimal totalObjectPrice = CurrencyHelper.FromCurrencyToCurrency(CurrencyHelper.GetProjectCurrency(), houseObjects[i].Price, currentCurrency); HouseObjectUserControl houseObject = new HouseObjectUserControl(count, houseObjects[i].Name, ConvertValueToDisplay(initialPrice), ConvertValueToDisplay(materialsPrice), ConvertValueToDisplay(totalObjectPrice)); houseObject.Tag = houseObjects[i]; item.Header = houseObject; List <WorldObjectMaterial> currentObjectMaterials = houseObjects[i].GetMaterials(); InitializeMaterialHeaders(item); for (int k = 0; k < currentObjectMaterials.Count; k++) { TreeViewItem materialItem = new TreeViewItem(); Decimal totalPriceMaterial = Convert.ToDecimal(currentObjectMaterials[k].SurfaceNeeded) * currentObjectMaterials[k].Material.Price; totalPriceMaterial = CurrencyHelper.FromCurrencyToCurrency(CurrencyHelper.GetDefaultCurrency(), totalPriceMaterial, currentCurrency); Decimal materialPrice = CurrencyHelper.FromCurrencyToCurrency(CurrencyHelper.GetDefaultCurrency(), currentObjectMaterials[k].Material.Price, currentCurrency); MaterialUserControl material = new MaterialUserControl(currentObjectMaterials[k].Material.FullPath, currentObjectMaterials[k].Material.Name, ConvertValueToDisplay(materialPrice), ConvertValueToDisplay(Convert.ToDecimal(currentObjectMaterials[k].SurfaceNeeded)), ConvertValueToDisplay(totalPriceMaterial)); materialItem.Header = material; item.Items.Add(materialItem); } treeViewReceipt.Items.Add(item); } textBlockTotalPrice.Text = ConvertValueToDisplay(totalPrice); }
void SchemeCreator_MouseUp(object sender, MouseEventArgs e) { if (PrimaryRect.Contains(e.Location)) { _ActiveKey = _PrimaryKey; Zustand = 0; HoveredIndex = -1; } if (LightPrimaryRect.Contains(e.Location)) { _ActiveKey = _PrimaryKey; Zustand = 1; HoveredIndex = -1; } if (DarkPrimaryRect.Contains(e.Location)) { _ActiveKey = _PrimaryKey; Zustand = 2; HoveredIndex = -1; } if (AccentRect.Contains(e.Location)) { _ActiveKey = _AccentKey; Zustand = 3; HoveredIndex = -1; } if (TextShadeRect.Contains(e.Location)) { _ActiveKey = _TextShadeKey; Zustand = 4; HoveredIndex = -1; } if (FabRect.Contains(e.Location)) { MaterialUserControl objSaveControl = new MaterialUserControl(); objSaveControl.Width = 400; objSaveControl.Padding = new Padding(10); MaterialSingleLineTextField objText = new MaterialSingleLineTextField(); objText.Dock = DockStyle.Top; objText.Hint = "Geben sie einen Namen für das Farbschema ein:"; objText.TextChanged += objText_TextChanged; objSaveControl.Height = 70; objSaveControl.Controls.Add(objText); if (MaterialDialog.Show("Neues Farbschema Speichern", objSaveControl, MaterialDialog.Buttons.OKCancel) == System.Windows.Forms.DialogResult.OK) { MaterialSkinManager.Instance.ColorSchemes.add(new ColorSchemePreset() { Name = SchemeName, AccentColor = _Accent, DarkPrimaryColor = _PrimaryDark, LightPrimaryColor = _PrimaryLight, PrimaryColor = _Primary, TextShade = _Text }); } _BaseForm.Activate(); objAnimationManager.StartNewAnimation(AnimationDirection.Out); return; } if (HoveredIndex >= 0) { switch (Zustand) { case 0: _Primary = (Primary)ColorRectangles[_ActiveKey][HoveredIndex].Tag; break; case 1: _PrimaryLight = (Primary)ColorRectangles[_ActiveKey][HoveredIndex].Tag; break; case 2: _PrimaryDark = (Primary)ColorRectangles[_ActiveKey][HoveredIndex].Tag; break; case 3: _Accent = (Accent)ColorRectangles[_ActiveKey][HoveredIndex].Tag; break; case 4: _Text = (TextShade)ColorRectangles[_ActiveKey][HoveredIndex].Tag; break; } objPreview.setSchemeToPreview(new ColorScheme(_Primary, _PrimaryDark, _PrimaryLight, _Accent, _Text)); } Invalidate(); }