Exemplo n.º 1
0
        public static void SetRunEnabledBasedOnContext(ViewActivatingEventArgs e)
        {
            var view = e.NewActiveView as View3D;

            if (view != null &&
                view.IsPerspective &&
                dynSettings.Controller.Context != Context.VASARI_2013 &&
                dynSettings.Controller.Context != Context.VASARI_2014)
            {
                dynSettings.DynamoLogger.LogWarning(
                    "Dynamo is not available in a perspective view. Please switch to another view to Run.",
                    WarningLevel.Moderate);
                dynSettings.Controller.DynamoViewModel.RunEnabled = false;
            }
            else
            {
                dynSettings.DynamoLogger.Log(string.Format("Active view is now {0}", e.NewActiveView.Name));

                // If there is a current document, then set the run enabled
                // state based on whether the view just activated is
                // the same document.
                if (DocumentManager.Instance.CurrentUIDocument != null)
                {
                    dynSettings.Controller.DynamoViewModel.RunEnabled =
                        e.NewActiveView.Document.Equals(DocumentManager.Instance.CurrentDBDocument);

                    if (dynSettings.Controller.DynamoViewModel.RunEnabled == false)
                    {
                        dynSettings.DynamoLogger.LogWarning("Dynamo is not pointing at this document. Run will be disabled.",
                                                            WarningLevel.Error);
                    }
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Handler for Revit's ViewActivating event.
 /// Addins are not available in some views in Revit, notably perspective views.
 /// This will present a warning that Dynamo is not available to run and disable the run button.
 /// This handler is called before the ViewActivated event registered on the RevitDynamoModel.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void OnApplicationViewActivating(object sender, ViewActivatingEventArgs e)
 {
     if (revitDynamoModel != null)
     {
         revitDynamoModel.SetRunEnabledBasedOnContext(e.NewActiveView);
     }
 }
Exemplo n.º 3
0
 private void OnViewActivating(ViewActivatingEventArgs e)
 {
     if (!_appContext.IsConnected)
     {
         return;
     }
     e.Cancel = IsDialogOpen() && !(e.View is ISystemAssaultScreenView);
 }
Exemplo n.º 4
0
 private void OnViewActivating(ViewActivatingEventArgs e)
 {
     if (e.View is ISystemAssaultScreenView)
     {
         if (IsOpen)
         {
             Close();
         }
     }
     else
     {
         if (_shouldBeOpen && !IsOpen)
         {
             Show();
         }
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Callback on Revit view activation. Addins are not available in some views in Revit, notably perspective views.
        /// This will present a warning that Dynamo is not available to run and disable the run button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Application_ViewActivating(object sender, ViewActivatingEventArgs e)
        {
            View3D view = e.NewActiveView as View3D;

            if (view != null && view.IsPerspective)
            {
                DynamoLogger.Instance.LogWarning(
                    "Dynamo is not available in a perspective view. Please switch to another view to Run.",
                    WarningLevel.Moderate);
                dynSettings.Controller.DynamoViewModel.RunEnabled = false;
            }
            else
            {
                //alert the user of the new active view and enable the run button
                DynamoLogger.Instance.LogWarning(string.Format("Active view is now {0}", e.NewActiveView.Name), WarningLevel.Mild);
                dynSettings.Controller.DynamoViewModel.RunEnabled = true;
            }
        }
Exemplo n.º 6
0
 /// <summary>
 ///     Handler for Revit's ViewActivating event.
 ///     Addins are not available in some views in Revit, notably perspective views.
 ///     This will present a warning that Dynamo is not available to run and disable the run button.
 ///     This handler is called before the ViewActivated event registered on the controller.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void Application_ViewActivating(object sender, ViewActivatingEventArgs e)
 {
     SetRunEnabledBasedOnContext(e.NewActiveView);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Handler for Revit's ViewActivating event.
 /// Addins are not available in some views in Revit, notably perspective views.
 /// This will present a warning that Dynamo is not available to run and disable the run button.
 /// This handler is called before the ViewActivated event registered on the RevitDynamoModel.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 internal void OnApplicationViewActivating(object sender, ViewActivatingEventArgs e)
 {
     SetRunEnabledBasedOnContext(e.NewActiveView, true);
 }
Exemplo n.º 8
0
        /// <summary>
        /// Callback on Revit view activation. Addins are not available in some views in Revit, notably perspective views.
        /// This will present a warning that Dynamo is not available to run and disable the run button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Application_ViewActivating(object sender, ViewActivatingEventArgs e)
        {
            var view = e.NewActiveView as View3D;

            if (view != null
                && view.IsPerspective
                && dynSettings.Controller.Context != Context.VASARI_2013
                && dynSettings.Controller.Context != Context.VASARI_2014)
            {
                DynamoLogger.Instance.LogWarning(
                    "Dynamo is not available in a perspective view. Please switch to another view to Run.",
                    WarningLevel.Moderate);
                dynSettings.Controller.DynamoViewModel.RunEnabled = false;
            }
            else
            {
                //alert the user of the new active view and enable the run button
                DynamoLogger.Instance.LogWarning(string.Format("Active view is now {0}", e.NewActiveView.Name), WarningLevel.Mild);
                dynSettings.Controller.DynamoViewModel.RunEnabled = true;
            }
        }
 private void CurrentUIApplication_ViewActivating(object sender, ViewActivatingEventArgs e)
 {
     ((RevitDynamoModel)this.ViewModel.Model).SetRunEnabledBasedOnContext(e.NewActiveView);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Handler for Revit's ViewActivating event.
 /// Addins are not available in some views in Revit, notably perspective views.
 /// This will present a warning that Dynamo is not available to run and disable the run button.
 /// This handler is called before the ViewActivated event registered on the controller.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Application_ViewActivating(object sender, ViewActivatingEventArgs e)
 {
     SetRunEnabledBasedOnContext(e);
 }
Exemplo n.º 11
0
 public void OnApplicationViewActivating(object sender, ViewActivatingEventArgs args)
 {
     InvokeEventHandler(ViewActivating, sender, args);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Handler for Revit's ViewActivating event.
 /// Addins are not available in some views in Revit, notably perspective views.
 /// This will present a warning that Dynamo is not available to run and disable the run button.
 /// This handler is called before the ViewActivated event registered on the RevitDynamoModel.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void OnApplicationViewActivating(object sender, ViewActivatingEventArgs e)
 {
     if (revitDynamoModel != null)
     {
         revitDynamoModel.SetRunEnabledBasedOnContext(e.NewActiveView);
     }
 }