Exemplo n.º 1
0
        public async void Generate()
        {
            try
            {
                this.BeginProgress();
                var metaData = await Task.Run(() => this.service.GetMetaData(this.Address, this.DataBase, this.Tags, this.FilterExpression, this.IsDevmode, -1));

                var generator = this.generators.FirstOrDefault(item => item.Name == this.LanguageType);
                generator.Generate(this.OutputPath, metaData.Item1, CodeGenerationSettings.Default);
                var serializer = this.serializers.First();
                serializer.Serialize(System.IO.Path.Combine(this.OutputPath, "crema.dat"), metaData.Item2);

                this.settingsList.Add(this.settings);
                this.configs.Commit(this);
                if (this.OpenAfterGenerate == true)
                {
                    Process.Start("explorer", this.OutputPath);
                }
                this.EndProgress();
            }
            catch (Exception e)
            {
                AppMessageBox.ShowError(e);
                this.EndProgress();
            }
        }
Exemplo n.º 2
0
        public async Task OpenAsync(string path1, string path2, string filterExpression)
        {
            try
            {
                this.BeginProgress("loading data");
                this.dataSet = await Task.Run(async() =>
                {
                    var filter = filterExpression == string.Empty ? null : filterExpression;
                    var tasks  = new Task <CremaDataSet>[]
                    {
                        Task.Run(() => CremaDataSet.ReadFromDirectory(path1, filter)),
                        Task.Run(() => CremaDataSet.ReadFromDirectory(path2, filter)),
                    };

                    Task.WaitAll(tasks);
                    var dataSet1 = tasks[0].Result;
                    var dataSet2 = tasks[1].Result;

                    dataSet1.ExtendedProperties["location"] = Path.GetFileNameWithoutExtension(path1);
                    dataSet2.ExtendedProperties["location"] = Path.GetFileNameWithoutExtension(path2);
                    await this.Dispatcher.InvokeAsync(() => this.ProgressMessage = "comparing data");
                    return(this.Compare(dataSet1, dataSet2));
                });

                this.EndProgress();
                this.OnLoaded(EventArgs.Empty);
            }
            catch (Exception e)
            {
                await AppMessageBox.ShowErrorAsync(e.Message);

                this.EndProgress();
                return;
            }
        }
Exemplo n.º 3
0
        private async void Initialize()
        {
            try
            {
                this.BeginProgress(Resources.Message_LoadingData);
                await TableContentDescriptorUtility.BeginEditAsync(this.authentication, this.contentDescriptor);

                if (this.contentDescriptor.TargetDomain is IDomain domain && domain.Source is CremaDataSet dataSet)
                {
                    foreach (var item in this.Tables)
                    {
                        item.Source = dataSet.Tables[item.Name];
                        item.Domain = domain;
                    }
                }
            }
            catch (Exception e)
            {
                await AppMessageBox.ShowErrorAsync(e);

                this.EndProgress();
                this.DetachEvent();
                this.Tables.Clear();
                await this.TryCloseAsync();

                return;
            }

            this.EndProgress();
            this.NotifyOfPropertyChange(nameof(this.Tables));
            this.NotifyOfPropertyChange(nameof(this.SelectedTable));
            this.NotifyOfPropertyChange(nameof(this.IsProgressing));
        }
Exemplo n.º 4
0
            protected override void InitializeComponents()
            {
                base.InitializeComponents();
                btnOK.Click += (sender, e) =>
                {
                    if (ItemText.IsNullOrWhiteSpace())
                    {
                        AppMessageBox.Show(AppString.Message.TextCannotBeEmpty);
                        return;
                    }
                    if (ItemCommand.IsNullOrWhiteSpace())
                    {
                        AppMessageBox.Show(AppString.Message.CommandCannotBeEmpty);
                        return;
                    }
                    AddNewItem();
                    DialogResult = DialogResult.OK;
                };

                btnBrowse.Click += (sender, e) =>
                {
                    using (OpenFileDialog dlg = new OpenFileDialog())
                    {
                        if (dlg.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }
                        this.ItemFilePath = dlg.FileName;
                        this.ItemText     = Path.GetFileNameWithoutExtension(dlg.FileName);
                    }
                };
            }
Exemplo n.º 5
0
        private async void UserContext_MessageReceived(object sender, MessageEventArgs e)
        {
            var message     = e.Message;
            var messageType = e.MessageType;
            var sendUserID  = e.UserID;
            var userIDs     = e.Items.Select(item => item.ID).ToArray();

            if (messageType == MessageType.Notification)
            {
                if (e.UserID != this.authenticator.ID && (userIDs.Any() == false || userIDs.Any(item => item == this.authenticator.ID) == true))
                {
                    await this.Dispatcher.InvokeAsync(() =>
                    {
                        var title = string.Format(Resources.Title_AdministratorMessage_Format, sendUserID);
                        this.flashService?.Flash();
                        AppMessageBox.Show(message, title, MessageBoxButton.OK, MessageBoxImage.Information);
                    });
                }
            }
            else if (messageType == MessageType.None)
            {
                await this.Dispatcher.InvokeAsync(async() =>
                {
                    var userContext = this.cremaAppHost.GetService(typeof(IUserContext)) as IUserContext;
                    var dialog      = await ViewMessageViewModel.CreateInstanceAsync(this.authenticator, userContext, message, sendUserID);
                    dialog?.ShowDialog();
                });
            }
        }
Exemplo n.º 6
0
 private void ShowDonateDialog()
 {
     this.Cursor = Cursors.WaitCursor;
     using (UAWebClient client = new UAWebClient())
     {
         string url      = AppConfig.RequestUseGithub ? AppConfig.GithubDonateRaw : AppConfig.GiteeDonateRaw;
         string contents = client.GetWebString(url);
         //contents = System.IO.File.ReadAllText(@"..\..\..\Donate.md");//用于求和更新Donate.md文件
         if (contents == null)
         {
             if (AppMessageBox.Show(AppString.Message.WebDataReadFailed + "\r\n"
                                    + AppString.Message.OpenWebUrl, MessageBoxButtons.OKCancel) == DialogResult.OK)
             {
                 url = AppConfig.RequestUseGithub ? AppConfig.GithubDonate : AppConfig.GiteeDonate;
                 ExternalProgram.OpenWebUrl(url);
             }
         }
         else
         {
             using (DonateListDialog dlg = new DonateListDialog())
             {
                 dlg.DanateData = contents;
                 dlg.ShowDialog();
             }
         }
     }
     this.Cursor = Cursors.Default;
 }
Exemplo n.º 7
0
        private static async Task <string> LockAsync(Authentication authentication, ITypeDescriptor descriptor, string comment)
        {
            if (descriptor.Target is IType type)
            {
                try
                {
                    var lockInfo = await type.Dispatcher.InvokeAsync(() => type.LockInfo);

                    if (lockInfo.IsLocked == false || lockInfo.IsInherited == true)
                    {
                        var lockComment = comment + ":" + Guid.NewGuid();
                        await type.LockAsync(authentication, lockComment);

                        return(lockComment);
                    }
                    return(string.Empty);
                }
                catch (Exception e)
                {
                    await AppMessageBox.ShowErrorAsync(e);

                    return(null);
                }
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Exemplo n.º 8
0
        public async void SelectDataBase(string dataBaseName)
        {
            try
            {
                if (this.isOpened == false)
                {
                    throw new InvalidOperationException(Resources.Exception_CannotSelectWithoutLoggingIn);
                }

                this.BeginProgress();
                if (this.DataBaseName != string.Empty)
                {
                    await this.UnloadAsync();
                }
                await this.LoadAsync(dataBaseName);

                this.EndProgress();
            }
            catch (Exception e)
            {
                await AppMessageBox.ShowErrorAsync(e);

                this.EndProgress();
            }
        }
        private void ChangeLanguage()
        {
            int index = GetSelectIndex();

            if (cmbLanguages.SelectedIndex == index)
            {
                return;
            }
            string language = languages[cmbLanguages.SelectedIndex];
            string msg      = "";

            if (cmbLanguages.SelectedIndex != 0)
            {
                string langPath = $@"{AppConfig.LangsDir}\{language}.ini";
                msg = new IniWriter(langPath).GetValue("Message", "RestartApp");
            }
            if (msg == "")
            {
                msg = AppString.Message.RestartApp;
            }
            if (AppMessageBox.Show(msg, MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                cmbLanguages.SelectedIndex = index;
            }
            else
            {
                if (language == CultureInfo.CurrentUICulture.Name)
                {
                    language = "";
                }
                AppConfig.Language = language;
                SingleInstance.Restart();
            }
        }
Exemplo n.º 10
0
        public async static Task <bool> DeleteAsync(Authentication authentication, IDataBaseDescriptor descriptor)
        {
            if (descriptor.Target is IDataBase dataBase)
            {
                if (await new DeleteViewModel().ShowDialogAsync() != true)
                {
                    return(false);
                }

                try
                {
                    await dataBase.DeleteAsync(authentication);

                    await AppMessageBox.ShowAsync(Resources.Message_Deleted);

                    return(true);
                }
                catch (Exception e)
                {
                    await AppMessageBox.ShowErrorAsync(e);

                    return(false);
                }
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Exemplo n.º 11
0
        public async static Task <bool> UnloadAsync(Authentication authentication, IDataBaseDescriptor descriptor)
        {
            if (descriptor.Target is IDataBase dataBase)
            {
                try
                {
                    if (descriptor.AuthenticationInfos.Any() == true && await AppMessageBox.ShowProceedAsync(Resources.Message_VerifyToCloseDataBase) == false)
                    {
                        return(false);
                    }
                    await dataBase.UnloadAsync(authentication);

                    return(true);
                }
                catch (Exception e)
                {
                    await AppMessageBox.ShowErrorAsync(e);

                    return(false);
                }
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Exemplo n.º 12
0
        public async void Start()
        {
            this.IsProgressing            = true;
            this.service.RepositoryModule = this.RepositoryModule;
            this.service.BasePath         = this.BasePath;
            this.service.Port             = this.Port;
            try
            {
                this.Message = "서버를 구동중입니다.";
                await Task.Run(() => this.service.Open());

                this.IsOpened = true;
            }
            catch (Exception e)
            {
                AppMessageBox.ShowError(e);
                this.IsOpened = false;
            }
            finally
            {
                this.IsProgressing = false;
            }

            this.Message = "서버를 시작하였습니다.";
            this.NotifyOfPropertyChange(() => this.CanStart);
            this.NotifyOfPropertyChange(() => this.CanStop);
            this.NotifyOfPropertyChange(() => this.Title);
            this.OnOpened(EventArgs.Empty);
        }
 private void DeleteReference()
 {
     if (AppMessageBox.Show(AppString.Message.ConfirmDeleteReference, MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         Owner.DeleteItem(this);
     }
 }
Exemplo n.º 14
0
        private async void SetAccessTypeAsync(AccessType accessType)
        {
            var oldValue = this.accessType;

            try
            {
                this.accessType = accessType;
                this.NotifyOfPropertyChange(nameof(this.AccessType));
                this.CanChange = false;
                var accessInfo = await this.dispatcher.InvokeAsync(() =>
                {
                    this.accessible.SetAccessMember(this.authentication, this.MemberID, accessType);
                    return(this.accessible.AccessInfo);
                });

                this.accessType = accessType;
                await this.Dispatcher.InvokeAsync(() => this.viewMdoel.SetAccessInfo(accessInfo));
            }
            catch (Exception e)
            {
                this.accessType = oldValue;
                AppMessageBox.ShowError(e);
            }
            finally
            {
                this.CanChange = true;
                this.NotifyOfPropertyChange(nameof(this.AccessType));
            }
        }
Exemplo n.º 15
0
        protected async override void OnExecute(object parameter)
        {
            try
            {
                if (parameter is ListBoxItemViewModel viewModel && viewModel.Target is ITableItem tableItem)
                {
                    if (viewModel is IInfoProvider provider)
                    {
                        var props     = provider.Info;
                        var revision  = (long)props["Revision"];
                        var tableName = await tableItem.Dispatcher.InvokeAsync(() => tableItem.Name);

                        var dialog = new CommonSaveFileDialog();
                        dialog.Filters.Add(new CommonFileDialogFilter("excel file", "*.xlsx"));
                        dialog.DefaultFileName  = $"{tableName}_{revision}";
                        dialog.DefaultExtension = "xlsx";

                        if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
                        {
                            var dataSet = await tableItem.Dispatcher.InvokeAsync(() => tableItem.GetDataSet(this.authenticator, revision));

                            var writer = new SpreadsheetWriter(dataSet);
                            writer.Write(dialog.FileName);
                            AppMessageBox.Show(Resources.Message_Exported);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                AppMessageBox.ShowError(e);
            }
        }
Exemplo n.º 16
0
        //public ICommand PreviewCommand
        //{
        //    get { return this.previewCommand; }
        //}

        protected async override void OnInitialize()
        {
            base.OnInitialize();

            try
            {
                this.BeginProgress(Resources.Message_ReceivingInfo);
                this.itemsSource = await this.dataBase.Dispatcher.InvokeAsync(() =>
                {
                    var logs    = this.dataBase.GetLog(this.authentication);
                    var logList = new List <LogInfoViewModel>(logs.Length);
                    foreach (var item in logs)
                    {
                        logList.Add(new LogInfoViewModel(this.authentication, this.dataBase, item));
                    }
                    return(logList.ToArray());
                });

                this.selectedItem = null;
                this.EndProgress();
                this.NotifyOfPropertyChange(nameof(this.SelectedItem));
                this.NotifyOfPropertyChange(nameof(this.ItemsSource));
            }
            catch (Exception e)
            {
                this.EndProgress();
                AppMessageBox.ShowError(e);
                this.TryClose();
            }
        }
Exemplo n.º 17
0
        public async void Connect(string address, string dataBaseName, string tags, string filterExpression, bool isDevmode)
        {
            this.DisplayName = "connecting...";

            try
            {
                this.BeginProgress();
                var metaData = await Task.Run(() => this.service.GetDataGenerationData(address, dataBaseName, tags, filterExpression, isDevmode, -1));

                using (var stream = new MemoryStream())
                {
                    this.serializer.Serialize(stream, metaData);
                    stream.Position = 0;
                    this.dataSet    = CremaReader.Read(stream);
                }

                this.tables.Clear();

                foreach (var item in this.dataSet.Tables.OrderBy(i => i.Name))
                {
                    this.tables.Add(new ItemViewModel(item));
                }
                this.EndProgress();
            }
            catch (Exception e)
            {
                AppMessageBox.ShowError(e);
                this.EndProgress();
                this.Dispose();
                return;
            }

            this.DisplayName = address;
            this.NotifyOfPropertyChange(() => this.ItemsSource);
        }
Exemplo n.º 18
0
        internal static async Task <bool> ExecuteInternlAsync(IShell shell)
        {
            if (shell.IsModified == true)
            {
                var result = await AppMessageBox.ConfirmSaveOnClosingAsync();

                if (result == true)
                {
                    if (shell.SettingsPath != string.Empty)
                    {
                        await shell.SaveSettingsAsync();
                    }
                    else if (SaveSettingsCommand.CanExecute(shell) == true)
                    {
                        if (await SaveSettingsCommand.ExecuteAsync(shell) == false)
                        {
                            return(false);
                        }
                    }
                }
                else if (result == null)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 19
0
        public async void Change()
        {
            try
            {
                this.BeginProgress(this.IsNew ? Resources.Message_Creating : Resources.Message_Changing);
                await this.template.Dispatcher.InvokeAsync(() =>
                {
                    this.template.EndEdit(this.authentication);
                    this.template.EditEnded    -= Template_EditEnded;
                    this.template.EditCanceled -= Template_EditCanceled;
                    this.template.Changed      -= Template_Changed;
                });

                this.domain     = null;
                this.template   = null;
                this.isModified = false;
                this.EndProgress();
                this.TryClose(true);
            }
            catch (Exception e)
            {
                this.EndProgress();
                AppMessageBox.ShowError(e);
            }
        }
Exemplo n.º 20
0
        public async Task NewFolderAsync()
        {
            var query = from item in this.Items
                        where item is BookmarkCategoryTreeViewItemViewModel
                        let viewModel = item as BookmarkCategoryTreeViewItemViewModel
                                        select viewModel.DisplayName;

            var dialog = new NewCategoryViewModel(PathUtility.Separator, query.ToArray());

            if (await dialog.ShowDialogAsync() != true)
            {
                return;
            }

            try
            {
                var viewModel = this.CreateInstance(dialog.CategoryPath, this.Browser);
                this.Items.Add(viewModel);
                this.Items.Reposition(viewModel);
                this.IsExpanded = true;
                this.Browser.UpdateBookmarkItems();
            }
            catch (Exception e)
            {
                await AppMessageBox.ShowErrorAsync(e);
            }
        }
Exemplo n.º 21
0
        private static async Task UnlockAsync(Authentication authentication, ITypeDescriptor descriptor, string comment)
        {
            if (descriptor.Target is IType type)
            {
                if (type.Dispatcher == null)
                {
                    return;
                }

                try
                {
                    var lockInfo = await type.Dispatcher.InvokeAsync(() => type.LockInfo);

                    if (lockInfo.IsLocked == true && lockInfo.IsInherited == false && lockInfo.Comment == comment)
                    {
                        await type.UnlockAsync(authentication);
                    }
                }
                catch (Exception e)
                {
                    await AppMessageBox.ShowErrorAsync(e);
                }
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Exemplo n.º 22
0
        protected override void OnExecute(object parameter)
        {
            var viewModel = parameter as TreeViewItemViewModel;
            var items     = viewModel.Items.OfType <ITypeDescriptor>().Select(item => item.Name);

            AppMessageBox.Show(string.Join(Environment.NewLine, items));
        }
        protected async override void OnExecute(object parameter)
        {
            if (this.cremaAppHost.GetService(typeof(IDataBase)) is IDataBase dataBase)
            {
                var viewModel = parameter as TreeViewItemViewModel;

                var query = from item in viewModel.Items
                            where item.Target is ITable
                            let table = item.Target as ITable
                                        select table;

                var paths = await dataBase.Dispatcher.InvokeAsync(() =>
                {
                    return(query.Where(item => item.VerifyAccessType(this.authenticator, AccessType.Guest)).
                           Select(item => item.Path).
                           Distinct().
                           ToArray());
                });

                if (paths.Any() == false)
                {
                    await AppMessageBox.ShowAsync(Resources.Message_NoneTablesToExport);
                }
                else
                {
                    var dialog = await ExportViewModel.CreateInstanceAsync(this.authenticator, this.cremaAppHost, paths);

                    if (dialog != null)
                    {
                        await dialog.ShowDialogAsync();
                    }
                }
            }
        }
Exemplo n.º 24
0
 private static async Task <string> LockAsync(Authentication authentication, ITableCategoryDescriptor descriptor, string comment)
 {
     if (descriptor.Target is ITableCategory category)
     {
         try
         {
             return(await category.Dispatcher.InvokeAsync(() =>
             {
                 if (category.IsLocked == false || category.LockInfo.IsInherited == true)
                 {
                     var lockComment = comment + ":" + Guid.NewGuid();
                     category.Lock(authentication, lockComment);
                     return lockComment;
                 }
                 return string.Empty;
             }));
         }
         catch (Exception e)
         {
             AppMessageBox.ShowError(e);
             return(null);
         }
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Exemplo n.º 25
0
        protected async override void OnExecute(object parameter)
        {
            try
            {
                if (parameter is ITableDescriptor descriptor && descriptor.Target is ITable table)
                {
                    var template = table.Template;
                    await template.BeginEditAsync(authenticator);

                    try
                    {
                        await template.SetTagsAsync(authenticator, TagInfoUtility.Client);

                        await template.EndEditAsync(authenticator);
                    }
                    catch
                    {
                        await template.CancelEditAsync(authenticator);

                        throw;
                    }
                }
            }
            catch (Exception e)
            {
                await AppMessageBox.ShowErrorAsync(e);
            }
        }
Exemplo n.º 26
0
        private static async Task UnlockAsync(Authentication authentication, ITableCategoryDescriptor descriptor, string comment)
        {
            if (descriptor.Target is ITableCategory category)
            {
                if (category.Dispatcher == null)
                {
                    return;
                }

                try
                {
                    await category.Dispatcher.InvokeAsync(() =>
                    {
                        var lockInfo = category.LockInfo;
                        if (lockInfo.IsLocked == true && lockInfo.IsInherited == false && lockInfo.Comment == comment)
                        {
                            category.Unlock(authentication);
                        }
                    });
                }
                catch (Exception e)
                {
                    AppMessageBox.ShowError(e);
                }
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Exemplo n.º 27
0
        public override async Task ExportAsync(bool showExportCompletedMessageBox = true)
        {
            var cancellationTokenSource = new CancellationTokenSource();
            var progress = new Progress();

            this.CanExport = false;

            try
            {
                this.BeginProgress();
                var categories = this.EnumerateSelectedCategory(this.Root).ToArray();

                if (this.SelectedExporter.Settings is ExcelTableTemplateExporterSettings settings)
                {
                    await this.ExcelExportAsync(settings, categories);
                }
                else
                {
                    throw new NotSupportedException(this.SelectedExporter.Settings.GetType().ToString());
                }

                this.configService[this.GetType(), nameof(SelectedExporter)] = this.SelectedExporter.Name;
                this.configService.Commit(this);
            }
            catch (Exception e)
            {
                AppMessageBox.ShowError(e);
            }
            finally
            {
                this.EndProgress();
                this.CanExport = true;
                cancellationTokenSource.Dispose();
            }
        }
Exemplo n.º 28
0
        public static async Task <EditTemplateViewModel> CreateInstanceAsync(Authentication authentication, ITypeDescriptor descriptor)
        {
            if (authentication == null)
            {
                throw new ArgumentNullException(nameof(authentication));
            }
            if (descriptor == null)
            {
                throw new ArgumentNullException(nameof(descriptor));
            }

            if (descriptor.Target is IType type)
            {
                try
                {
                    return(await type.Dispatcher.InvokeAsync(() =>
                    {
                        type.Template.BeginEdit(authentication);
                        return new EditTemplateViewModel(authentication, type, type.Template);
                    }));
                }
                catch (Exception e)
                {
                    AppMessageBox.ShowError(e);
                    return(null);
                }
            }
            else
            {
                throw new ArgumentException("Invalid Target of Descriptor", nameof(descriptor));
            }
        }
Exemplo n.º 29
0
        protected async override void OnExecute(object parameter)
        {
            try
            {
                if (parameter is ISelector selector && selector.SelectedItem is ListBoxItemViewModel viewModel && viewModel.Target is IDataBase dataBase)
                {
                    if (viewModel is IInfoProvider provider)
                    {
                        var props        = provider.Info;
                        var revision     = (string)props["Revision"];
                        var dataBaseName = await dataBase.Dispatcher.InvokeAsync(() => dataBase.Name);

                        var dialog = new CommonSaveFileDialog();
                        dialog.Filters.Add(new CommonFileDialogFilter("excel file", "*.xlsx"));
                        dialog.DefaultFileName  = $"{dataBaseName}_{revision}";
                        dialog.DefaultExtension = "xlsx";

                        if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
                        {
                            var dataSet = await dataBase.GetDataSetAsync(this.authenticator, CremaDataSetFilter.Default, revision);

                            var writer = new SpreadsheetWriter(dataSet);
                            writer.Write(dialog.FileName);
                            await AppMessageBox.ShowErrorAsync(Resources.Message_Exported);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                await AppMessageBox.ShowErrorAsync(e);
            }
        }
Exemplo n.º 30
0
        public async void Open(string filename)
        {
            try
            {
                this.DisplayName = "loading...";
                this.BeginProgress();
                this.dataSet = await Task.Run(() => CremaReader.Read(filename));

                this.tables = new ObservableCollection <ItemViewModel>();

                foreach (var item in this.dataSet.Tables.OrderBy(i => i.Name))
                {
                    this.tables.Add(new ItemViewModel(item));
                }

                this.EndProgress();
            }
            catch (Exception e)
            {
                AppMessageBox.ShowError(e.Message);
                this.EndProgress();
                this.Dispose();
                return;
            }

            this.DisplayName = Path.GetFileName(filename);
            this.Comment     = filename;
            this.NotifyOfPropertyChange(() => this.ItemsSource);
        }