Interaction logic for AddViewRevit.xaml
Esempio n. 1
0
        /// <summary>
        /// Same as in the windows app, but here we generate a VisInfo that is attached to the view
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        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);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Same as in the windows app, but here we generate a VisInfo that is attached to the view
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        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);
            }
        }