コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
 public void ShowSourcePane()
 {
     if (!Documents.Contains(_source_vm))
     {
         Documents.Add(_source_vm);
     }
     ActiveContent = _source_vm;
 }
コード例 #5
0
 public void ShowOutputPane()
 {
     if (!Documents.Contains(_output_vm))
     {
         Documents.Add(_output_vm);
     }
     ActiveContent = _output_vm;
 }
コード例 #6
0
 public void ShowConnectView()
 {
     if (!Documents.Contains(ConnectionPane))
     {
         _documents.Add(ConnectionPane);
     }
     ConnectionPane.IsActive = true;
 }
コード例 #7
0
 public void ShowSearchView()
 {
     if (!Documents.Contains(ConnectionSearcher))
     {
         _documents.Add(ConnectionSearcher);
     }
     ConnectionSearcher.IsActive = true;
 }
コード例 #8
0
 /// <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));
 }
コード例 #9
0
        public DocumentId GetDocumentId(TestHostDocument hostDocument)
        {
            if (!Documents.Contains(hostDocument) && !AdditionalDocuments.Contains(hostDocument))
            {
                return(null);
            }

            return(hostDocument.Id);
        }
コード例 #10
0
ファイル: Workspace.cs プロジェクト: stas990/ProfNet
        public void CloseDocument(object document)
        {
            if (Documents.Contains(document))
            {
                Documents.Remove(document);
            }

            if (ActiveDocument == document)
            {
                ActiveDocument = null;
            }
        }
コード例 #11
0
        protected void AddDocument(ExtensionMemoInfo extensionMemoInfo, string pdfFile)
        {
            if (!Documents.Contains(pdfFile))
            {
                Documents.Add(pdfFile);
            }

            if (!ExtensionToPdfMap.ContainsKey(extensionMemoInfo.TicketNumber))
            {
                ExtensionToPdfMap.Add(extensionMemoInfo.TicketNumber, pdfFile);
            }
        }
コード例 #12
0
ファイル: MainWindow.xaml.cs プロジェクト: jogibear9988/xdraw
        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);
            }
        }
コード例 #13
0
        /// <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;                        //Выставляем дату изменения пакета
        }
コード例 #14
0
        /// <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);
        }
コード例 #15
0
        /// <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));
            }
        }
コード例 #16
0
        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);
                }
            };
        }
コード例 #17
0
 public bool IsDocumentVisible(IViewModel iViewModel)
 {
     return(Documents.Contains(iViewModel));
 }
コード例 #18
0
        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();
        }
コード例 #19
0
        /// <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));
        }
コード例 #20
0
 /// <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));
 }