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); } } } }
/// <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); } }
private void OnViewActivating(ViewActivatingEventArgs e) { if (!_appContext.IsConnected) { return; } e.Cancel = IsDialogOpen() && !(e.View is ISystemAssaultScreenView); }
private void OnViewActivating(ViewActivatingEventArgs e) { if (e.View is ISystemAssaultScreenView) { if (IsOpen) { Close(); } } else { if (_shouldBeOpen && !IsOpen) { Show(); } } }
/// <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; } }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
public void OnApplicationViewActivating(object sender, ViewActivatingEventArgs args) { InvokeEventHandler(ViewActivating, sender, args); }
/// <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); } }