示例#1
0
        public void ReadIncludes(XElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException(nameof(element));
            }

            var includesElement = element.Element("Includes");

            if (includesElement == null)
            {
                return;
            }

            var includes = from el in includesElement.Elements("Include") select el;

            foreach (var include in includes)
            {
                var source = (string)include.Attribute("source");

                if (source.IsNullOrEmpty())
                {
                    continue;
                }

                var sourcePath = Path.Combine(SourceDirectory, source);
                sourcePath = Path.GetFullPath(sourcePath);

                Includes.Add(new XmlCoalesceInclude(sourcePath));
            }

            foreach (var include in Includes)
            {
                var asset = XmlCoalesceDocument.Load(include.Source);

                if (!asset.Source.IsNullOrEmpty())
                {
                    Documents.Add(asset);
                }
            }
        }
示例#2
0
        public override void DictDeserialize(IDictionary <string, object> dicts, Scenario scenario = Scenario.Database)
        {
            base.DictDeserialize(dicts, scenario);
            URL           = dicts.Set("URL", URL);
            RootXPath     = dicts.Set("RootXPath", RootXPath);
            IsMultiData   = dicts.Set("IsMultiData", IsMultiData);
            URLFilter     = dicts.Set("URLFilter", URLFilter);
            ContentFilter = dicts.Set("ContentFilter", ContentFilter);
            if (dicts.ContainsKey("HttpSet"))
            {
                var doc2 = dicts["HttpSet"];
                var p    = doc2 as IDictionary <string, object>;
                Http.UnsafeDictDeserialize(p);
            }

            if (dicts.ContainsKey("Login"))
            {
                var doc2 = dicts["Login"];
                var p    = doc2 as IDictionary <string, object>;
                var item = new HttpItem();
                item.DictDeserialize(p);
                Documents.Add(item);
            }

            if (dicts.ContainsKey("Generator"))
            {
                var doc2 = dicts["Generator"];
                var p    = doc2 as IDictionary <string, object>;
            }
            var doc = dicts as FreeDocument;

            if (doc?.Children != null)
            {
                foreach (var child in doc.Children)
                {
                    var item = new CrawlItem();
                    item.DictDeserialize(child);
                    CrawlItems.Add(item);
                }
            }
        }
示例#3
0
        private void AddSourceFilePane(TreeViewItemModel e)
        {
            var vm = new SourceViewModel
            {
                SourceFile = e.FileName,
                SourceCode = File.ReadAllText(e.FileName, Util.GetEncoding(e.FileName)),
                MainVM     = this,
            };

            Documents.Add(vm);

            // 初回表示時、AvalonDock/DocumentPane? に、SourceView 自体がロードすらされないバグの対応
            // 結局原因は謎のままだが、対応としては、現在登録済みのドキュメントペイン全て未選択にしてから、
            // 今回追加分を選択させることで、初回表示時も表示されるようになった。
            foreach (var document in Documents)
            {
                document.IsSelected = false;
            }

            vm.IsSelected = true;
        }
        } // CrearOrden

        private void RecibirProductoTerminado(int docEntryOrden)
        {
            Documents reciboProduccion = (Documents)company.GetBusinessObject(BoObjectTypes.oInventoryGenEntry);

            String referencia = "Generado desde el Portal";

            reciboProduccion.Comments = referencia;
            reciboProduccion.JournalMemo = referencia;

            reciboProduccion.Lines.BaseType = BASETYPE_ORDEN_PRODUCCION;
            reciboProduccion.Lines.BaseEntry = docEntryOrden;

            ObtenerResultado(reciboProduccion.Add() == 0);
            if (this.resultadoVO.Success)
            {
                string docEntry = company.GetNewObjectKey();
                reciboProduccion.GetByKey(int.Parse(docEntry));
                _docEntryRp = docEntry;
                _docNumRp = reciboProduccion.DocNum.ToString();
            }
        } // RecibirProductoTerminado
示例#5
0
        public void SaveAsDraft()
        {
            try
            {
                if (_businessObjectDraft.DocEntry > 0)
                {
                    _businessObjectDraft.Update();
                }
                else
                {
                    _businessObjectDraft.Add();
                }

                Controller.ConnectionController.Instance.VerifyBussinesObjectSuccess();
            }
            catch (Exception ex)
            {
                throw ex;
                //guarda em tabela de banco. Criar uma tabela no banco para cada addon para guardar erro select (sql) e objetos DI (xml)
            }
        }
示例#6
0
        private static Documents CreateFirstDocuments()
        {
            Lines lines = new Lines();

            lines.Add(1, new LineInfo {
                Hits = 1
            });
            lines.Add(2, new LineInfo {
                Hits = 0
            });
            Methods methods = new Methods();

            methods.Add("System.Void Coverlet.Core.Reporters.Tests.OpenCoverReporterTests.TestFormat()", lines);
            Classes classes = new Classes();

            classes.Add("Coverlet.Core.Reporters.Tests.OpenCoverReporterTests", methods);
            Documents documents = new Documents();

            documents.Add("doc.cs", classes);
            return(documents);
        }
示例#7
0
        private static Documents CreateSecondDocuments()
        {
            Lines lines = new Lines();

            lines.Add(1, 1);
            lines.Add(2, 0);

            Methods methods = new Methods();

            methods.Add("System.Void Some.Other.Module.TestClass.TestMethod()", lines);

            Classes classes2 = new Classes();

            classes2.Add("Some.Other.Module.TestClass", methods);

            var documents = new Documents();

            documents.Add("TestClass.cs", classes2);

            return(documents);
        }
        private Documents AddOrderCompra()
        {
            Documents compra = _con.Comany.GetBusinessObject(BoObjectTypes.oPurchaseOrders);

            compra.CardCode   = "F99999";
            compra.DocDueDate = DateTime.Now;

            compra.Lines.ItemCode = "43211";
            compra.Lines.Quantity = 1;

            compra.Lines.Add();

            compra.Lines.ItemCode = "54321";
            compra.Lines.Quantity = 3;

            compra.Add();

            MessageBox.Show(_con.Message);

            return(compra);
        }
示例#9
0
 public void OpenDocument(string filePath)
 {
     try
     {
         var currentDocument = Documents.SingleOrDefault(d => d.Path == filePath);
         if (currentDocument != null)
         {
             SelectedDocument = currentDocument;
         }
         else
         {
             var document = NSwagDocument.LoadDocument(filePath);
             Documents.Add(document);
             SelectedDocument = document;
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show("File open failed: \n" + exception.Message, "Could not load the settings");
     }
 }
示例#10
0
        private static Documents CreateFirstDocuments()
        {
            Lines lines = new Lines();

            lines.Add(1, 1);
            lines.Add(2, 0);
            lines.Add(3, 0);

            Branches branches = new Branches();

            branches.Add(new BranchInfo {
                Line = 1, Hits = 1, Offset = 23, EndOffset = 24, Path = 0, Ordinal = 1
            });
            branches.Add(new BranchInfo {
                Line = 1, Hits = 0, Offset = 23, EndOffset = 27, Path = 1, Ordinal = 2
            });
            branches.Add(new BranchInfo {
                Line = 1, Hits = 0, Offset = 40, EndOffset = 41, Path = 0, Ordinal = 3
            });
            branches.Add(new BranchInfo {
                Line = 1, Hits = 0, Offset = 40, EndOffset = 44, Path = 1, Ordinal = 4
            });

            Methods methods      = new Methods();
            var     methodString = "System.Void Coverlet.Core.Reporters.Tests.OpenCoverReporterTests.TestReport()";

            methods.Add(methodString, new Method());
            methods[methodString].Lines    = lines;
            methods[methodString].Branches = branches;

            Classes classes = new Classes();

            classes.Add("Coverlet.Core.Reporters.Tests.OpenCoverReporterTests", methods);

            Documents documents = new Documents();

            documents.Add("doc.cs", classes);

            return(documents);
        }
示例#11
0
        private void ExtractMessage(Stream stream, String safeFile, String format)
        {
            MailMessage message = null;

            try
            {
                var options = new MailMessageLoadOptions();
                options.FileCompatibilityMode = FileCompatibilityMode.SkipValidityChecking;

                switch (format)
                {
                case "eml":
                    options.MessageFormat = MessageFormat.Eml;
                    break;

                case "msg":
                    options.MessageFormat = MessageFormat.Msg;
                    break;
                }

                message = MailMessage.Load(stream, options);
            }
            catch
            {
                String file = GetAttachmentFileName(safeFile);

                using (var fs = File.Create(file))
                {
                    Byte[] buffer = new Byte[stream.Length];
                    stream.Read(buffer, 0, buffer.Length);
                    fs.Write(buffer, 0, buffer.Length);
                }

                Documents.Add(new Document(file, safeFile, SaveToPath, batchNumber, emailID, DocumentSource.Attachment));

                return;
            }

            ExtractDocuments(message, true);
        }
示例#12
0
        public void SplitDocument(ViewModels.DocumentViewModel docVM, int splitInterval)
        {
            ViewModels.DocumentViewModel newDocVM;
            Models.Document newDoc;
            int             docCount = 0;

            if (docVM == null || splitInterval <= 0)
            {
                return;
            }

            newDocVM = docVM;

            //newDoc = new Models.Document();
            //newDocVM = new DocumentViewModel(newDoc);

            while (docVM.PageCount > splitInterval)
            {
                // current doc VM reached its goal page-count - start the next one...
                if (newDocVM.PageCount >= splitInterval)
                {
                    newDoc = new Models.Document();

                    newDoc.fName = docVM.DocName;
                    //newDoc.Rename("-" + (++docCount), true);
                    newDoc.Rename("." + (++docCount) + "-" + (newDoc.id), true);
                    newDoc.image = docVM.Pages[0].Image;

                    newDocVM = new DocumentViewModel(newDoc);
                    //RenameDoc(newDocVM, docVM.DocName, true);
                    Documents.Add(newDocVM);
                    //docCount++;
                }
                else
                {
                    newDocVM.Pages.Add(docVM.Pages[splitInterval]);
                    docVM.Pages.RemoveAt(splitInterval);
                }
            }
        }
示例#13
0
        public DiscoveryClientResultCollection ReadAll(string topLevelFilename)
        {
            StreamReader  sr  = new StreamReader(topLevelFilename);
            XmlSerializer ser = new XmlSerializer(typeof(DiscoveryClientResultsFile));
            DiscoveryClientResultsFile resfile = (DiscoveryClientResultsFile)ser.Deserialize(sr);

            sr.Close();

            string basePath = Path.GetDirectoryName(topLevelFilename);

            foreach (DiscoveryClientResult dcr in resfile.Results)
            {
                Type type             = Type.GetType(dcr.ReferenceTypeName);
                DiscoveryReference dr = (DiscoveryReference)Activator.CreateInstance(type);
                dr.Url = dcr.Url;
                FileStream fs = new FileStream(Path.Combine(basePath, dcr.Filename), FileMode.Open, FileAccess.Read);
                Documents.Add(dr.Url, dr.ReadDocument(fs));
                fs.Close();
                References.Add(dr.Url, dr);
            }
            return(resfile.Results);
        }
示例#14
0
 public void AddDocument(string[] fragments, int currentIndex, Document pending)
 {
     if (currentIndex == fragments.Length - 1)
     {
         foreach (Document doc in Documents)
         {
             if (doc == pending)
             {
                 return;
             }
         }
         Documents.Add(pending);
     }
     else
     {
         if (Branches.ContainsKey(fragments[currentIndex + 1]) == false)
         {
             Branches[fragments[currentIndex + 1]] = new ClueTreeNode(fragments[currentIndex + 1], this);
         }
         Branches[fragments[currentIndex + 1]].AddDocument(fragments, currentIndex + 1, pending);
     }
 }
示例#15
0
        public ProjectState WithAddedHostDocument(HostDocument hostDocument, Func <Task <TextAndVersion> > loader)
        {
            if (hostDocument == null)
            {
                throw new ArgumentNullException(nameof(hostDocument));
            }

            if (loader == null)
            {
                throw new ArgumentNullException(nameof(loader));
            }

            // Ignore attempts to 'add' a document with different data, we only
            // care about one, so it might as well be the one we have.
            if (Documents.ContainsKey(hostDocument.FilePath))
            {
                return(this);
            }

            var documents = Documents.Add(hostDocument.FilePath, DocumentState.Create(Services, hostDocument, loader));

            // Compute the effect on the import map
            var importTargetPaths         = GetImportDocumentTargetPaths(hostDocument.TargetPath);
            var importsToRelatedDocuments = AddToImportsToRelatedDocuments(ImportsToRelatedDocuments, hostDocument, importTargetPaths);

            // Now check if the updated document is an import - it's important this this happens after
            // updating the imports map.
            if (importsToRelatedDocuments.TryGetValue(hostDocument.TargetPath, out var relatedDocuments))
            {
                foreach (var relatedDocument in relatedDocuments)
                {
                    documents = documents.SetItem(relatedDocument, documents[relatedDocument].WithImportsChange());
                }
            }

            var state = new ProjectState(this, ProjectDifference.DocumentAdded, HostProject, ProjectWorkspaceState, documents, importsToRelatedDocuments);

            return(state);
        }
        private void SetupDataForArithmeticPrecision()
        {
            Lines lines = new Lines();

            lines.Add(1, 1);
            for (int i = 2; i <= 6; i++)
            {
                lines.Add(i, 0);
            }
            Branches branches = new Branches();

            branches.Add(new BranchInfo {
                Line = 1, Hits = 1, Offset = 1, Path = 0, Ordinal = 1
            });
            for (int i = 2; i <= 6; i++)
            {
                branches.Add(new BranchInfo {
                    Line = 1, Hits = 0, Offset = 1, Path = 1, Ordinal = (uint)i
                });
            }

            Methods methods      = new Methods();
            var     methodString = "System.Void Coverlet.Core.Tests.CoverageSummaryTests::TestCalculateSummary()";

            methods.Add(methodString, new Method());
            methods[methodString].Lines    = lines;
            methods[methodString].Branches = branches;

            Classes classes = new Classes();

            classes.Add("Coverlet.Core.Tests.CoverageSummaryTests", methods);

            Documents documents = new Documents();

            documents.Add("doc.cs", classes);

            _moduleArithmeticPrecision = new Modules();
            _moduleArithmeticPrecision.Add("module", documents);
        }
示例#17
0
 private void ProcessDocument(string docBlock, IEnumerable <DocumentSettings> settings)
 {
     try
     {
         foreach (var set in settings)
         {
             if (set.DocumentTypePatterns.All(c => Regex.Match(docBlock, c).Success))
             {
                 var document = ReportDocumentParser.Parse(docBlock, set);
                 if (document != null)
                 {
                     Documents.Add(document);
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.LogError(e, "Document processing error");
         throw;
     }
 }
        /// <summary>Add the window to this manager</summary>
        /// <param name="doc"></param>
        /// <returns>False if the document is null or wasn't also added to Documents because IsClosed</returns>
        public bool AddDocument(DockWindowViewModel doc)
        {
            if (doc == null)
            {
                return(false);
            }

            if (Documents == null)
            {
                Documents = new ObservableCollection <DockWindowViewModel>();
            }

            doc.PropertyChanged += DockWindowViewModel_PropertyChanged;

            if (doc.IsClosed)
            {
                return(false);
            }

            Documents.Add(doc);
            return(true);
        }
示例#19
0
        public CoverageSummaryTests()
        {
            Lines lines = new Lines();

            lines.Add(1, new LineInfo {
                Hits = 1
            });
            lines.Add(2, new LineInfo {
                Hits = 0
            });
            Branches branches = new Branches();

            branches.Add(1, new List <BranchInfo>());
            branches[1].Add(new BranchInfo {
                Hits = 1, Offset = 1, Path = 0, Ordinal = 1
            });
            branches[1].Add(new BranchInfo {
                Hits = 1, Offset = 1, Path = 1, Ordinal = 2
            });

            Methods methods      = new Methods();
            var     methodString = "System.Void Coverlet.Core.Tests.CoverageSummaryTests::TestCalculateSummary()";

            methods.Add(methodString, new Method());
            methods[methodString].Lines    = lines;
            methods[methodString].Branches = branches;

            Classes classes = new Classes();

            classes.Add("Coverlet.Core.Tests.CoverageSummaryTests", methods);

            Documents documents = new Documents();

            documents.Add("doc.cs", classes);

            _modules = new Modules();
            _modules.Add("module", documents);
        }
示例#20
0
        public static DocumentInstance OpenStartPage()
        {
            //select already opened
            var w = FindWindow <StartPageWindow>();

            if (w != null)
            {
                SelectDockWindow(w);
                return(w.Document);
            }

            var document = new DocumentInstance("", null, "");

            Documents.Add(document);

            var window = new StartPageWindow();

            window.InitDocumentWindow(document, null, false, null);

            EditorForm.Instance.WorkspaceController.AddDockWindow(window, false, true);

            return(document);
        }
示例#21
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);
                }
            };
        }
示例#22
0
        private static Documents CreateSecondDocuments()
        {
            var lines = new Lines();

            lines.Add(1, 1);
            lines.Add(2, 0);

            var    methods      = new Methods();
            string methodString = "System.Void Some.Other.Module.TestClass.TestMethod()";

            methods.Add(methodString, new Method());
            methods[methodString].Lines = lines;

            var classes2 = new Classes();

            classes2.Add("Some.Other.Module.TestClass", methods);

            var documents = new Documents();

            documents.Add("TestClass.cs", classes2);

            return(documents);
        }
示例#23
0
        //...

        public void Open(string filePath)
        {
            foreach (var i in Documents)
            {
                var j = (FileDocument)i;
                if (j.Path.ToLower() == filePath.ToLower())
                {
                    ActiveContent = j;
                    return;
                }
            }

            var document = FileDocument.Load(filePath);

            if (document != null)
            {
                Documents.Add(document);
                Get.Current <Options>().RecentFiles.Add(document.Path);
                return;
            }

            OnErrorOpening(filePath);
        }
示例#24
0
        private void AddDocument(string id)
        {
            // just activate an already opened item
            var          documents = Items.OfType <DocumentBase>();
            DocumentBase document  = documents.FirstOrDefault(e => e.Id == id);

            if (document != null)
            {
                ActivateItem(document);
                return;
            } //eif

            // Else create a new note and activate it.
            // In this example we deal with a single document type, but you
            // could easily add some logic to add different types.
            // TODO: add your new-document logic here
            NoteViewModel vm = IoC.Get <NoteViewModel>();

            vm.DisplayName = vm.DisplayName + " - " + GetNextDocumentNumber(vm.GetType());
            vm.Id          = id;
            Documents.Add(vm);
            ActivateItem(vm);
        }
示例#25
0
        async Task GetDocuments()
        {
            if (IsBusy)
            {
                return;
            }

            Exception error = null;

            try
            {
                IsBusy = true;


                var items = await DataStore.GetItemsAsync();

                Documents.Clear();
                foreach (var item in items)
                {
                    Documents.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error: " + ex);
                error = ex;
            }
            finally
            {
                IsBusy = false;
            }

            if (error != null)
            {
                await Application.Current.MainPage.DisplayAlert("Error!", error.Message, "OK");
            }
        }
示例#26
0
        /// <summary>
        /// Reads properties of "Document" metadata objects
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="conf"></param>
        /// <param name="ct"></param>
        /// <returns></returns>
        private async Task ReadDocumentsAsync(DbConnection connection, BracketsFileNode conf, CancellationToken ct)
        {
            var objectGuids = GetMetadataObjectGuids(conf.GetNode(4, 1, 1, 4));

            foreach (var objectGuid in objectGuids)
            {
                var objectInfo = BracketsFileParser.Parse(await GetStringConfigFileDataAsync(connection, objectGuid, ct));

                var obj = ReadMetadataObject <Document>(objectInfo.GetNode(1, 9, 1), objectGuid);

                var objectDetailsNodesCount = (int)objectInfo.GetNode(2);

                for (int i = 3; i < (3 + objectDetailsNodesCount); i++)
                {
                    var objectDetailsNode = objectInfo.GetNode(i);

                    var objectDetailsNodeGuid = (string)objectDetailsNode.GetNode(0);

                    switch (objectDetailsNodeGuid)
                    {
                    case "45e46cbc-3e24-4165-8b7b-cc98a6f80211":
                        obj.Requisities = ReadRequisities(objectDetailsNode);
                        break;

                    case "21c53e09-8950-4b5e-a6a0-1054f1bbc274":
                        obj.TabularSections = ReadTabularSections(objectDetailsNode);
                        break;

                    default:
                        continue;
                    }
                }

                Documents.Add(obj);
            }
        }
        /// <summary>
        /// Reads in a file containing a map of saved discovery documents populating the Documents and References properties,
        /// with discovery documents, XML Schema Definition (XSD) schemas, and service descriptions referenced in the file.
        /// </summary>
        /// <param name="topLevelFilename">Name of file to read in, containing the map of saved discovery documents.</param>
        /// <returns>
        /// A DiscoveryClientResultCollection containing the results found in the file with the map of saved discovery documents.
        /// The file format is a DiscoveryClientProtocol.DiscoveryClientResultsFile class serialized into XML; however, one would
        /// typically create the file using only the WriteAll method or Disco.exe.
        /// </returns>
        public DiscoveryClientResultCollection ReadAllUseBasePath(string topLevelFilename)
        {
            string        basePath             = (new FileInfo(topLevelFilename)).Directory.FullName;
            StreamReader  sr                   = new StreamReader(topLevelFilename);
            XmlSerializer ser                  = new XmlSerializer(typeof(DiscoveryClientResultsFile));
            DiscoveryClientResultsFile resfile = (DiscoveryClientResultsFile)ser.Deserialize(sr);

            sr.Close();

            foreach (DiscoveryClientResult dcr in resfile.Results)
            {
                // Done this cause Type.GetType(dcr.ReferenceTypeName) returned null
                Type type = null;
                switch (dcr.ReferenceTypeName)
                {
                case "System.Web.Services.Discovery.ContractReference":
                    type = typeof(System.Web.Services.Discovery.ContractReference);
                    break;

                case "System.Web.Services.Discovery.DiscoveryDocumentReference":
                    type = typeof(System.Web.Services.Discovery.DiscoveryDocumentReference);
                    break;

                default:
                    continue;
                }

                DiscoveryReference dr = (DiscoveryReference)Activator.CreateInstance(type);
                dr.Url = dcr.Url;
                FileStream fs = new FileStream(Path.Combine(basePath, dcr.Filename), FileMode.Open, FileAccess.Read);
                Documents.Add(dr.Url, dr.ReadDocument(fs));
                fs.Close();
                References.Add(dr.Url, dr);
            }
            return(resfile.Results);
        }
示例#28
0
        public void Open(string path)
        {
            path = Path.GetFullPath(path);

            if (RecentFiles.Contains(path))
            {
                RecentFiles.Remove(path);
            }
            RecentFiles.Insert(0, path);

            foreach (var doc in Documents)
            {
                if (doc.FilePath == path)
                {
                    CurrentDocument = doc;
                    return;
                }
            }

            var newDoc = new Document(path);

            Documents.Add(newDoc);
            CurrentDocument = newDoc;
        }
示例#29
0
        internal void SwapTwoPageMode(BookViewModelBase o)
        {
            //Documents.Remove(o);

            BookViewModelBase newModel = null;
            BookViewModelBase oldModel = null;

            if (o is ComicViewModel)
            {
                ComicViewModel comic = o as ComicViewModel;
                newModel = new TwoPageViewModel(o.Data, comic.CurrentPage.Index, comic.FitMode, comic.PreviousScale);
            }
            else
            {
                TwoPageViewModel comic = o as TwoPageViewModel;
                newModel = new ComicViewModel(o.Data, comic.CurrentPageIndex, comic.FitMode, comic.PreviousScale);
            }

            oldModel = o;
            Documents.Add(newModel);
            SetActiveWorkspace(newModel);

            Documents.Remove(oldModel);
        }
示例#30
0
        public void RefreshSamples(bool canGetDatas = true)
        {
            if (SysProcessManager == null)
            {
                return;
            }
            if (!mudoleHasInit)
            {
                return;
            }
            if (SysProcessManager.CurrentProcessTasks.Any(d => d.Publisher == this))
            {
                XLogSys.Print.WarnFormat("{0}已经有任务在执行,请在执行完毕后再刷新,或取消该任务", Name);
                return;
            }
            if (dataView == null && MainDescription.IsUIForm && IsUISupport)
            {
                var dock    = MainFrm as IDockableManager ?? ControlExtended.DockableManager;
                var control = dock?.ViewDictionary.FirstOrDefault(d => d.Model == this);
                if (control != null)
                {
                    if (control.View is IRemoteInvoke)
                    {
                        var invoke = control.View as IRemoteInvoke;
                        invoke.RemoteFunc = DropAction;
                    }
                    dynamic dy = control.View;

                    dataView     = dy.DataList;
                    scrollViewer = dy.ScrollViewer;

                    alltoolList            = dy.ETLToolList;
                    alltoolList.MouseMove += (s, e) =>
                    {
                        if (e.LeftButton == MouseButtonState.Pressed)
                        {
                            var attr = alltoolList.SelectedItem as XFrmWorkAttribute;
                            if (attr == null)
                            {
                                return;
                            }

                            var data = new DataObject(typeof(XFrmWorkAttribute), attr);
                            try
                            {
                                DragDrop.DoDragDrop(control.View as UserControl, data, DragDropEffects.Move);
                            }
                            catch (Exception ex)
                            {
                            }
                        }
                    };
                }
            }
            Documents.Clear();

            var alltools = CurrentETLTools.Take(ETLMount).ToList();
            var hasInit  = false;
            var func     = Aggregate(d => d, alltools, false);

            if (!canGetDatas)
            {
                return;
            }
            var temptask = TemporaryTask.AddTempTask(Name + "_转换",
                                                     func(new List <IFreeDocument>()).Take(SampleMount),
                                                     data =>
            {
                ControlExtended.UIInvoke(() =>
                {
                    Documents.Add((data));
                    if (hasInit == false && Documents.Count > 2)
                    {
                        InitUI();
                        hasInit = true;
                    }
                });
            }, d =>
            {
                if (!hasInit)
                {
                    InitUI();
                    hasInit = true;
                }
            }
                                                     , SampleMount);

            temptask.Publisher = this;
            SysProcessManager.CurrentProcessTasks.Add(temptask);
        }