Beispiel #1
0
            public CopyFilesQueue(string SourceFld, String TargetFld /*, WebBrowser Browser*/,
                                  CheckedListBox chkList, CancellationToken cancellationToken,
                                  delegateCreateElement c, delegateUpdateElement u, delegateGetElement g, delegateProgressBar PM, delegateProgressBar PV
                                  )
            {
                this.SetProgressBarMaximum = PM;
                this.SetProgressBarValue   = PV;
                this.SourceFolder          = SourceFld;
                this.cancellationToken     = cancellationToken;
                this.CreateElement         = c;
                this.UpdateElement         = u;
                this.GetElement            = g;
                TargetFld = TargetFld.Trim();
                if (!TargetFld.EndsWith("\\"))
                {
                    TargetFld += "\\";
                }
                this.TargetFolder = @"\" + TargetFld.Substring(0, 1) + @"$" + TargetFld.Substring(2);

                BaseFolderLenght = SourceFolder.Length;

                divFile = (HtmlElement)THIS.Invoke(CreateElement, "div");
                divFile.SetAttribute("id", "div.Files");
                StringBuilder Output = new StringBuilder();

                GetFolder(SourceFolder, Output);
                Output.Append("Total " + File.Count + " files<br>");
                divFile.InnerHtml = Output.ToString() + _BRLF;
                THIS.BeginInvoke(UpdateElement, divFile);

                divHost = (HtmlElement)THIS.Invoke(CreateElement, "div");
                divHost.SetAttribute("id", "div.Hosts");
                divHost.InnerHtml = HTMLTagSpan("Host list:", CSS_BaseHighLight) + _BRLF;
                GetHost(chkList);
                THIS.BeginInvoke(UpdateElement, divHost);
                THIS.BeginInvoke(UpdateElement, divFile);
                Host.ForEach(h => h.FCount = File.Count);
                THIS.BeginInvoke(SetProgressBarMaximum, File.Count * Host.Count);
            }
Beispiel #2
0
        async void CopyFiles()
        {
            await Task.Run(() =>
            {
                delegateCreateElement c = new delegateCreateElement(CreateHtmlElement);
                delegateUpdateElement u = new delegateUpdateElement(UpdateHtmlElement);
                delegateGetElement g    = new delegateGetElement(GetHtmlElement);
                delegateProgressBar PM  = new delegateProgressBar(SetProgressBarMaximum);
                delegateProgressBar PV  = new delegateProgressBar(SetProgressBarValue);

                /*
                 * HtmlElement divFile;
                 * divFile = (HtmlElement)THIS.Invoke(c, "div");
                 * divFile.SetAttribute("id", "div.Files");
                 * divFile.InnerHtml = "FILES";
                 * BeginInvoke(u, divFile);               */

                CopyFilesQueue CopyQ = new CopyFilesQueue(tSourceCopy.Text, tTargetCopy.Text /*, wResult/*.Document*/, chkList_PC, cts.Token, c, u, g, PM, PV);
                CopyQ.Copy();
                cts.Cancel();
                End_Run();
            });
        }