private void Instance_DocumentChanged(object sender, DocumentChangedEventArgs e) { this.currentDocumentTextBlock.Text = e.Document.Name; this.documentExposerViewModel = new DocumentExposerViewModel(e.Document); this.listViewComponents.ItemsSource = this.documentExposerViewModel.Components; this.listViewComponents.SelectionChanged += ListViewComponents_SelectionChanged; }
void OnDocumentChanged( object sender, DocumentChangedEventArgs e) { // this does not work, because the handler will // be called each time a new instance is added, // overwriting the previous ones recorded: //_added_element_ids = e.GetAddedElementIds(); _added_element_ids.AddRange( e.GetAddedElementIds() ); }
private void DocumentChanged(object sender, DocumentChangedEventArgs args) { var newDocument = DocumentUiContainer.DocumentUI; foreach (ListViewItem listViewItem in listView.Items) { var oldFindResult = ((FindResult)listViewItem.Tag); var newFindResult = oldFindResult.ChangeDocument(newDocument); if (newFindResult.Equals(oldFindResult)) { continue; } listViewItem.SubItems[colHdrDisplayText.Index].Text = newFindResult.FindMatch.DisplayText; listViewItem.Font = newFindResult.IsValid ? listView.Font : new Font(listView.Font, FontStyle.Strikeout); listViewItem.Tag = newFindResult; } }
void LogPanel_DocumentChanged(object sender, DocumentChangedEventArgs args) { Documents.ILoggingDocument logDoc = args.New as Documents.ILoggingDocument; if (logDoc != null) { richTextBox1.Text = ""; logDoc.LogAppended += logDoc_LogAppended; foreach (string str in logDoc.Log) { richTextBox1.Text += str + "\r\n"; } } else { richTextBox1.Text = ""; } }
static void OnDocumentChanged(object sender, DocumentChangedEventArgs e) { Document doc = e.GetDocument(); View view = FindElevationView(doc, e.GetAddedElementIds()); if (null != view) { string msg = string.Format("You just create an" + "elevation view '{0}'. Are you" + "sure you want to do that? " + "Elevations don't show hidden line" + "detail, which makes them unsuitable" + "for core wall elevations etc.", view.Name); TaskDialog.Show("ElevationChecker", msg); } }
/// <summary> /// Обработка события DocumentChanged /// </summary> private void OnDocumentChanged(object sender, DocumentChangedEventArgs e) { Document doc = e.GetDocument(); View view = FindElevationView( doc, e.GetAddedElementIds()); if (null != view) { string msg = string.Format( "Вы только что создали новый вид Фасад " + " '{0}'.", view.Name); TaskDialog.Show("ElevationChecker", msg); } }
public void OnChanged(object sender, DocumentChangedEventArgs e) { if (running) { return; } Document doc = e.GetDocument(); if (docdict.ContainsKey(doc)) { countdown = 0; relinquish = false; sync = false; close = false; } }
private void OnDocumentChanged(object sender, DocumentChangedEventArgs e) { try{ setInfos(e); // get deleted elements ID if (e.Operation == UndoOperation.TransactionCommitted) { if (e.GetTransactionNames()[0] == "”далить выбранные" || e.GetTransactionNames()[0] == "Delete selection") { foreach (var item in e.GetDeletedElementIds()) { if (!addedList.Contains(item)) { deletedList.Add(new DeletedElement(item.IntegerValue.ToString(), documentName, username)); } } } else if (e.GetTransactionNames()[0] != "ќбновление рабочих наборов до последней версии из хранилища" && e.GetAddedElementIds().Count > 0) { addedList.AddRange(e.GetAddedElementIds().AsEnumerable()); } } // remove deleted elements if the transaction is rolled back else if (e.Operation == UndoOperation.TransactionUndone) { if (e.GetTransactionNames()[0] == "”далить выбранные" || e.GetTransactionNames()[0] == "Delete selection" && deletedList.Count > 0) { foreach (var item in e.GetAddedElementIds()) { try { var removeItem = deletedList.Where(x => x.Id == item.IntegerValue.ToString()).First(); deletedList.Remove(removeItem); } catch { } } } } } catch { } }
/// <summary> /// This is our event handler. Simply report the list of element ids which have been changed. /// </summary> public void UILabs_DocumentChanged(object sender, DocumentChangedEventArgs args) { if (!m_showEvent) { return; } // You can get the list of ids of element added/changed/modified. Document rvtdDoc = args.GetDocument(); ICollection <ElementId> idsAdded = args.GetAddedElementIds(); ICollection <ElementId> idsDeleted = args.GetDeletedElementIds(); ICollection <ElementId> idsModified = args.GetModifiedElementIds(); // Put it in a string to show to the user. string msg = "Added: "; foreach (ElementId id in idsAdded) { msg += id.IntegerValue.ToString() + " "; } msg += "\nDeleted: "; foreach (ElementId id in idsDeleted) { msg += id.IntegerValue.ToString() + " "; } msg += "\nModified: "; foreach (ElementId id in idsModified) { msg += id.IntegerValue.ToString() + " "; } // Show a message to a user. TaskDialogResult res = default(TaskDialogResult); res = TaskDialog.Show("Revit UI Labs - Event", msg, TaskDialogCommonButtons.Ok | TaskDialogCommonButtons.Cancel); // If the user chooses to cancel, show no more event. if (res == TaskDialogResult.Cancel) { m_showEvent = false; } }
private static void OnDocumentChanged(object sender, DocumentChangedEventArgs args) { if (isCommitting) { return; } var document = args.GetDocument(); if (!document.Equals(ActiveDBDocument)) { return; } CancelReadActions(); DocumentChanged?.Invoke(sender, args); }
private void ElementCreated(object sender, DocumentChangedEventArgs e) { Document doc = e.GetDocument(); string createdElementsIds = ""; ICollection <ElementId> createdElements = e.GetAddedElementIds(); foreach (ElementId eid in createdElements) { string value = "not in dictionary"; dictionaryDB.TryGetValue(eid.IntegerValue, out value); createdElementsIds += String.Format("{0} : {1}\n", eid.IntegerValue, value); } m_MyDock.txtBoxCreated.Text = String.Format("{0} element(s) created: \n{1}", createdElements.Count, createdElementsIds); }
private void ElementDeleted(object sender, DocumentChangedEventArgs e) { string deletedElementsIds = ""; ICollection <ElementId> deletedElements = e.GetDeletedElementIds(); foreach (ElementId eid in deletedElements) { string value = "not in dictionary"; dictionaryDB.TryGetValue(eid.IntegerValue, out value); dictionaryDB.Remove(eid.IntegerValue); deletedElementsIds += String.Format("{0} : {1}\n", eid.IntegerValue, value); } m_MyDock.txtBoxDeleted.Text = String.Format("{0} element(s) deleted: \n{1}", deletedElements.Count, deletedElementsIds); }
/// <summary> /// Perform updates on in-canvas controls. /// In this example, the In-Canvas controls will be deleted, or have their positions changed, depending on the changes to related elements. /// </summary> /// <param name="data">Data about changes in the document.</param> public static void Execute(DocumentChangedEventArgs data) { Document doc = data.GetDocument(); TemporaryGraphicsManager temporaryGraphicsManager = TemporaryGraphicsManager.GetTemporaryGraphicsManager(doc); IssueMarkerTracking tracking = IssueMarkerTrackingManager.GetInstance().GetTracking(doc); foreach (ElementId deleted in data.GetDeletedElementIds()) { if (tracking.GetMarkerByElementId(deleted) is IssueMarker marker) { // This is how to delete control temporaryGraphicsManager.RemoveControl(marker.ControlIndex); // Don't forget to clean up your own data tracking.RemoveMarkerByElement(deleted); } } foreach (ElementId updated in data.GetModifiedElementIds()) { if (tracking.GetMarkerByElementId(updated) is IssueMarker marker) { Element element = doc.GetElement(updated); // Since we keep a copy of InCanvasControlData, we can avoid creating a new one. It already has image and position set - and we can just change the position InCanvasControlData controlData = marker.InCanvasControlData; if (element.Location is LocationPoint pointLoc) { controlData.Position = pointLoc.Point; } else if (element.Location is LocationCurve curveLoc) { controlData.Position = curveLoc.Curve.GetEndPoint(0); } marker.InCanvasControlData = controlData; // This is how to set updated data to a control temporaryGraphicsManager.UpdateControl(marker.ControlIndex, marker.InCanvasControlData); } } }
private void ViewCreated(object sender, DocumentChangedEventArgs e) { Document doc = e.GetDocument(); ICollection <ElementId> createdElements = e.GetAddedElementIds(); foreach (ElementId eid in createdElements) { Element ele = doc.GetElement(eid); if (ele.Category.Name == "Views") { viewToOpen = ele as View; m_MyDock.labelView.Text = String.Format("{0} {1}", ele.Name, eid.ToString()); } else { m_MyDock.labelView.Text = "-"; } } }
private void Application_DocumentChanged(object sender, DocumentChangedEventArgs e) { if (MainWindow != null) { _currentDocument = e.GetDocument(); var hasImports = false; var added = e.GetAddedElementIds(); var removed = e.GetDeletedElementIds(); if (added != null && added.Any()) { foreach (var elementId in added) { if (_currentDocument.GetElement(elementId) is CADLinkType) { hasImports = true; break; } } } if (removed != null && removed.Any() && _dwgImportManagerVm.DwgImportsItems.Any()) { foreach (var elementId in removed) { foreach (var dwgImportsItem in _dwgImportManagerVm.DwgImportsItems) { if (dwgImportsItem.Id.Equals(elementId)) { hasImports = true; break; } } } } if (hasImports) { SearchImportsAndBind(true); } } }
/// <summary> /// Method executes when (user in) AvalonDock has (loaded) selected another document. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnActiveDocumentChanged(object sender, DocumentChangedEventArgs e) { _FilePathName = string.Empty; FileSize = 0; LastModified = DateTime.MinValue; if (e != null) { if (e.ActiveDocument != null) { if (e.ActiveDocument is IFileBaseViewModel) { IFileBaseViewModel f = e.ActiveDocument as IFileBaseViewModel; if (f.IsFilePathReal == false) // Start page or somethin... { return; } try { if (File.Exists(f.FilePath) == true) { var fi = new FileInfo(f.FilePath); _FilePathName = f.FilePath; this.RaisePropertyChanged(() => this.FileName); FileSize = fi.Length; LastModified = fi.LastWriteTime; FilePath = fi.DirectoryName; } } catch { } } } } }
/// <summary> /// Executes event based when the active (AvalonDock) document changes. /// Determine whether tool window can show corresponding state or not /// and update viewmodel reference accordingly. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnActiveDocumentChanged(object sender, DocumentChangedEventArgs e) { if (e != null) { if (e.ActiveDocument != null) { if (e.ActiveDocument is Log4NetViewModel log4NetVM) { this.Log4NetVM = log4NetVM; // There is an active Log4Net document -> display corresponding content } else { this.Log4NetVM = null; } } } else // There is no active document hence we do not have corresponding content to display { this.Log4NetVM = null; } }
public static void OnDocumentChanged( object InSender, DocumentChangedEventArgs InArgs) { FDirectLink DirectLink = FDirectLink.Get(); Debug.Assert(DirectLink != null); // Handle modified elements foreach (ElementId ElemId in InArgs.GetModifiedElementIds()) { Element ModifiedElement = DirectLink.RootCache.SourceDocument.GetElement(ElemId); if (ModifiedElement.GetType() == typeof(RevitLinkInstance)) { DirectLink.ModifiedLinkedDocuments.Add((ModifiedElement as RevitLinkInstance).GetLinkDocument()); } DirectLink.RootCache.ModifiedElements.Add(ElemId); } }
/// <summary> /// DocumentChanged event handler /// </summary> static void OnDocumentChanged( object sender, DocumentChangedEventArgs e) { Document doc = e.GetDocument(); // To avoid reacting to family import, // ignore family documents: if (doc.IsFamilyDocument) { View view = FindElevationView( doc, e.GetAddedElementIds()); if (null != view) { string msg = string.Format( "You just created an " + "elevation view '{0}'. Are you " + "sure you want to do that? " + "(Elevations don't show hidden line " + "detail, which makes them unsuitable " + "for core wall elevations etc.)", view.Name); TaskDialog.Show("ElevationChecker", msg); // Make sure we see this warning once only // Unsubscribing to the DocumentChanged event // inside the DocumentChanged event handler // causes a Revit message saying "Out of // memory." //doc.Application.DocumentChanged // -= new EventHandler<DocumentChangedEventArgs>( // OnDocumentChanged ); } } }
public void AppEvent_DocChangedEventHandler(object sender, DocumentChangedEventArgs args) { // this.uiApp.Idling -= Main.ActiveModelessForm.UIAppEvent_IdlingEventHandler; this.haltIdlingHandler = true; // Retrieve the addedElement Ids and deletedElement Ids ICollection <ElementId> addedElements = args.GetAddedElementIds(); ICollection <ElementId> deletedElements = args.GetDeletedElementIds(); // Update the dataController's cached elements this.dataController.AddToAllElements(addedElements.ToList()); this.dataController.RemoveFromAllElements(deletedElements.ToList()); this.dataController.SetMode(requestHandler.FilterBy, true); // Put up a request to update the TreeView requestHandler.AddRequest(Request.UpdateTreeView); this.haltIdlingHandler = false; // this.uiApp.Idling += Main.ActiveModelessForm.UIAppEvent_IdlingEventHandler; return; }
public void OnActiveDocumentChanged(object sender, DocumentChangedEventArgs e) { this.mFilePathName = string.Empty; if (e != null) { if (e.ActiveDocument != null) { if (e.ActiveDocument is FileBaseViewModel f) { if (File.Exists(f.FilePath) == true) { var fi = new FileInfo(f.FilePath); this.mFilePathName = f.FilePath; this.RaisePropertyChanged(() => this.FileName); this.RaisePropertyChanged(() => this.FilePath); } } } } }
private void DocumentChanged(object sender, DocumentChangedEventArgs args) { if (_docCallbackShouldThrow) { _wa.RunAssert(() => throw new InvalidOperationException("Unexpected doc change notification")); } else { WriteLine($"Received {args.DocumentID}"); _wa.RunConditionalAssert(() => { lock (_expectedDocumentChanges) { _expectedDocumentChanges.Should() .Contain(args.DocumentID, "because otherwise a rogue notification came"); _expectedDocumentChanges.Remove(args.DocumentID); WriteLine( $"Expecting {_expectedDocumentChanges.Count} more changes ({JsonConvert.SerializeObject(_expectedDocumentChanges)})"); return(_expectedDocumentChanges.Count == 0); } }); } }
protected void OnDocumentChanged(object sender, DocumentChangedEventArgs e) { IDocumentContainer container = (IDocumentContainer)sender; SrmDocument document = container.Document; SrmDocument previous = e.DocumentPrevious; if (StateChanged(document, previous)) { CloseRemovedStreams(document, previous); if (IsLoaded(document)) { EndProcessing(document); } else { if (!IsMultiThreadAware) { int docIndex = document.Id.GlobalIndex; lock (_processing) { // Keep track of the documents being processed, to avoid running // processing on the same document on multiple threads. if (_processing.ContainsKey(docIndex)) { return; } _processing.Add(docIndex, container); } } var loadThread = new Thread(() => OnLoadBackground(container, document)); Interlocked.Increment(ref _activeThreadCount); loadThread.Start(); } } }
protected void OnDocumentChanged(object sender, DocumentChangedEventArgs e) { IDocumentContainer container = (IDocumentContainer)sender; SrmDocument document = container.Document; SrmDocument previous = e.DocumentPrevious; if (StateChanged(document, previous)) { CloseRemovedStreams(document, previous); if (IsLoaded(document)) { EndProcessing(document); } else { if (!IsMultiThreadAware) { int docIndex = document.Id.GlobalIndex; lock (_processing) { // Keep track of the documents being processed, to avoid running // processing on the same document on multiple threads. if (_processing.ContainsKey(docIndex)) { return; } _processing.Add(docIndex, container); } } Action <IDocumentContainer, SrmDocument> loader = OnLoadBackground; loader.BeginInvoke(container, document, loader.EndInvoke, null); } } }
public void OnActiveDocumentChanged(object sender, DocumentChangedEventArgs e) { this.mFilePathName = string.Empty; if (e != null) { if (e.ActiveDocument != null) { if (e.ActiveDocument is FileBaseViewModel) { FileBaseViewModel f = e.ActiveDocument as FileBaseViewModel; if (f.IsFilePathReal == false) // Start page or somethin... { return; } try { if (File.Exists(f.FilePath) == true) { var fi = new FileInfo(f.FilePath); this.mFilePathName = f.FilePath; this.RaisePropertyChanged(() => this.FileName); this.RaisePropertyChanged(() => this.FilePath); } } catch { } } } } }
protected void OnDocumentChanged(object sender, DocumentChangedEventArgs e) { RefreshCache(((IDocumentContainer) sender).Document); }
private void HandleTextChanged(Object sender, DocumentChangedEventArgs<TextEditor> args) { this.mnuUndo.IsEnabled = this._editor.DocumentManager.ActiveDocument != null && this._editor.DocumentManager.ActiveDocument.TextEditor.Control.CanUndo; this.mnuRedo.IsEnabled = this._editor.DocumentManager.ActiveDocument != null && this._editor.DocumentManager.ActiveDocument.TextEditor.Control.CanRedo; }
public void OnDocumentUIChanged(object sender, DocumentChangedEventArgs e) { // Changes to the settings are handled elsewhere if (e.DocumentPrevious != null && ReferenceEquals(DocumentUI.Settings.MeasuredResults, e.DocumentPrevious.Settings.MeasuredResults)) { // Update the graph if it is no longer current, due to changes // within the document node tree. if (Visible && !IsDisposed && !IsCurrent(e.DocumentPrevious != null ? e.DocumentPrevious.Settings : null, DocumentUI.Settings)) { UpdateUI(); } } }
private void OnDocumentChanged(object sender, DocumentChangedEventArgs e) { if (Committing) { return; } var document = e.GetDocument(); if (!document.Equals(ActiveDBDocument)) { return; } CancelReadActions(); var added = e.GetAddedElementIds(); var deleted = e.GetDeletedElementIds(); var modified = e.GetModifiedElementIds(); if (added.Count > 0 || deleted.Count > 0 || modified.Count > 0) { var materialsChanged = modified.Select((x) => document.GetElement(x)).OfType <Material>().Any(); foreach (GH_Document definition in Grasshopper.Instances.DocumentServer) { foreach (var obj in definition.Objects) { if (obj is IGH_Param param) { if (param.SourceCount > 0) { continue; } if (param.Phase == GH_SolutionPhase.Blank) { continue; } if (obj is GH.Parameters.IGH_PersistentGeometryParam persistent) { if (persistent.NeedsToBeExpired(document, added, deleted, modified)) { param.ExpireSolution(false); } } } else if (obj is IGH_Component component) { if (component is GH.Components.DocumentElements) { component.ExpireSolution(false); } else { bool needsToBeExpired = false; foreach (var inputParam in component.Params.Input) { if (inputParam.SourceCount > 0) { continue; } if (inputParam.Phase == GH_SolutionPhase.Blank) { continue; } if (inputParam is GH.Parameters.IGH_PersistentGeometryParam persistent) { if (persistent.NeedsToBeExpired(document, added, deleted, modified)) { needsToBeExpired = true; break; } } } if (needsToBeExpired) { component.ExpireSolution(true); } else { foreach (var outParam in component.Params.Output) { if (outParam is GH.Parameters.IGH_PersistentGeometryParam persistent) { if (persistent.NeedsToBeExpired(document, added, deleted, modified)) { foreach (var r in outParam.Recipients) { r.ExpireSolution(false); } } else if (materialsChanged) { foreach (var goo in outParam.VolatileData.AllData(true)) { if (goo is IGH_PreviewMeshData previewMeshData) { previewMeshData.DestroyPreviewMeshes(); } } } } } } } } } if (definition.Enabled) { definition.NewSolution(false); } } } }
private void SkylineWindow_DocumentUIChangedEvent(object sender, DocumentChangedEventArgs e) { OnDocumentChanged(); }
private void SkylineWindowOnDocumentUIChangedEvent(object sender, DocumentChangedEventArgs documentChangedEventArgs) { UpdateAll(); }
void HandleDocumentCreated(object sender, DocumentChangedEventArgs<TextEditor> args) { args.Document.TextEditor.Control.TextArea.TextView.ElementGenerators.Add(new ValidationErrorElementGenerator(args.Document.TextEditor as WpfEditorAdaptor, this._editor.DocumentManager.VisualOptions)); }
private void SkylineWindowOnDocumentUIChangedEvent(object sender, DocumentChangedEventArgs documentChangedEventArgs) { BeginInvoke(new Action(UpdateUi)); }
/// <summary> /// Called when [document changed]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="Autodesk.Revit.DB.Events.DocumentChangedEventArgs"/> instance containing the event data.</param> /// ReSharper disable once MemberCanBeMadeStatic.Local private void OnDocumentChanged(object sender, DocumentChangedEventArgs e) { // TODO: add you code here }
private void SkylineWindowOnDocumentUIChangedEvent(object sender, DocumentChangedEventArgs documentChangedEventArgs) { UpdateAll(); }
private void HandleValidatorChanged(Object sender, DocumentChangedEventArgs<TextEditor> args) { if (ReferenceEquals(args.Document, this._editor.DocumentManager.ActiveDocument)) { if (args.Document.SyntaxValidator == null) { this.stsSyntaxValidation.Content = "No Syntax Validator available for the currently selected syntax"; } else { this.stsSyntaxValidation.Content = "Syntax Validation available, enable Validate as you Type or select Tools > Validate to validate"; this._editor.DocumentManager.ActiveDocument.Validate(); } } }
void OnDocumentChanged( object sender, DocumentChangedEventArgs e) { _added_element_ids.AddRange( e.GetAddedElementIds() ); }
private static void DocumentChangedEventHandler(object sender, DocumentChangedEventArgs args) { MainToolService.SendDocumentChange(); }
protected void OnDocumentChanged(object sender, DocumentChangedEventArgs e) { IDocumentContainer container = (IDocumentContainer)sender; SrmDocument document = container.Document; SrmDocument previous = e.DocumentPrevious; if (StateChanged(document, previous)) { CloseRemovedStreams(document, previous); if (IsLoaded(document)) EndProcessing(document); else { int docIndex = document.Id.GlobalIndex; lock (_processing) { // Keep track of the documents being processed, to avoid running // processing on the same document on multiple threads. if (_processing.ContainsKey(docIndex)) return; _processing.Add(docIndex, container); } Action<IDocumentContainer, SrmDocument> loader = OnLoadBackground; loader.BeginInvoke(container, document, loader.EndInvoke, null); } } }
private void OnDocumentChanged(object sender, DocumentChangedEventArgs args) { SetDocument(DocumentUIContainer.DocumentUI); }
private void DocumentChanged(object sender, DocumentChangedEventArgs args) { var newDocument = DocumentUiContainer.DocumentUI; foreach (ListViewItem listViewItem in listView.Items) { var oldFindResult = ((FindResult)listViewItem.Tag); var newFindResult = oldFindResult.ChangeDocument(newDocument); if (newFindResult.Equals(oldFindResult)) { continue; } listViewItem.SubItems[colHdrDisplayText.Index].Text = newFindResult.FindMatch.DisplayText; listViewItem.Font = newFindResult.IsValid ? listView.Font : new Font(listView.Font, FontStyle.Strikeout); listViewItem.Tag = newFindResult; } }
/// <summary> /// Raised when the document has changed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <param name="mainPage">Main Window</param> internal static void DocumentChanged(object sender, DocumentChangedEventArgs e, MainPage mainPage) { Document d = e.GetDocument(); }
/// <summary> /// This is our event handler. Simply report the list of element ids which have been changed. /// </summary> public void UILabs_DocumentChanged(object sender, DocumentChangedEventArgs args) { if (!m_showEvent) return; // You can get the list of ids of element added/changed/modified. Document rvtdDoc = args.GetDocument(); ICollection<ElementId> idsAdded = args.GetAddedElementIds(); ICollection<ElementId> idsDeleted = args.GetDeletedElementIds(); ICollection<ElementId> idsModified = args.GetModifiedElementIds(); // Put it in a string to show to the user. string msg = "Added: "; foreach (ElementId id in idsAdded) { msg += id.IntegerValue.ToString() + " "; } msg += "\nDeleted: "; foreach (ElementId id in idsDeleted) { msg += id.IntegerValue.ToString() + " "; } msg += "\nModified: "; foreach (ElementId id in idsModified) { msg += id.IntegerValue.ToString() + " "; } // Show a message to a user. TaskDialogResult res = default(TaskDialogResult); res = TaskDialog.Show("Revit UI Labs - Event", msg, TaskDialogCommonButtons.Ok | TaskDialogCommonButtons.Cancel); // If the user chooses to cancel, show no more event. if (res == TaskDialogResult.Cancel) { m_showEvent = false; } }
void OnDocumentChanged(object sender, DocumentChangedEventArgs e) { _added_element_ids.AddRange(e.GetAddedElementIds()); }
void Application_DocumentChanged(object sender, DocumentChangedEventArgs args) { if (args.GetDocument().Equals(DocumentManager.Instance.CurrentUIDocument.Document)) { processUpdates( args.GetModifiedElementIds(), args.GetDeletedElementIds(), args.GetAddedElementIds()); } }
void OrbitZoomRender_DocumentChanged(object sender, DocumentChangedEventArgs args) { //SetForceFocus(args.New == belongsTo_); }
private static void OnDocumentUIChanged(object sender, DocumentChangedEventArgs e) { }
private void DocumentContainerOnChange(object sender, DocumentChangedEventArgs args) { Document = _documentContainer.Document; }
void Application_DocumentChanged(object sender, DocumentChangedEventArgs args) { var doc = args.GetDocument(); ProcessUpdates( args.GetModifiedElementIds().Select(x => doc.GetElement(x).UniqueId).ToList(), args.GetDeletedElementIds().Select(x => doc.GetElement(x).UniqueId).ToList(), args.GetAddedElementIds().Select(x => doc.GetElement(x).UniqueId).ToList()); }
private static void DocumentChangedEventHandler(object sender, DocumentChangedEventArgs args) { MainToolService.SendDocumentChange(); }
void OnDocumentChanged( object sender, DocumentChangedEventArgs e) { ICollection<ElementId> idsAdded = e.GetAddedElementIds(); int n = idsAdded.Count; Debug.Print( "{0} id{1} added.", n, Util.PluralSuffix( n ) ); // This does not work, because the handler will // be called each time a new instance is added, // overwriting the previous ones recorded: //_added_element_ids = e.GetAddedElementIds(); _added_element_ids.AddRange( idsAdded ); if( _place_one_single_instance_then_abort && 0 < n ) { // Why do we send the WM_KEYDOWN message twice? // I tried sending it once only, and that does // not work. Maybe the proper thing to do would // be something like the Press.OneKey method... // //Press.OneKey( _revit_window.Handle, // (char) Keys.Escape ); // // Nope, that did not work. // // Answer: When you place instances with // PromptForFamilyInstancePlacement, the previous // one remains selected just until you drop the // next one. The first esc key hit removes that // selection while still allowing you to continue // adding instances to the model. Only a second // esc hit aborts the command. Press.PostMessage( _revit_window.Handle, (uint) Press.KEYBOARD_MSG.WM_KEYDOWN, (uint) Keys.Escape, 0 ); Press.PostMessage( _revit_window.Handle, (uint) Press.KEYBOARD_MSG.WM_KEYDOWN, (uint) Keys.Escape, 0 ); } }
public void OnDocumentUIChanged(object sender, DocumentChangedEventArgs e) { // If document changed, close file. if (e.DocumentPrevious == null || !ReferenceEquals(DocumentUI.Id, e.DocumentPrevious.Id)) { _msDataFileScanHelper.ScanProvider.SetScanProvider(null); LoadScan(true, true); } }
void app_DocumentChanged( object sender, DocumentChangedEventArgs e) { if( null == _addedElementIds ) { _addedElementIds = new List<ElementId>(); } _addedElementIds.Clear(); _addedElementIds.AddRange( e.GetAddedElementIds() ); }
private void SkylineWindowOnDocumentUIChangedEvent(object sender, DocumentChangedEventArgs documentChangedEventArgs) { BeginInvoke(new Action(UpdateUi)); }
void ApplicationDocumentChanged(object sender, DocumentChangedEventArgs args) { var doc = args.GetDocument(); var added = args.GetAddedElementIds().Select(x => doc.GetElement(x).UniqueId); var addedIds = args.GetAddedElementIds(); var modified = args.GetModifiedElementIds().Select(x => doc.GetElement(x).UniqueId).ToList(); var deleted = args.GetDeletedElementIds(); ProcessUpdates(doc, modified, deleted, added, addedIds); }
void Application_DocumentChanged(object sender, DocumentChangedEventArgs args) { if (args.GetDocument().Equals(dynRevitSettings.Doc.Document)) { this.processUpdates( args.GetModifiedElementIds(), args.GetDeletedElementIds(), args.GetAddedElementIds() ); } }
/// <summary> /// DocumentChanged event handler /// </summary> static void OnDocumentChanged( object sender, DocumentChangedEventArgs e) { Document doc = e.GetDocument(); // To avoid reacting to family import, // ignore family documents: if( doc.IsFamilyDocument ) { View view = FindElevationView( doc, e.GetAddedElementIds() ); if( null != view ) { string msg = string.Format( "You just created an " + "elevation view '{0}'. Are you " + "sure you want to do that? " + "(Elevations don't show hidden line " + "detail, which makes them unsuitable " + "for core wall elevations etc.)", view.Name ); TaskDialog.Show( "ElevationChecker", msg ); // Make sure we see this warning once only // Unsubscribing to the DocumentChanged event // inside the DocumentChanged event handler // causes a Revit message saying "Out of // memory." //doc.Application.DocumentChanged // -= new EventHandler<DocumentChangedEventArgs>( // OnDocumentChanged ); } } }
private void DocumentChangedEventHandler(object sender, DocumentChangedEventArgs args) { IList<IDocumentChangeListener> listeners; lock (_documentChangedEventHandlers) { listeners = _documentChangedEventHandlers.ToArray(); } foreach (var listener in listeners) { listener.DocumentOnChanged(sender, args); } }
void OnDocumentChanged(object sender, DocumentChangedEventArgs e) { var handler = ClassificationChanged; if (handler != null) handler(this, new ClassificationChangedEventArgs(new SnapshotSpan(Buffer.CurrentSnapshot, e.ChangeStart, e.ChangeEnd - e.ChangeStart))); }