コード例 #1
0
        public void LoadReleaseFromXml(string path)
        {
            this.busyIndicator.IsBusy = true;

            new Task(() =>
            {
                using (XmlReleaseImporter xmlReleaseImporter = new XmlReleaseImporter(path, this.CollectionManager))
                {
                    this.release = xmlReleaseImporter.ImportRelease();
                }

                this.Dispatcher.InvokeAction(() =>
                {
                    this.releaseDetails.Visibility = Visibility.Visible;
                    this.tracklistView.Visibility = Visibility.Visible;
                    this.busyIndicator.IsBusy = false;

                    this.UpdateUI();
                });
            }).Start();
        }
コード例 #2
0
        private void OnXmlFileDropped(string file)
        {
            if (this.DatabaseRelease.Images.Count != 0 || this.DatabaseRelease.AdditionalFiles.Count != 0)
            {
                if (!Dialogs.Confirm("This will replace all images, additional files and other data. Continue?"))
                {
                    return;
                }
            }

            WaitWindow waitWindow = new WaitWindow("Reading release data...");
            waitWindow.ShowDialog(this, () =>
            {
                var tempFactory = new MemorySessionFactory();
                var tempManager = tempFactory.CreateCollectionManager();

                using (XmlReleaseImporter xmlReleaseImporter = new XmlReleaseImporter(file, tempManager))
                {
                    Release release = xmlReleaseImporter.ImportRelease();

                    this.Dispatcher.InvokeAction(() =>
                    {
                        this.LoadDataFromRelease(release, tempManager.ImageHandler);

                        tempManager.Dispose();
                        tempFactory.Dispose();
                    });
                }
            });
        }