Beispiel #1
0
 private void OnDocumentAdded(IDocumentObject document)
 {
     if (DocumentAdded != null)
     {
         DocumentAdded.Invoke(this, new DocumentEventArgs(document));
     }
 }
Beispiel #2
0
        internal async Task AddFileAsync(IStorageItem file)
        {
            if (file != null)
            {
                string faToken  = StorageApplicationPermissions.FutureAccessList.Add(file);
                var    document = new RdlnDocument
                {
                    Id    = Guid.NewGuid().ToString(),
                    Path  = file.Path,
                    Name  = file.Name,
                    Title = file.Name,
                    Token = faToken
                };

                var documentWasChanged = await _documentService.FillDocumentDataAsync(document).ConfigureAwait(true);

                if (documentWasChanged)
                {
                    var count = DatabaseManager.Connection.Insert(document);

                    if (count > 0)
                    {
                        GroupedDocuments.Add(document);

                        DocumentAdded?.Invoke(this, document);

                        RaisePropertyChanged(nameof(LibraryIsEmpty));
                    }
                }
            }
        }
        public void addDocument(String file)
        {
            file = normalizePath(file);
            int index = recentDocumentList.IndexOf(file);

            if (index != -1)
            {
                recentDocumentList.RemoveAt(index);
                recentDocumentList.Insert(0, file);
                if (DocumentReaccessed != null)
                {
                    DocumentReaccessed.Invoke(file);
                }
            }
            else
            {
                if (recentDocumentList.Count >= MAX_DOCUMENTS)
                {
                    removeDocument(recentDocumentList[recentDocumentList.Count - 1]);
                }
                recentDocumentList.Insert(0, file);
                if (DocumentAdded != null)
                {
                    DocumentAdded.Invoke(file);
                }
            }
        }
        public void load(String backingFile)
        {
            configFile             = new ConfigFile(backingFile);
            section                = configFile.createOrRetrieveConfigSection("RecentDocuments");
            section.SectionLoaded += new ConfigEvent(section_SectionLoaded);
            section.SectionSaving += new ConfigEvent(section_SectionSaving);

            configFile.loadConfigFile();
            if (DocumentAdded != null)
            {
                for (int i = recentDocumentList.Count - 1; i > -1; --i)//Do list backwards, this will accurately reflect the order the items were accessed
                {
                    DocumentAdded.Invoke(recentDocumentList[i]);
                }
            }
        }
Beispiel #5
0
        internal void AddFileByPattern(IStorageItem file, string pattern, string delimiter)
        {
            if (file != null)
            {
                string faToken  = StorageApplicationPermissions.FutureAccessList.Add(file);
                var    document = new RdlnDocument
                {
                    Id    = Guid.NewGuid().ToString(),
                    Path  = file.Path,
                    Name  = file.Name,
                    Title = file.Name,
                    Token = faToken
                };
                try
                {
                    //var pattern = await ApplicationData.Current.LocalFolder.ReadAsync<string>(Constants.Settings.PATTERN).ConfigureAwait(true);


                    var documentWasChanged = _documentService.FillDocumentDataByPattern(document, pattern, delimiter);

                    //if (documentWasChanged)
                    {
                        var count = DatabaseManager.Connection.Insert(document);

                        if (count > 0)
                        {
                            GroupedDocuments.Add(document);

                            DocumentAdded?.Invoke(this, document);

                            RaisePropertyChanged(nameof(LibraryIsEmpty));
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }
            }
        }
Beispiel #6
0
 public void addDocument(String file)
 {
     if (recentDocumentList.Contains(file))
     {
         recentDocumentList.Remove(file);
         recentDocumentList.Insert(0, file);
         if (DocumentReaccessed != null)
         {
             DocumentReaccessed.Invoke(this, file);
         }
     }
     else
     {
         if (recentDocumentList.Count >= MAX_DOCUMENTS)
         {
             removeDocument(recentDocumentList[recentDocumentList.Count - 1]);
         }
         recentDocumentList.Insert(0, file);
         if (DocumentAdded != null)
         {
             DocumentAdded.Invoke(this, file);
         }
     }
 }
Beispiel #7
0
 private void OnDocumentAdded(DocumentEventArgs e)
 {
     DocumentAdded?.Invoke(this, e);
 }
 protected virtual void OnDocumentAdded(DocumentEventArgs e)
 {
     DocumentAdded?.Invoke(this, e);
 }