private static void LooseMass(Materials material) { var result = false; var mass = 0.0; while (!result) { var dialog = new InputBox { Caption = string.Format("Введите массу {0} в килограммах:", material.ToGenitive()), ShowInTaskbar = false, Topmost = true }; var showDialog = dialog.ShowDialog(); if (!showDialog.HasValue || !showDialog.Value) { return; } result = double.TryParse(dialog.ResponseText, NumberStyles.Number, CultureInfo.InstalledUICulture, out mass); } var substance = Tube.FindSubstance <Навеска>(material); substance.G = mass / 1000.0; }