Ejemplo n.º 1
0
        private void DownloadEnded(object sender, DownloaderEventArgs e)
        {
            Console.WriteLine(e.Downloader.State == DownloaderState.EndedWithError
                                ? $"Download Ended With Error '{e.Downloader.LastError.Message}'"
                                : "Download Ended");

            // validate file
            SetControlPropertyValue(status, "Text", "Validating file...");
            if (FileValidator.Validate(e.Downloader.LocalFile, Hash))
            {
                SetControlPropertyValue(status, "Text", "Download finished");
            }
            else
            {
                SetControlPropertyValue(status, "Text", "Invalid file");
            }

            // update window
            SetControlPropertyValue(start, "Text", "Close");
            SetControlPropertyValue(progress, "Value", 100);
            Downloads = StatusDownload.finished;

            // force to update the persisted list
            _persistedList.Dispose();
            _manualResetEventSlim.Set();
        }
Ejemplo n.º 2
0
        void Instance_DownloadRemoved(object sender, DownloaderEventArgs e)
        {
            //try
            //{
            //    this.BeginInvoke((MethodInvoker)delegate()
            //    {
            //        ListViewItem item = mapDownloadToItem[e.Downloader] as ListViewItem;

            //        if (item != null)
            //        {
            //            if (item.Selected)
            //            {
            //                lastSelection = null;
            //                //lvwDownloads.SelectedItems.Clear();
            //            }

            //            mapDownloadToItem[e.Downloader] = null;
            //            mapItemToDownload[item] = null;

            //            item.Remove();
            //        }
            //    }
            //);
            //}
            //catch { }
        }
Ejemplo n.º 3
0
        void Instance_DownloadEnded(object sender, DownloaderEventArgs e)
        {
            UpdateList();

            // close download progress dialog
            HideProgressDialog(e.Downloader);

            // check if should show finish dialog
            if (e.Downloader.State != DownloaderState.EndedWithError)
            {
                if (MonoDM.App.Settings.Default.ShowFinishedDialog)
                {
                    using (DownloadFinishedDialog dlg = new DownloadFinishedDialog())
                    {
                        dlg.Url        = e.Downloader.ResourceLocation.URL;
                        dlg.SaveTo     = e.Downloader.LocalFile;
                        dlg.Downloader = e.Downloader;
                        dlg.RefreshUI();
                        dlg.Run();
                    }
                }
            }
            else
            {
                GtkUtils.ShowMessageBox(null, "Error downloading " + System.IO.Path.GetFileName(e.Downloader.LocalFile) + "\n" + e.Downloader.LastError?.Message,
                                        MessageType.Error);
            }

            Log(
                e.Downloader,
                String.Format(
                    "Download ended {0}",
                    e.Downloader.ResourceLocation.URL),
                LogMode.Information);
        }
Ejemplo n.º 4
0
        private static void DownloadEnded(object sender, DownloaderEventArgs e)
        {
            Console.WriteLine(e.Downloader.State == DownloaderState.EndedWithError
                ? $"Download Ended With Error '{e.Downloader.LastError.Message}'"
                : "Download Ended");

            _manualResetEventSlim.Set();
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     The background downloader worker progress changed event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The event args.</param>
        private void BackgroundDownloader_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            downloadedFilesCount = DownloadedFiles.Count;
            var arr = (object[])e.UserState;
            DownloaderEventArgs _event = new DownloaderEventArgs((int)arr[0], (int)arr[1], (string)arr[2], (ProgressStatus)arr[3], arr[4]);

            ProgressChanged?.Invoke(_event);
        }
Ejemplo n.º 6
0
        protected void OnDataWritten(DownloaderEventArgs e)
        {
            EventHandler <DownloaderEventArgs> handler = DataWritten;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Ejemplo n.º 7
0
    public void DownloadStarted(DownloaderEventArgs e)
    {
        EventHandler downloadProgress = DownloadProgress;

        if (downloadProgress != null)
        {
            downloadProgress(this, e);
        }
    }
Ejemplo n.º 8
0
 void Instance_DownloadEnded(object sender, DownloaderEventArgs e)
 {
     Log(
         e.Downloader,
         String.Format(
             "Download ended {0}",
             e.Downloader.ResourceLocation.URL),
         LogMode.Information);
 }
Ejemplo n.º 9
0
 void Instance_DownloadAdded(object sender, DownloaderEventArgs e)
 {
     if (IsHandleCreated)
     {
         this.BeginInvoke((MethodInvoker) delegate() { AddDownload(e.Downloader); });
     }
     else
     {
         AddDownload(e.Downloader);
     }
 }
Ejemplo n.º 10
0
 static void Instance_DownloadEnded(object sender, DownloaderEventArgs e)
 {
     if (parameters.ShowBallon &&
         AppManager.Instance.Application.NotifyIcon.Visible)
     {
         AppManager.Instance.Application.NotifyIcon.ShowBalloonTip(
             parameters.BallonTimeout,
             AppManager.Instance.Application.MainForm.Text,
             String.Format("Download finished: {0}", e.Downloader.LocalFile),
             ToolTipIcon.Info);
     }
 }
Ejemplo n.º 11
0
 void Instance_DownloadRemoved(object sender, DownloaderEventArgs e)
 {
     this.Dispatcher.BeginInvoke(new Action(() =>
     {
         DownLoadFileInfo item = mapDownloadToObj[e.Downloader] as DownLoadFileInfo;
         if (item != null)
         {
             DownloadingList.Remove(item);
             mapDownloadToObj[e.Downloader] = null;
             mapObjToDownload[item]         = null;
         }
     }
                                            ));
 }
Ejemplo n.º 12
0
        void Instance_DownloadAdded(object sender, DownloaderEventArgs e)
        {
            if (!e.WillStart)
            {
                StartJobsIfNeeded();

                e.Downloader.StateChanged += (s, ea) =>
                {
                    if (((Downloader)s).State == DownloaderState.WaitingForReconnect)
                    {
                        StartJobsIfNeeded();
                    }
                };
            }
        }
Ejemplo n.º 13
0
        void Instance_DownloadRemoved(object sender, DownloaderEventArgs e)
        {
            Application.Invoke((s, ea) =>
            {
                if (mapDownloadToItem[e.Downloader] is DownloadListNode item)
                {
                    if (lastSelection == item)
                    {
                        lastSelection = null;
                    }

                    mapDownloadToItem[e.Downloader] = null;
                    mapItemToDownload[item]         = null;

                    NodeStore.RemoveNode(item);
                }
            }
                               );
        }
Ejemplo n.º 14
0
        void Instance_DownloadRemoved(object sender, DownloaderEventArgs e)
        {
            this.BeginInvoke((MethodInvoker) delegate()
            {
                ListViewItem item = mapDownloadToItem[e.Downloader] as ListViewItem;

                if (item != null)
                {
                    if (item.Selected)
                    {
                        lastSelection = null;
                    }

                    mapDownloadToItem[e.Downloader] = null;
                    mapItemToDownload[item]         = null;

                    item.Remove();
                }
            }
                             );
        }
        // The event that will trigger when the WebClient is completed
        private void DownloadCompleted(object sender, DownloaderEventArgs e)
        {
            timer.Dispose();

            if (downloader != null)
            {
                if (downloader.State == DownloaderState.EndedWithError)
                {
                    Helpers.ConsolePrint("MinersDownloader", downloader.LastError.Message);
                }
                else if (downloader.State == DownloaderState.Ended)
                {
                    Helpers.ConsolePrint(TAG, "DownloadCompleted Success");
                    System.Threading.Thread.Sleep(100);
                    int try_count = 50;
                    while (!File.Exists(_downloadSetup.BinsZipLocation) && try_count > 0)
                    {
                        --try_count;
                    }

                    UnzipStart();
                }
            }
        }
Ejemplo n.º 16
0
        private void DownloaderUC_ProgressChanged(object sender, DownloaderEventArgs e)
        {
            //each data iteration will be sent here
            if (e.SpeedInUnit != "")
            {
                speedInUnit = e.SpeedInUnit?.ToString() + "/s";
            }

            if (e.EstimatedTimeCurrentDownload != "")
            {
                estimatedTimeCurrentDownload = e.EstimatedTimeCurrentDownload;
            }

            if (e.EstimatedTimeTotal != "")
            {
                estimatedTimeTotal = e.EstimatedTimeTotal;
            }

            DownloadProgressBar.Value = e.PercentCompletedCurrentDownload;
            ProgressLabel.Text        = DownloadProgressBar.Value + "%";

            OverallProgressProgressBar.Value = e.PercentCompletedTotal;
            OverallProgressPercentLabel.Text = OverallProgressProgressBar.Value + "%";
        }
Ejemplo n.º 17
0
        private void Instance_DownloadRemoved(object sender, DownloaderEventArgs e)
        {
            this.BeginInvoke((MethodInvoker) delegate()
            {
                //ListViewItem item = mapDownloadToItem[e.Downloader] as ListViewItem;
                ListViewItem item = lvwDownloads.Items[e.Downloader.OrderedIndex];

                if (item != null)
                {
                    if (item.Selected)
                    {
                        lastSelection = null;
                        lvwSegments.Items.Clear();
                        //lvwDownloads.SelectedItems.Clear();
                    }

                    //mapDownloadToItem[e.Downloader] = null;
                    //mapItemToDownload[item] = null;
                    item.Remove();
                    UpdateList(true);
                }
            }
                             );
        }
Ejemplo n.º 18
0
 private void _downloader_Progress(object sender, DownloaderEventArgs e)
 {
     lock (progressLock)
     {
         var progress = Math.Round(100m * (decimal)e.BytesReceived / (decimal)e.TotalBytesToReceive, 1);
         if (oldProgress != progress || _downloader.Params.ResponseData != null)
         {
             oldProgress = progress;
             Invoke((Action) delegate()
             {
                 var mb = Math.Round((decimal)e.BytesReceived / 1024m / 1024m, 1);
                 CurrentLogItem.Message = string.Format("Download... {0}% - {1} MB", progress, mb);
                 if (_downloader.Params.ResponseData != null)
                 {
                     CurrentLogItem.Message = "Saving File...";
                     var zipFileName        = processFileName + ".zip";
                     System.IO.File.WriteAllBytes(zipFileName, _downloader.Params.ResponseData);
                     CurrentLogItem.Message += " Done";
                     Step3AExtractFiles(zipFileName);
                 }
             });
         }
     }
 }
Ejemplo n.º 19
0
 protected void OnProgressChanged(DownloaderEventArgs e)
 {
     ProgressChanged?.Invoke(this, e);
 }
Ejemplo n.º 20
0
 void Instance_DownloadAdded(object sender, DownloaderEventArgs e)
 {
     AddDownload(e.Downloader);
 }
Ejemplo n.º 21
0
        private void DownloadStatusUpdate(object e, DownloaderEventArgs downloaderEventArgs) //linked to OnDataWritten in managerhelper
        {
            long LatestMatchDownloaded = downloaderEventArgs.HighestMatchIdWritten;

            PercentageDownloadComplete = ((double)LatestMatchDownloaded - (double)StartOfDownload) / ((double)EndOfDownload - (double)StartOfDownload);
        }
 static void Instance_DownloadAdded(object sender, DownloaderEventArgs e)
 {
     PlayWav(parameters.DownloadAddedSoundPath);
 }
Ejemplo n.º 23
0
 public void OnDataWrite(object e, DownloaderEventArgs eventArgs)
 {
     Console.WriteLine("basicdownloader has written {0} matches to db", eventArgs.AmountWritten);
 }
Ejemplo n.º 24
0
 void Instance_DownloadEnded(object sender, DownloaderEventArgs e)
 {
     StartJobsIfNeeded();
 }
Ejemplo n.º 25
0
        private void DownloadManager_ProgressChanged(DownloaderEventArgs e)
        {
            // double _bytesReceived = double.Parse(e.BytesReceived.ToString());
            // double _totalBytesToReceive = double.Parse(e.TotalBytesToReceive.ToString());
            /// double _percentage = (_bytesReceived / _totalBytesToReceive) * 100;

            _downloadedFilesCount = _downloadManager.DownloadedFilesCount;
            string _downloadedFilesString = $@"Download File/s: {_downloadedFilesCount} of {_package.Downloads.Count}";

            if (LDownloadFiles.InvokeRequired)
            {
                LDownloadFiles.BeginInvoke((MethodInvoker) delegate
                {
                    LDownloadFiles.Text = _downloadedFilesString;
                });
            }
            else
            {
                LDownloadFiles.Text = _downloadedFilesString;
            }

            // int _value = int.Parse(Math.Truncate(_percentage).ToString(CultureInfo.CurrentCulture));
            int _value = e.PercentDone;

            // if (progressBarFileDownload.InvokeRequired)
            // {
            // progressBarFileDownload.BeginInvoke((MethodInvoker)delegate
            // {
            // progressBarFileDownload.Value = _value;
            // });
            // }
            // else
            // {
            // progressBarFileDownload.Value = _value;
            // }
            string _progressString = $@"Progress: {_value}%";

            if (LProgress.InvokeRequired)
            {
                LProgress.BeginInvoke((MethodInvoker) delegate
                {
                    LProgress.Text = _progressString;
                });
            }
            else
            {
                LProgress.Text = _progressString;
            }

            // Bytes _bytesReceivedType = new Bytes(long.Parse(e.BytesReceived.ToString()))
            // {
            // Abbreviated = true
            // };
            // Bytes _totalBytesToReceiveType = new Bytes(long.Parse(e.TotalBytesToReceive.ToString()))
            // {
            // Abbreviated = true
            // };

            // string _receivedString = @"Received: " + _bytesReceivedType;
            // string _totalSizeString = @"Total Size: " + _totalBytesToReceiveType;

            // if (LBytesReceived.InvokeRequired)
            // {
            // LBytesReceived.BeginInvoke((MethodInvoker)delegate
            // {
            // LBytesReceived.Text = _receivedString;
            // });
            // }
            // else
            // {
            // LBytesReceived.Text = _receivedString;
            // }

            // if (LBytesTotalSize.InvokeRequired)
            // {
            // LBytesTotalSize.BeginInvoke((MethodInvoker)delegate
            // {
            // LBytesTotalSize.Text = _totalSizeString;
            // });
            // }
            // else
            // {
            // LBytesTotalSize.Text = _totalSizeString;
            // }
        }
Ejemplo n.º 26
0
 void Instance_DownloadAdded(object sender, DownloaderEventArgs e)
 {
     this.Dispatcher.BeginInvoke(new Action(() => { AddDownload(e.Downloader); }));
 }
Ejemplo n.º 27
0
 private void OnDataWritten(object e, DownloaderEventArgs eventArgs)
 {
     DataWritten?.Invoke(e, eventArgs);
 }
Ejemplo n.º 28
0
 void infoDownloader_Completed(object sender, DownloaderEventArgs e)
 {
     #region 通过XmlReader解析xml配置文件(无需额外dll,较慢)
     //WebClient infoDownloader = sender as WebClient;
     //infoDownloader.OpenReadCompleted -= wc_OpenReadCompleted;
     ////通过XmlReader解析配置文件
     //XmlReader info = XmlReader.Create(e.Result as Stream);
     //while (info.Read()) {
     //    if (info.IsStartElement("Sprite")) {
     //        info.MoveToAttribute("RealWidth"); info.ReadAttributeValue(); RealWidth = Convert.ToDouble(info.Value);
     //        info.MoveToAttribute("FullName"); info.ReadAttributeValue(); FullName = info.Value;
     //        info.MoveToAttribute("ATK"); info.ReadAttributeValue(); ATK = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("DEF"); info.ReadAttributeValue(); DEF = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("MAG"); info.ReadAttributeValue(); MAG = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("DEX"); info.ReadAttributeValue(); DEX = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("Speed"); info.ReadAttributeValue(); Speed = Convert.ToDouble(info.Value);
     //        info.MoveToAttribute("AttackType"); info.ReadAttributeValue(); AttackType = (AttackTypes)Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("GuardDistance"); info.ReadAttributeValue(); GuardDistance = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("SightDistance"); info.ReadAttributeValue(); SightDistance = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("AttackDistance"); info.ReadAttributeValue(); AttackDistance = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("CastingDistance"); info.ReadAttributeValue(); CastingDistance = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("LifeWidthMax"); info.ReadAttributeValue(); LifeWidthMax = Convert.ToDouble(info.Value);
     //        info.MoveToAttribute("LifeCenterY"); info.ReadAttributeValue(); LifeCenterY = Convert.ToDouble(info.Value);
     //        info.MoveToAttribute("CenterX"); info.ReadAttributeValue(); double centerX = Convert.ToDouble(info.Value);
     //        info.MoveToAttribute("CenterY"); info.ReadAttributeValue(); double centerY = Convert.ToDouble(info.Value);
     //        Center = new Point(centerX, centerY);
     //        info.MoveToAttribute("ModelCode"); info.ReadAttributeValue(); ModelCode = Convert.ToInt32(info.Value);
     //        frames = new Frames();
     //        info.MoveToAttribute("StandTotalFrame"); info.ReadAttributeValue(); frames.StandTotal = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("StandEffectFrame"); info.ReadAttributeValue(); frames.StandEffect = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("StandInterval"); info.ReadAttributeValue(); frames.StandInterval = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("RunTotalFrame"); info.ReadAttributeValue(); frames.RunTotal = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("RunEffectFrame"); info.ReadAttributeValue(); frames.RunEffect = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("RunInterval"); info.ReadAttributeValue(); frames.RunInterval = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("AttackTotalFrame"); info.ReadAttributeValue(); frames.AttackTotal = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("AttackEffectFrame"); info.ReadAttributeValue(); frames.AttackEffect = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("AttackInterval"); info.ReadAttributeValue(); frames.AttackInterval = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("InjureTotalFrame"); info.ReadAttributeValue(); frames.InjureTotal = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("InjureEffectFrame"); info.ReadAttributeValue(); frames.InjureEffect = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("InjureInterval"); info.ReadAttributeValue(); frames.InjureInterval = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("CastingTotalFrame"); info.ReadAttributeValue(); frames.CastingTotal = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("CastingEffectFrame"); info.ReadAttributeValue(); frames.CastingEffect = Convert.ToInt32(info.Value);
     //        info.MoveToAttribute("CastingInterval"); info.ReadAttributeValue(); frames.CastingInterval = Convert.ToInt32(info.Value);
     //    } else if (info.IsStartElement("Frames")) {
     //        while (info.Read()) {
     //            if (info.IsStartElement("Frame")) {
     //                info.MoveToAttribute("ID"); info.ReadAttributeValue(); string id = info.Value;
     //                info.MoveToAttribute("OffsetX"); info.ReadAttributeValue(); int offsetX = Convert.ToInt32(info.Value);
     //                info.MoveToAttribute("OffsetY"); info.ReadAttributeValue(); int offsetY = Convert.ToInt32(info.Value);
     //                frameOffset.Add(id, new Point2D() { X = offsetX, Y = offsetY });
     //            }
     //        }
     //    }
     //}
     #endregion
     #region 通过LinqToSql解析xml配置文件(需要100多K的dll支持,快)
     Downloader infoDownloader = sender as Downloader;
     infoDownloader.Completed -= infoDownloader_Completed;
     string key = string.Format("SpriteInfo{0}", infoDownloader.ResCode);
     if (e.Stream != null) { Global.AddResInfo(key, XElement.Load(e.Stream)); }
     //通过LINQ2XML解析配置文件
     XElement info = Global.ResInfos[key].DescendantsAndSelf("Sprite").Single();
     RealWidth = (double)info.Attribute("RealWidth");
     FullName = info.Attribute("FullName").Value;
     ATK = (int)info.Attribute("ATK");
     DEF = (int)info.Attribute("DEF");
     MAG = (int)info.Attribute("MAG");
     DEX = (int)info.Attribute("DEX");
     Speed = (double)info.Attribute("Speed");
     AttackType = (AttackTypes)(int)info.Attribute("AttackType");
     GuardDistance = (int)info.Attribute("GuardDistance");
     SightDistance = (int)info.Attribute("SightDistance");
     AttackDistance = (int)info.Attribute("AttackDistance");
     CastingDistance = (int)info.Attribute("CastingDistance");
     LifeWidthMax = (double)info.Attribute("LifeWidthMax");
     LifeCenterY = (double)info.Attribute("LifeCenterY");
     Center = new Point((double)info.Attribute("CenterX"), (double)info.Attribute("CenterY"));
     ModelCode = (int)info.Attribute("ModelCode");
     frames = new Frames() {
         StandTotal = (int)info.Attribute("StandTotalFrame"),
         StandEffect = (int)info.Attribute("StandEffectFrame"),
         StandInterval = (int)info.Attribute("StandInterval"),
         RunTotal = (int)info.Attribute("RunTotalFrame"),
         RunEffect = (int)info.Attribute("RunEffectFrame"),
         RunInterval = (int)info.Attribute("RunInterval"),
         AttackTotal = (int)info.Attribute("AttackTotalFrame"),
         AttackEffect = (int)info.Attribute("AttackEffectFrame"),
         AttackInterval = (int)info.Attribute("AttackInterval"),
         InjureTotal = (int)info.Attribute("InjureTotalFrame"),
         InjureEffect = (int)info.Attribute("InjureEffectFrame"),
         InjureInterval = (int)info.Attribute("InjureInterval"),
         CastingTotal = (int)info.Attribute("CastingTotalFrame"),
         CastingEffect = (int)info.Attribute("CastingEffectFrame"),
         CastingInterval = (int)info.Attribute("CastingInterval"),
     };
     //解析各帧偏移
     IEnumerable<XElement> iFrame = Global.ResInfos[key].Element("Frames").Elements();
     frameOffset.Clear();
     foreach (XElement element in iFrame) {
         frameOffset.Add(element.Attribute("ID").Value, new Point2D() {
             X = (int)element.Attribute("OffsetX"),
             Y = (int)element.Attribute("OffsetY"),
         });
     }
     #endregion
     if (State == States.Stand) { Stand(); }
     Coordinate = new Point(Coordinate.X + 0.000001, Coordinate.Y);
     Life = Life;
     HeartStart();
     if (ConfigReady != null) { ConfigReady(this, null); }
     //开始下载所需资源
     if (resList.ContainsKey(infoDownloader.ResCode)) {
         IsResReady = true;
     } else {
         #region 方案3
         //Downloader downloadQueue = new Downloader() { Index = index, ResCode = infoDownloader.ResCode };
         //EventHandler<DownloaderEventArgs> handler = null;
         //downloadQueue.Completed += handler = delegate {
         //    downloadQueue.Completed -= handler;
         //    if (downloadQueue.Index == index) { IsResReady = true; } //换装异步与呈现同步之间的协调
         //    loadedCodes.Add(downloadQueue.ResCode);
         //    //解析精灵图片资源地址表
         //    List<string> uris = new List<string>();
         //    int n = 0;
         //    for (int i = 0; i < (int)info.Attribute("StateTotal"); i++) {
         //        switch (i) {
         //            case 0: n = frames.StandTotal; break;
         //            case 1: n = frames.RunTotal; break;
         //            case 2: n = frames.AttackTotal; break;
         //            case 3: n = frames.InjureTotal; break;
         //            case 4: n = frames.CastingTotal; break;
         //        }
         //        for (int j = 0; j < (int)info.Attribute("DirectionTotal"); j++) {
         //            for (int k = 0; k <= n; k++) {
         //                uris.Add(Global.WebPath(string.Format("Sprite/{0}/{1}-{2}-{3}.png", Code, i, j, k)));
         //            }
         //        }
         //    }
         //};
         //downloadQueue.Download(string.Format("SpriteRes{0}", infoDownloader.ResCode), uris);
         #endregion
         #region 方案1、2
         IsResReady = false;
         Downloader resDownloader = new Downloader() { Index = index, ResCode = infoDownloader.ResCode };
         EventHandler<DownloaderEventArgs> handler = null;
         resDownloader.Completed += handler = (sender1, e1) => {
             resDownloader.Completed -= handler;
             if (resDownloader.Index == index) { IsResReady = true; }
             if (!resList.ContainsKey(resDownloader.ResCode)) {
                 resList.Add(resDownloader.ResCode, new StreamResourceInfo(e1.Stream, "application/binary"));
             }
         };
         resDownloader.Download(string.Format("Sprite{0}.xap", infoDownloader.ResCode));
         #endregion
     }
 }
Ejemplo n.º 29
0
 void Instance_DownloadEnded(object sender, DownloaderEventArgs e)
 {
 }