Ejemplo n.º 1
0
        protected RecordViewModel(T model, bool loadable = true)
            : this()
        {
            Model         = model ?? throw new ArgumentNullException(nameof(model));
            ExpandCommand = new AsyncRelayCommand(ExpandAsync);
            OpenWindowsExplorerCommand = new RelayCommand(OpenWindowsExplorer, CanOpenWindowsExplorer);
            OpenRegistryEditorCommand  = new RelayCommand(OpenRegistryEditor, CanOpenRegistryEditor);
            CopyCodeCommand            = new RelayCommand(CopyCode);
            CopyRegistryCodeCommand    = new RelayCommand(CopyRegistryCode);
            UninstallCommand           = new RelayCommand(Uninstall, CanUninstall);
            RepairCommand = new RelayCommand(Repair, CanRepair);

            if (loadable)
            {
                Items.Add(_textItem = new TextItemViewModel());
            }
        }
Ejemplo n.º 2
0
        private async Task ExpandAsync()
        {
            if (_textItem != null)
            {
                _textItem.Text = "Loading...";
                _textItem.Type = TextItemType.Information;

                try
                {
                    await LoadAsync();
                }
                catch (Exception ex)
                {
                    _textItem.Text = ex.Message;
                    _textItem.Type = TextItemType.Error;
                    return;
                }

                Items.Remove(_textItem);
                _textItem = null;
            }
        }