/// <summary>
    /// Default constructor
    /// </summary>
    /// <param name="vm">The view model</param>
    public ArchiveExplorerUI(ArchiveExplorerDialogViewModel vm)
    {
        // Set up UI
        InitializeComponent();

        // Set properties
        ViewModel   = vm;
        DataContext = ViewModel;

        // Set up remaining things once fully loaded
        Loaded += ArchiveExplorer_Loaded;
    }
Exemplo n.º 2
0
    /// <summary>
    /// Default constructor
    /// </summary>
    /// <param name="filePath">The file path for the archive</param>
    /// <param name="manager">The archive data manager</param>
    /// <param name="loadOperation">The operation to use when running an async operation which needs to load</param>
    /// <param name="explorerDialogViewModel">The explorer dialog view model</param>
    /// <param name="isDuplicateName">Indicates if the name of the archive matches the name of another loaded archive</param>
    public ArchiveViewModel(FileSystemPath filePath, IArchiveDataManager manager, Operation loadOperation, ArchiveExplorerDialogViewModel explorerDialogViewModel, bool isDuplicateName) : base(null, filePath.Name, null)
    {
        Logger.Info("An archive view model is being created for {0}", filePath.Name);

        // Set properties
        FilePath                = filePath;
        Manager                 = manager;
        LoadOperation           = loadOperation;
        ExplorerDialogViewModel = explorerDialogViewModel;
        IsDuplicateName         = isDuplicateName;
        ThumbnailCache          = new ArchiveThumbnailCache();

        // Create commands
        SaveCommand         = new AsyncRelayCommand(SaveAsync);
        OpenLocationCommand = new AsyncRelayCommand(OpenLocationAsync);

        // Open the file stream
        OpenFile();
    }