Bcfier.XbimXplorer.MainWindow.OnAddView C# (CSharp) Method

OnAddView() private method

Same as in the windows app, but here we generate a VisInfo that is attached to the view
private OnAddView ( object sender, System.Windows.Input.ExecutedRoutedEventArgs e ) : void
sender object
e System.Windows.Input.ExecutedRoutedEventArgs
return void
        private void OnAddView(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                if (Bcfier.SelectedBcf() == null)
                    return;
                var issue = e.Parameter as Markup;
                if (issue == null)
                {
                    MessageBox.Show("No Issue selected", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                var dialog = new AddViewXbim(issue, Bcfier.SelectedBcf().TempPath, _xpWindow.DrawingControl)
                {
                    WindowStartupLocation = WindowStartupLocation.CenterScreen
                };
                dialog.ShowDialog();
                if (!dialog.DialogResult.HasValue || !dialog.DialogResult.Value)
                    return;

                //generate and set the VisInfo
                issue.Viewpoints.Last().VisInfo = GenerateViewpoint(_xpWindow.DrawingControl);

                //get filename
                var fileName = _xpWindow.GetOpenedModelFileName();
                if (string.IsNullOrEmpty(fileName))
                    fileName = "Unknown";
                issue.Header[0].Filename = fileName;
                Bcfier.SelectedBcf().HasBeenSaved = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error adding a View!", "exception: " + ex);
            }
        }