Exemplo n.º 1
0
        /// <summary>
        /// The Vm_OpenZipArchiveRequested.
        /// </summary>
        /// <param name="sender">The sender<see cref="object"/>.</param>
        /// <param name="e">The e<see cref="EventArgs"/>.</param>
        private void Vm_OpenZipArchiveRequested(object sender, EventArgs e)
        {
            var vm = DataContext as MainViewModel;

            Debug.Assert(vm != null);
            Debug.Assert(vm.SelectedZipFilesCollection.Count == 1);
            var zfr = vm.SelectedZipFilesCollection[0];

            Debug.Assert(zfr != null);

            try
            {
                WpfHelper.SetWindowSettings(Window.GetWindow(this));
                var win = new ZipArchiveWindow(zfr);
                win.ShowDialog();

                // Raise SelectedZipFile.Folders chanbged event in case folders were added
                vm.SelectedZipFile?.RaiseFoldersChangedEvent();
            }
            catch (Exception ex)
            {
                App.Inform("Exception Encountered", "An exception occurred while trying to open the file. The zip file format may not be recognized.");
                var log = FileLogProvider.Instance.GetLogFor <MainView>();
                log.DebugException($"Unable to open {zfr.Filename}", ex);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// The Vm_OpenZipArchiveRequested.
        /// </summary>
        /// <param name="sender">The sender<see cref="object"/>.</param>
        /// <param name="e">The e<see cref="EventArgs"/>.</param>
        private void Vm_OpenZipArchiveRequested(object sender, EventArgs e)
        {
            var zfr = sender as ZipFileViewModel;

            Debug.Assert(zfr != null);

            try
            {
                WpfHelper.SetWindowSettings(Window.GetWindow(this));
                var win = new ZipArchiveWindow(zfr);
                win.ShowDialog();
            }
            catch (Exception ex)
            {
                App.Inform("Exception Encountered", "An exception occurred while trying to open the file.");
                var log = FileLogProvider.Instance.GetLogFor <ZipFileView>();
                log.DebugException($"Unable to open {zfr.Filename}", ex);
            }
        }