public void OpenDocument(IDocumentTabViewModel document, bool temporary) { if (document == null) { return; } if (Documents.Contains(document)) { SelectedDocument = document; } else { if (TemporaryDocument != null) { CloseDocument(TemporaryDocument); } Documents.Add(document); SelectedDocument = document; if (temporary) { TemporaryDocument = document; } } InvalidateSeperatorVisibility(); }
internal void AddPdf() { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "PDF (*.pdf)|*.pdf"; dialog.RestoreDirectory = true; dialog.Multiselect = true; if (dialog.ShowDialog() != DialogResult.OK || string.IsNullOrEmpty(dialog.FileName)) { return; } string newFile = string.Empty; foreach (var fileName in dialog.FileNames) { newFile = fileName; if (!Documents.Contains(newFile)) { Documents.Add(newFile); } } SelectedDocument = newFile; NotifyButtonChanged(); }
public void MoveNextSelectedContent() { if (_selectedContent == null) { return; } if (Documents.Contains(SelectedContent)) { int indexOfSelecteContent = Documents.IndexOf(_selectedContent); if (indexOfSelecteContent == Documents.Count - 1) { indexOfSelecteContent = 0; } else { indexOfSelecteContent++; } _internalSelect = true; SelectedContent = Documents[indexOfSelecteContent]; _internalSelect = false; } }
public void ShowSourcePane() { if (!Documents.Contains(_source_vm)) { Documents.Add(_source_vm); } ActiveContent = _source_vm; }
public void ShowOutputPane() { if (!Documents.Contains(_output_vm)) { Documents.Add(_output_vm); } ActiveContent = _output_vm; }
public void ShowConnectView() { if (!Documents.Contains(ConnectionPane)) { _documents.Add(ConnectionPane); } ConnectionPane.IsActive = true; }
public void ShowSearchView() { if (!Documents.Contains(ConnectionSearcher)) { _documents.Add(ConnectionSearcher); } ConnectionSearcher.IsActive = true; }
/// <summary> /// Open a document into the view. /// </summary> /// <remarks> /// Open does not involve fetching the document, it merely opens the /// document into the controller. /// </remarks> /// <param name="document">Document to be opened.</param> public void OpenDocument(AbstractDocument document) { if (!Documents.Contains(document)) { Documents.Add(document); } CurrentDocument = document; OnDocumentOpened(this, new DataEventArgs <AbstractDocument>(document)); }
public DocumentId GetDocumentId(TestHostDocument hostDocument) { if (!Documents.Contains(hostDocument) && !AdditionalDocuments.Contains(hostDocument)) { return(null); } return(hostDocument.Id); }
public void CloseDocument(object document) { if (Documents.Contains(document)) { Documents.Remove(document); } if (ActiveDocument == document) { ActiveDocument = null; } }
protected void AddDocument(ExtensionMemoInfo extensionMemoInfo, string pdfFile) { if (!Documents.Contains(pdfFile)) { Documents.Add(pdfFile); } if (!ExtensionToPdfMap.ContainsKey(extensionMemoInfo.TicketNumber)) { ExtensionToPdfMap.Add(extensionMemoInfo.TicketNumber, pdfFile); } }
private void DockManager_DocumentClosed(object sender, DocumentClosedEventArgs e) { var doc = e.Document.Content as IDockDocument; if (doc != null) { doc.DocumentClosed(); } if (Documents.Contains(doc)) { Documents.Remove(doc); } }
/// <summary> /// Добавление материала /// </summary> /// <param name="material"></param> public virtual void AddDocument(ProductionOrderMaterialsPackageDocument material) { ValidationUtils.NotNull(material, "Не указан документ для добавления в пакет материалов заказа."); if (Documents.Contains(material)) { throw new Exception("Этот доккумент уже добавлен в пакет материалов заказа."); } documents.Add(material); //Добавляем материал material.MaterialsPackage = this; ProductionOrderMaterialsPackageSize += material.Size; //Добавляем размер материала к размеру пакета LastChangeDate = DateTime.Now; //Выставляем дату изменения пакета }
/// <summary> /// Gets the media type for the given filename based on /// its extension. /// </summary> /// <param name="filename">The path or filename</param> /// <returns>The media type</returns> public MediaType GetMediaType(string filename) { var extension = Path.GetExtension(filename); if (Documents.Contains(extension)) { return(MediaType.Document); } else if (Images.Contains(extension)) { return(MediaType.Image); } else if (Videos.Contains(extension)) { return(MediaType.Video); } return(MediaType.Unknown); }
/// <summary> /// Remove a document from the view. /// </summary> /// Close does not involve saving the document, it merely removes the /// document from the controller. /// <param name="document">Document to be removed.</param> public void CloseDocument(AbstractDocument document) { if (Documents.Contains(document)) { DocumentClosingEventArgs closeArgs = new DocumentClosingEventArgs(document); OnDocumentClosing(this, closeArgs); if (closeArgs.Cancel) { //TODO: Work out the best way to handle this. return; } if (document.Equals(CurrentDocument)) { CurrentDocument = null; } Documents.Remove(document); OnDocumentClosed(this, new DataEventArgs <AbstractDocument>(document)); } }
private void HandleIsClosed(DockWindowViewModel dockWindow) { dockWindow.IsClosedChanged += (sender, isClosed) => { var changedDocument = sender as DockWindowViewModel; if (changedDocument == null) { return; } _logger.Debug($"IsClosed changed to {isClosed} on {changedDocument.Title}."); if (isClosed && Documents.Contains(changedDocument)) { _logger.Debug($"Removing {changedDocument.Title} from visible windows."); Documents.Remove(changedDocument); } else if (!isClosed && !Documents.Contains(changedDocument)) { _logger.Debug($"Adding {changedDocument.Title} to visible windows."); Documents.Add(changedDocument); } }; }
public bool IsDocumentVisible(IViewModel iViewModel) { return(Documents.Contains(iViewModel)); }
public void CloseDocument(IDocumentTabViewModel document) { if (!Documents.Contains(document)) { return; } IDocumentTabViewModel newSelectedTab = SelectedDocument; if (SelectedDocument == document) { var index = Documents.IndexOf(document); var current = index; bool foundTab = false; while (!foundTab) { index++; if (index < Documents.Count) { foundTab = true; newSelectedTab = Documents[index]; break; } else { break; } } index = current; while (!foundTab) { index--; if (index >= 0) { foundTab = true; newSelectedTab = Documents[index]; break; } else if (index != current) { break; } } if (foundTab) { SelectedDocument = newSelectedTab; } else { SelectedDocument = null; } } if (TemporaryDocument == document) { TemporaryDocument = null; } Documents.Remove(document); Dispatcher.UIThread.InvokeAsync(async() => { await Task.Delay(25); GC.Collect(); }); InvalidateSeperatorVisibility(); }
/// <summary> /// Checks if the given filename has a supported extension. /// </summary> /// <param name="filename">The path or filename</param> /// <returns>If it is supported</returns> public bool IsSupported(string filename) { var extension = Path.GetExtension(filename); return(Documents.Contains(extension) || Images.Contains(extension) || Videos.Contains(extension)); }
/// <summary> /// Check if a document was already added to the project /// </summary> /// <param name="url"></param> /// <returns></returns> private bool ExistDocument(string url) { return(Documents.Contains(url)); }