private void Calc_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new Microsoft.Win32.SaveFileDialog
            {
                Filter = "HTML Files (*.html)|*.html"
            };

            if (dialog.ShowDialog() == true)
            {
                var comments = _loadComments.LoadComments(filePath);
                _buildComments.BuildComments(_heads, comments);

                Stream fileStream;
                if ((fileStream = dialog.OpenFile()) != null)
                {
                    _outputService.Print(_heads, fileStream, OutputService.PrintFormats.Html);
                    Browser.Source = new Uri(@"file:///" + dialog.FileName);
                    FilePath.Text  = $"Data Saved: {dialog.FileName}";
                }
                else
                {
                    throw new Exception();
                }
            }
        }
Esempio n. 2
0
        private string GetTaskResultByIndex(int index)
        {
            string result;

            OutputService.PrintLine("Input array length");

            if (int.TryParse(InputService.GetUserMsg(), out int number))
            {
                OutputService.PrintLine("Generated array:");
                var arr = GenerateRandomDoubleArray(number);
                for (int i = 0; i < arr.Length; OutputService.Print(arr[i].ToString() + " "), i++)
                {
                    ;
                }
                result = Tasks[index - 1].GetTaskResult(arr);
            }
            else
            {
                result = "Incorrect data";
            }

            return(result);
        }