private void elmGroups_SelectionChanged(object sender, SelectionChangedEventArgs e) { gr g = (gr)elm_groups.SelectedValue; if (g == null) return; currentGroup = model.elmGroups.Find(x => x.Mat == g.mat && x.Prf == g.prf); SuplName = currentGroup.SupplierName; Supl supl = new Supl(currentGroup.SupplierName); Supl_CS_Mat_Prf.Text = SuplName + "\t" + currentGroup.CompSetName; string str = "Адрес: "; if (!string.IsNullOrEmpty(supl.Index)) str += supl.Index + ", "; str += supl.City + ", "; if (str.Length > 20) str += "\n"; str += supl.Street + "\nтел." + supl.Telephone; Supl_CS.Text = str; //--2017.07.26 не вполне работает Hyperlink- нет вызова сайта при клике. Пока оставил так.. Supl_URL.Inlines.Clear(); Run myURL = new Run(supl.Url); Hyperlink hyperl = new Hyperlink(myURL); Supl_URL.Inlines.Add(hyperl); //-- double p = 0, w = 0, v = 0; foreach (var gr in model.elmGroups) { if (gr.SupplierName != currentGroup.SupplierName) continue; w += gr.totalWeight; v += gr.totalVolume; p += gr.totalPrice; } TotalSupl_weight_volume.Text = String.Format("Общий вес= {0:N1} кг, объем = {1:N1} м3", w, v); string sP = string.Format("{0:N2}", p); TotalSupl_price.Text = "Цена по этому поставщику " + sP + " руб"; MWmsg("MainWindow msg Group selection"); elm_groups.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal , new NextPrimeDelegate(HighLighting)); }
private void WrReportPanel() { grMat.Header = Msg.S("WPF_MainWindow_grMat"); grPrf.Header = Msg.S("WPF_MainWindow_grPrf"); grPrice.Header = Msg.S("WPF_MainWindow_grPrice"); grVol.Header = Msg.S("WPF_MainWindow_grVolume"); grWgt.Header = Msg.S("WPF_MainWindow_grWeight"); grLng.Header = Msg.S("WPF_MainWindow_grLength"); grSupl.Header = Msg.S("WPF_MainWindow_grSupplier"); List<gr> items = new List<gr>(); foreach (var gr in model.elmGroups) { string sPrice = String.Format("{0, 14:N2}", gr.totalPrice); string sWgt = String.Format("{0, 10:N1}", gr.totalWeight); string sVol = String.Format("{0, 10:N3}", gr.totalVolume); string sLng = String.Format("{0, 10:N1}", gr.totalLength / 1000); string sSupl = string.IsNullOrEmpty(gr.SupplierName) ? "---" : gr.SupplierName; var g = new gr() { mat = gr.Mat, prf = gr.Prf, price = sPrice, wgt = sWgt, vol = sVol, lng = sLng, //27/7 supl = gr.SupplierName}; supl = sSupl }; items.Add(g); } elm_groups.ItemsSource = items; double totalPrice = 0.0; foreach (var gr in model.elmGroups) totalPrice += gr.totalPrice; string st = string.Format("Общая цена проекта {0:N0} руб", totalPrice); ModPriceSummary.Text = st; //--TMP!! List<string> suppliers = new List<string>() { "СтальХолдинг", "ЛенСпецСталь", "База СЕВЗАПМЕТАЛЛ", "ГК Монолит СПб" }; grSupl.ItemsSource = suppliers; }